| 1 | package WebService::Rakuten::API; | ||
| 2 | use 5.008005; | ||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | use LWP::UserAgent; | ||
| 6 | use Mouse; | ||
| 7 | use JSON; | ||
| 8 | use URI; | ||
| 9 | our $VERSION = "0.06"; | ||
| 10 | use WebService::Rakuten::API::Provider::Travel; | ||
| 11 | use WebService::Rakuten::API::Provider::Ichiba; | ||
| 12 | use WebService::Rakuten::API::Provider::Recipe; | ||
| 13 | use WebService::Rakuten::API::Provider; | ||
| 14 | use Mouse; | ||
| 15 | use Furl; | ||
| 16 | |||
| 17 | has appid => ( | ||
| 18 | is => 'rw', | ||
| 19 | isa => 'Str', | ||
| 20 | ); | ||
| 21 | |||
| 22 | has provider => ( | ||
| 23 | is =>'ro', | ||
| 24 | isa => 'WebService::Rakuten::API::Provider', | ||
| 25 | lazy_build => 1, | ||
| 26 | ); | ||
| 27 | |||
| 28 | sub _build_provider{ | ||
| 29 | my $self = shift; | ||
| 30 | return WebService::Rakuten::API::Provider->new( | ||
| 31 | furl => Furl->new( | ||
| 32 | agent => 'WebService::Rakuten::API(Perl)', | ||
| 33 | timeout => 10, | ||
| 34 | ), | ||
| 35 | appid => $self->appid, | ||
| 36 | ); | ||
| 37 | } | ||
| 38 | |||
| 39 | sub response{ | ||
| 40 | my($self)= @_; | ||
| 41 | my $ua = LWP::UserAgent->new; | ||
| 42 | } | ||
| 43 | |||
| 44 | sub travel{ | ||
| 45 | my $self = shift; | ||
| 46 | $self->provider->dispatch('travel',@_); | ||
| 47 | } | ||
| 48 | |||
| 49 | sub ichiba{ | ||
| 50 | my $self = shift; | ||
| 51 | $self->provider->dispatch('ichiba',@_); | ||
| 52 | } | ||
| 53 | |||
| 54 | sub books{ | ||
| 55 | my $self = shift; | ||
| 56 | $self->provider->dispatch('books',@_); | ||
| 57 | } | ||
| 58 | |||
| 59 | sub recipe{ | ||
| 60 | my $self =shift; | ||
| 61 | $self->provider->dispatch('recipe',@_); | ||
| 62 | } | ||
| 63 | |||
| 64 | 1; | ||
| 65 | __END__ |