diff options
| author | franck cuny <franck@lumberjaph.net> | 2010-10-17 21:42:11 +0200 |
|---|---|---|
| committer | franck cuny <franck@lumberjaph.net> | 2010-10-17 21:42:11 +0200 |
| commit | 78e3b82f6155675f3dba1bab7b434bf060ce46ab (patch) | |
| tree | dc364a01ce3c78e2a959f6514d68f23fd4be02ba /lib/Net/HTTP/Spore.pm | |
| parent | simplify github example (diff) | |
| download | net-http-spore-78e3b82f6155675f3dba1bab7b434bf060ce46ab.tar.gz | |
reflect specification update
Diffstat (limited to '')
| -rw-r--r-- | lib/Net/HTTP/Spore.pm | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/lib/Net/HTTP/Spore.pm b/lib/Net/HTTP/Spore.pm index 23d5bc5..34f4740 100644 --- a/lib/Net/HTTP/Spore.pm +++ b/lib/Net/HTTP/Spore.pm @@ -33,16 +33,16 @@ sub new_from_string { superclasses => ['Net::HTTP::Spore::Core'] ); try { - my $api_base_url; - if ( $spec->{api_base_url} && !$args{api_base_url} ) { - $args{api_base_url} = $spec->{api_base_url}; + my $base_url; + if ( $spec->{base_url} && !$args{base_url} ) { + $args{base_url} = $spec->{base_url}; } - elsif ( !$args{api_base_url} ) { - die "api_base_url is missing!"; + elsif ( !$args{base_url} ) { + die "base_url is missing!"; } - if ( $spec->{api_format} ) { - $args{api_format} = $spec->{api_format}; + if ( $spec->{formats} ) { + $args{formats} = $spec->{formats}; } if ( $spec->{authentication} ) { @@ -68,7 +68,7 @@ sub new_from_spec { my ( $content, $spec ); if ( $spec_file =~ m!^http(s)?://! ) { - my $uri = URI->new($spec_file); + my $uri = URI->new($spec_file); my $req = HTTP::Request->new(GET => $spec_file); my $ua = LWP::UserAgent->new(); my $res = $ua->request( $req ); @@ -100,8 +100,10 @@ sub _add_methods { my $client = Net::HTTP::Spore->new_from_spec('twitter.json'); + # for identica + my $client = Net::HTTP::Spore->new_from_spec('twitter.json', base_url => 'http://identi.ca/com/api'); + $client->enable('Format::JSON'); - $client->enable('Auth::OAuth'); my $timeline = $client->public_timeline(format => 'json'); my $tweets = $timeline->body; |
