[libflickr-api-perl] 13/40: added patch to support zooomr etc

Lucas Kanashiro kanashiro-guest at moszumanska.debian.org
Sat Jul 25 21:12:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

kanashiro-guest pushed a commit to tag 1.08
in repository libflickr-api-perl.

commit c531a04953b519653be5ccc78e0f1b9d487b4e46
Author: Cal Henderson <cal at iamcal.com>
Date:   Mon Sep 29 20:57:44 2008 +0000

    added patch to support zooomr etc
---
 lib/Flickr/API.pm         | 10 ++++++----
 lib/Flickr/API/Request.pm | 12 +++++++-----
 test.pl                   |  4 ++--
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/lib/Flickr/API.pm b/lib/Flickr/API.pm
index 7307858..c6cf34f 100644
--- a/lib/Flickr/API.pm
+++ b/lib/Flickr/API.pm
@@ -16,8 +16,10 @@ sub new {
 	my $class = shift;
 	my $options = shift;
 	my $self = new LWP::UserAgent;
-	$self->{api_key} = $options->{key};
-	$self->{api_secret} = $options->{secret};
+	$self->{api_key}	= $options->{key};
+	$self->{api_secret}	= $options->{secret};
+	$self->{rest_uri}	= $options->{rest_uri} || 'http://www.flickr.com/services/rest/';
+	$self->{auth_uri}	= $options->{auth_uri} || 'http://www.flickr.com/services/auth/';
 
 	eval {
 		require Compress::Zlib;
@@ -65,7 +67,7 @@ sub request_auth_url {
 	my $sig = $self->sign_args(\%args);
 	$args{api_sig} = $sig;
 
-	my $uri = URI->new('http://flickr.com/services/auth');
+	my $uri = URI->new($self->{auth_uri});
 	$uri->query_form(%args);
 
 	return $uri;
@@ -74,7 +76,7 @@ sub request_auth_url {
 sub execute_method {
 	my ($self, $method, $args) = @_;
 
-	my $request = new Flickr::API::Request({'method' => $method, 'args' => $args});
+	my $request = new Flickr::API::Request({'method' => $method, 'args' => $args, rest_uri => $self->{rest_uri}});
 
 	$self->execute_request($request);
 }
diff --git a/lib/Flickr/API/Request.pm b/lib/Flickr/API/Request.pm
index 7fcf644..dbbacbf 100644
--- a/lib/Flickr/API/Request.pm
+++ b/lib/Flickr/API/Request.pm
@@ -6,18 +6,20 @@ use HTTP::Request;
 use URI;
 
 our @ISA = qw(HTTP::Request);
-our $VERSION = '0.02';
+our $VERSION = '0.03';
 
 sub new {
 	my $class = shift;
-	my $self = new HTTP::Request;
 	my $options = shift;
-	$self->{api_method} = $options->{method};
-	$self->{api_args} = $options->{args};
+	my $self = new HTTP::Request;
+	$self->{api_method}	= $options->{method};
+	$self->{api_args}	= $options->{args};
+	$self->{rest_uri}	= $options->{rest_uri} || 'http://www.flickr.com/services/rest/';
+
 	bless $self, $class;
 
 	$self->method('POST');
-        $self->uri('http://www.flickr.com/services/rest/');
+        $self->uri($self->{rest_uri});
 
 	return $self;
 }
diff --git a/test.pl b/test.pl
index 0594f6d..3dcee14 100644
--- a/test.pl
+++ b/test.pl
@@ -70,8 +70,8 @@ foreach my $item (keys %got) {
 	is($expect{$item}, $got{$item}, "Checking that the $item item in the query matches in reverse");
 }
 
-ok($uri->path eq '/services/auth', "Checking correct return path");
-ok($uri->host eq 'flickr.com', "Checking return domain");
+ok($uri->path eq '/services/auth/', "Checking correct return path");
+ok($uri->host eq 'www.flickr.com', "Checking return domain");
 ok($uri->scheme eq 'http', "Checking return protocol");
 
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libflickr-api-perl.git



More information about the Pkg-perl-cvs-commits mailing list