| File: | blib/lib/OpenSRF/DomainObject/oilsMethod.pm |
| Coverage: | 16.7% |
| line | stmt | bran | cond | sub | pod | time | code |
|---|---|---|---|---|---|---|---|
| 1 | package OpenSRF::DomainObject::oilsMethod; | ||||||
| 2 | |||||||
| 3 | 9 9 9 | 55 38 61 | use OpenSRF::Utils::JSON; | ||||
| 4 | OpenSRF::Utils::JSON->register_class_hint(hint => 'osrfMethod', name => 'OpenSRF::DomainObject::oilsMethod', type => 'hash'); | ||||||
| 5 | |||||||
| 6 | sub toString { | ||||||
| 7 | 0 | 0 | my $self = shift; | ||||
| 8 | 0 | return OpenSRF::Utils::JSON->perl2JSON($self); | |||||
| 9 | } | ||||||
| 10 | |||||||
| 11 | sub new { | ||||||
| 12 | 0 | 0 | my $self = shift; | ||||
| 13 | 0 | my $class = ref($self) || $self; | |||||
| 14 | 0 | my %args = @_; | |||||
| 15 | 0 | return bless \%args => $class; | |||||
| 16 | } | ||||||
| 17 | |||||||
| 18 | |||||||
| 19 - 47 | =head1 NAME OpenSRF::DomainObject::oilsMethod =head1 SYNOPSIS use OpenSRF::DomainObject::oilsMethod; my $method = OpenSRF::DomainObject::oilsMethod->new( method => 'search' ); $method->return_type( 'mods' ); $method->params( 'title:harry potter' ); $client->send( 'REQUEST', $method ); =head1 METHODS =head2 OpenSRF::DomainObject::oilsMethod->method( [$new_method_name] ) =over 4 Sets or gets the method name that will be called on the server. As above, this can be specified as a build attribute as well as added to a prebuilt oilsMethod object. =back =cut | ||||||
| 48 | |||||||
| 49 | sub method { | ||||||
| 50 | 0 | 1 | my $self = shift; | ||||
| 51 | 0 | my $val = shift; | |||||
| 52 | 0 | $self->{method} = $val if (defined $val); | |||||
| 53 | 0 | return $self->{method}; | |||||
| 54 | } | ||||||
| 55 | |||||||
| 56 - 68 | =head2 OpenSRF::DomainObject::oilsMethod->return_type( [$new_return_type] ) =over 4 Sets or gets the return type for this method call. This can also be supplied as a build attribute. This option does not require that the server return the type you request. It is used as a suggestion when more than one return type or format is possible. =back =cut | ||||||
| 69 | |||||||
| 70 | |||||||
| 71 | sub return_type { | ||||||
| 72 | 0 | 1 | my $self = shift; | ||||
| 73 | 0 | my $val = shift; | |||||
| 74 | 0 | $self->{return_type} = $val if (defined $val); | |||||
| 75 | 0 | return $self->{return_type}; | |||||
| 76 | } | ||||||
| 77 | |||||||
| 78 - 87 | =head2 OpenSRF::DomainObject::oilsMethod->params( @new_params ) =over 4 Sets or gets the parameters for this method call. Just pass in either text parameters, or DOM nodes of any type. =back =cut | ||||||
| 88 | |||||||
| 89 | |||||||
| 90 | sub params { | ||||||
| 91 | 0 | 1 | my $self = shift; | ||||
| 92 | 0 | my @args = @_; | |||||
| 93 | 0 | $self->{params} = \@args if (@args); | |||||
| 94 | 0 0 | return @{ $self->{params} }; | |||||
| 95 | } | ||||||
| 96 | |||||||
| 97 | 1; | ||||||