| 1 | package Net::OpenSocial::Client::HTTPRequestBuilder::ST; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use Any::Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | with 'Net::OpenSocial::Client::HTTPRequestBuilder'; | |||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use HTTP::Request; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use URI; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use bytes(); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | 1 | has 'st' => ( | |||||||||||||||||||||||||||
| 11 | is => 'ro', | ||||||||||||||||||||||||||||
| 12 | isa => 'Str', | ||||||||||||||||||||||||||||
| 13 | required => 1, | ||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | 0 | ▶ | sub build_request { | ||||||||||||||||||||||||||
|
Subroutine
build_request: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||
| 17 | 0 | my ( $self, %args ) = @_; | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 0 | my $method = $args{method}; | |||||||||||||||||||||||||||
| 20 | 0 | my $url = $args{url}; | |||||||||||||||||||||||||||
| 21 | 0 | my $params = $args{parmas}; | |||||||||||||||||||||||||||
| 22 | 0 | my $content_type = $args{content_type}; | |||||||||||||||||||||||||||
| 23 | 0 | my $content = $args{content}; | |||||||||||||||||||||||||||
| 24 | 0 | my $container = $args{container}; | |||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 0 | my $uri = URI->new($url); | |||||||||||||||||||||||||||
| 27 | 0 | ▶ | $params ||= {}; | ||||||||||||||||||||||||||
|
Condition0%0/2
$params ||= {}
MC/DC0%0/1
$params ||= {}
$params
Truth table0%0/2
A
A= $params
| |||||||||||||||||||||||||||||
| 28 | 0 | $params->{st} = $self->st; | |||||||||||||||||||||||||||
| 29 | 0 | $uri->query_form(%$params); | |||||||||||||||||||||||||||
| 30 | 0 | my $http_req = HTTP::Request->new( $method => $uri->as_string ); | |||||||||||||||||||||||||||
| 31 | 0 | ▶ | if ( $method eq 'POST' || $method eq 'PUT' ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$method eq "POST" or $method eq "PUT"
MC/DC0%0/2
$method eq "POST" or $method eq "PUT"
$method eq "POST"
$method eq "PUT"
Truth table0%0/3
A or B
A= $method eq "POST"B= $method eq "PUT"
| |||||||||||||||||||||||||||||
| 32 | 0 | $http_req->header( 'Content-Type' => $content_type ); | |||||||||||||||||||||||||||
| 33 | 0 | $http_req->header( 'Content-Length' => bytes::length($content) ); | |||||||||||||||||||||||||||
| 34 | 0 | $http_req->content($content); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | 0 | return $http_req; | |||||||||||||||||||||||||||
| 37 | } | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 1 | ▶ | no Any::Moose; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 40 | 1 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||
| 41 | 1 | 1; | |||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =head1 NAME | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | Net::OpenSocial::Client::HTTPRequestBuilder::ST - Security token request builder | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | my $builder = Net::OpenSocial::Client::HTTPRequestBuilder::ST->new( | ||||||||||||||||||||||||||||
| 50 | st => q{securitytokenvalue}, | ||||||||||||||||||||||||||||
| 51 | ); | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | my $http_req = $builder->build_request(...); | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | HTTP Request builder with security-token authentication | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | =head1 METHODS | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | =head2 build_request | ||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | =head1 AUTHOR | ||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||
| 65 | Lyo Kato, E<lt>lyo.kato@gmail.comE<gt> | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | =head1 COPYRIGHT AND LICENSE | ||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||
| 69 | Copyright (C) 2009 by Lyo Kato | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | This library is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||
| 72 | it under the same terms as Perl itself, either Perl version 5.8.8 or, | ||||||||||||||||||||||||||||
| 73 | at your option, any later version of Perl 5 you may have available. | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | =cut | ||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||