| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WWW::Giraffi::API::Service; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 5 | use strict; | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 27 |  | 
| 4 | 1 |  |  | 1 |  | 5 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 44 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 7 | use parent qw(WWW::Giraffi::API::Request); | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 6 |  | 
| 7 |  |  |  |  |  |  |  | 
| 8 |  |  |  |  |  |  | our $VERSION = '0.2_04'; | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  | sub all { | 
| 11 |  |  |  |  |  |  |  | 
| 12 | 0 |  |  | 0 | 1 |  | my ( $self, $other_options ) = @_; | 
| 13 | 0 |  |  |  |  |  | return $self->search(undef, $other_options); | 
| 14 |  |  |  |  |  |  | } | 
| 15 |  |  |  |  |  |  |  | 
| 16 |  |  |  |  |  |  | sub search { | 
| 17 |  |  |  |  |  |  |  | 
| 18 | 0 |  |  | 0 | 1 |  | my ( $self, $conditions, $other_options ) = @_; | 
| 19 | 0 |  |  |  |  |  | return $self->get( "services.json", $conditions, $other_options ); | 
| 20 |  |  |  |  |  |  | } | 
| 21 |  |  |  |  |  |  |  | 
| 22 |  |  |  |  |  |  | sub find { | 
| 23 |  |  |  |  |  |  |  | 
| 24 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $other_options ) = @_; | 
| 25 | 0 |  |  |  |  |  | return $self->get( sprintf( "services/%s.json", $id ), undef, $other_options ); | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | sub find_region { | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $other_options ) = @_; | 
| 31 | 0 |  |  |  |  |  | return $self->get( sprintf( "services/%s/regions.json", $id ), undef, $other_options ); | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | sub find_trigger { | 
| 35 |  |  |  |  |  |  |  | 
| 36 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $other_options ) = @_; | 
| 37 | 0 |  |  |  |  |  | return $self->get( sprintf( "services/%s/triggers.json", $id ), undef, $other_options ); | 
| 38 |  |  |  |  |  |  | } | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | sub update { | 
| 41 |  |  |  |  |  |  |  | 
| 42 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $conditions, $other_options ) = @_; | 
| 43 | 0 |  |  |  |  |  | return $self->put( sprintf("services/%s.json", $id), undef, { service => $conditions }, $other_options ); | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  |  | 
| 46 |  |  |  |  |  |  | sub update_region { | 
| 47 |  |  |  |  |  |  |  | 
| 48 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $region_code, $other_options ) = @_; | 
| 49 | 0 |  |  |  |  |  | return $self->put( sprintf("services/%s/regions/%s.json", $id, $region_code), undef, {}, $other_options ); | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  | sub destroy { | 
| 53 |  |  |  |  |  |  |  | 
| 54 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $other_options ) = @_; | 
| 55 | 0 |  |  |  |  |  | return $self->delete( sprintf("services/%s.json", $id), undef, undef, $other_options ); | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  |  | 
| 58 |  |  |  |  |  |  | sub add_trigger { | 
| 59 |  |  |  |  |  |  |  | 
| 60 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $conditions, $other_options ) = @_; | 
| 61 | 0 |  |  |  |  |  | return $self->post( sprintf("services/%s/triggers.json", $id), undef, { trigger => $conditions }, $other_options ); | 
| 62 |  |  |  |  |  |  | } | 
| 63 |  |  |  |  |  |  |  | 
| 64 |  |  |  |  |  |  | sub remove_trigger { | 
| 65 |  |  |  |  |  |  |  | 
| 66 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $trigger_id, $other_options ) = @_; | 
| 67 | 0 |  |  |  |  |  | return $self->delete( sprintf("services/%s/triggers/%s.json", $id, $trigger_id), undef, undef, $other_options ); | 
| 68 |  |  |  |  |  |  | } | 
| 69 |  |  |  |  |  |  | 1; | 
| 70 |  |  |  |  |  |  |  | 
| 71 |  |  |  |  |  |  | __END__ |