| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WWW::Giraffi::API::Item; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 6 | use strict; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 38 |  | 
| 4 | 1 |  |  | 1 |  | 4 | use warnings; | 
|  | 1 |  |  |  |  | 2 |  | 
|  | 1 |  |  |  |  | 23 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 1 |  |  | 1 |  | 5 | use parent qw(WWW::Giraffi::API::Request); | 
|  | 1 |  |  |  |  | 1 |  | 
|  | 1 |  |  |  |  | 4 |  | 
| 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( "items.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( "items/%s.json", $id ), undef,  $other_options); | 
| 26 |  |  |  |  |  |  | } | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | sub find_service { | 
| 29 |  |  |  |  |  |  |  | 
| 30 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $conditions, $other_options ) = @_; | 
| 31 | 0 |  |  |  |  |  | return $self->get( sprintf( "items/%s/services.json", $id ), $conditions, $other_options ); | 
| 32 |  |  |  |  |  |  | } | 
| 33 |  |  |  |  |  |  |  | 
| 34 |  |  |  |  |  |  | # this method has not been tested | 
| 35 |  |  |  |  |  |  | sub find_agent { | 
| 36 |  |  |  |  |  |  |  | 
| 37 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $other_options ) = @_; | 
| 38 | 0 |  |  |  |  |  | return $self->get( sprintf( "%s/items/%s/agent", $self->monitoringdata_endpoint, $id ), undef, $other_options ); | 
| 39 |  |  |  |  |  |  | } | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | sub create { | 
| 42 |  |  |  |  |  |  |  | 
| 43 | 0 |  |  | 0 | 1 |  | my ( $self, $conditions, $other_options ) = @_; | 
| 44 | 0 |  |  |  |  |  | return $self->post( "items.json", undef, { item => $conditions }, $other_options ); | 
| 45 |  |  |  |  |  |  | } | 
| 46 |  |  |  |  |  |  |  | 
| 47 |  |  |  |  |  |  | sub update { | 
| 48 |  |  |  |  |  |  |  | 
| 49 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $conditions, $other_options ) = @_; | 
| 50 | 0 |  |  |  |  |  | return $self->put( sprintf("items/%s.json", $id), undef, { item => $conditions }, $other_options ); | 
| 51 |  |  |  |  |  |  | } | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  | sub destroy { | 
| 55 |  |  |  |  |  |  |  | 
| 56 | 0 |  |  | 0 | 1 |  | my ( $self, $id , $other_options ) = @_; | 
| 57 | 0 |  |  |  |  |  | return $self->delete( sprintf("items/%s.json", $id), undef, undef, $other_options ); | 
| 58 |  |  |  |  |  |  | } | 
| 59 |  |  |  |  |  |  |  | 
| 60 |  |  |  |  |  |  | sub reload { | 
| 61 |  |  |  |  |  |  |  | 
| 62 | 0 |  |  | 0 | 1 |  | my ( $self, $other_options ) = @_; | 
| 63 | 0 |  |  |  |  |  | return $self->post("items/reload.json", undef, undef, $other_options); | 
| 64 |  |  |  |  |  |  | } | 
| 65 |  |  |  |  |  |  |  | 
| 66 |  |  |  |  |  |  | sub add_service { | 
| 67 |  |  |  |  |  |  |  | 
| 68 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $conditions, $other_options ) = @_; | 
| 69 | 0 |  |  |  |  |  | return $self->post(sprintf("items/%s/services.json", $id), undef, { service => $conditions }, $other_options); | 
| 70 |  |  |  |  |  |  | } | 
| 71 |  |  |  |  |  |  |  | 
| 72 |  |  |  |  |  |  | sub remove_service { | 
| 73 |  |  |  |  |  |  |  | 
| 74 | 0 |  |  | 0 | 1 |  | my ( $self, $id, $service_id, $other_options ) = @_; | 
| 75 | 0 |  |  |  |  |  | return $self->delete(sprintf("items/%s/services/%s.json", $id, $service_id), undef, undef, $other_options); | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  |  | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | 1; | 
| 80 |  |  |  |  |  |  |  | 
| 81 |  |  |  |  |  |  | __END__ |