« blib/lib/WWW/GoDaddy/REST/Shell/DocsCommand.pm
↑ Summary
blib/lib/WWW/GoDaddy/REST/Shell/Util.pm »
| 1 | package WWW::GoDaddy::REST::Schema; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use Moose; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use WWW::GoDaddy::REST::Util qw( abs_url build_complex_query_url ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 4 | extends 'WWW::GoDaddy::REST::Resource'; | |||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | sub resource_field_names { | ||||||||||||||||||||||||||||||||||||||||||
| 9 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resource_field_names: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 0 | my %res_fields = %{ $self->f('resourceFields') }; | |||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | return keys %res_fields; | |||||||||||||||||||||||||||||||||||||||||
| 12 | } | ||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | sub resource_field { | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resource_field: called CC=2 SCAR=7.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 3 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | my $res_fields = $self->f('resourceFields'); | |||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | if ( !exists $res_fields->{$name} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | return undef; | |||||||||||||||||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||||||||||||||||
| 21 | 3 | return $res_fields->{$name}; | |||||||||||||||||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | sub resource_field_type { | ||||||||||||||||||||||||||||||||||||||||||
| 25 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
resource_field_type: called CC=18 SCAR=45.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | 3 | my $name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 27 | 3 | ▶ | my $opts = shift || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | 3 | ▶ | my $type = $self->resource_field($name)->{'type'} || 'string'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->resource_field($name)->{'type'} || 'string'
MC/DC0%0/1
$self->resource_field($name)->{'type'} || 'string'
$self->resource_field($name)->{'type'}
Truth table50%1/2
A
A= $self->resource_field($name)->{'type'}
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 3 | my $want_array = wantarray; | |||||||||||||||||||||||||||||||||||||||||
| 31 | 3 | my $auto_upconvert_reference = $opts->{auto_upconvert_reference}; | |||||||||||||||||||||||||||||||||||||||||
| 32 | 3 | my $qualify_schema_types = $opts->{qualify_schema_types}; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 3 | ▶ | if ( $want_array or $auto_upconvert_reference or $qualify_schema_types ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%2/6
$want_array or $auto_upconvert_reference or $qualify_schema_types
$want_array or $auto_upconvert_reference
MC/DC0%0/3
$want_array or $auto_upconvert_reference or $qualify_schema_types
$want_array
$auto_upconvert_reference
$qualify_schema_types
Truth table25%1/4
A or B or C
A= $want_arrayB= $auto_upconvert_referenceC= $qualify_schema_types
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 3 | my ( $a_type, $b_type ) = split( /[\[\]]/, $type ); | |||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | ▶ | my $compound_type = $b_type ? 1 : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 3 | ▶ | if ($auto_upconvert_reference) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | # some schemas don't properly use the 'reference' type to indicate | ||||||||||||||||||||||||||||||||||||||||||
| 42 | # the complex relationship. Convention seems to favor two sorts | ||||||||||||||||||||||||||||||||||||||||||
| 43 | # of field names that link to complex types: | ||||||||||||||||||||||||||||||||||||||||||
| 44 | # mySchemaId | ||||||||||||||||||||||||||||||||||||||||||
| 45 | # my_schema_id | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | if ( !$compound_type && $name =~ /^(.*)(_id|Id)$/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $compound_type and $name =~ /^(.*)(_id|Id)$/
MC/DC0%0/2
not $compound_type and $name =~ /^(.*)(_id|Id)$/
not $compound_type
$name =~ /^(.*)(_id|Id)$/
Truth table0%0/3
not(A) and B
A= not $compound_typeB= $name =~ /^(.*)(_id|Id)$/
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | my $possible_schema = $self->client->schema($1); | |||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | if ($possible_schema) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | $compound_type = 1; | |||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | $a_type = 'reference'; | |||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | $b_type = $possible_schema->id; | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | } | ||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 3 | ▶ | if ($qualify_schema_types) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | if ($compound_type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | my $possible_schema = $self->client->schema($b_type); | |||||||||||||||||||||||||||||||||||||||||
| 59 | 0 | ▶ | if ($possible_schema) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | $b_type = $possible_schema->link('self'); | |||||||||||||||||||||||||||||||||||||||||
| 61 | } | ||||||||||||||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||||||||||||
| 63 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | my $possible_schema = $self->client->schema($a_type); | |||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | ▶ | if ($possible_schema) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 66 | 0 | $a_type = $possible_schema->link('self'); | |||||||||||||||||||||||||||||||||||||||||
| 67 | } | ||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 3 | ▶ | if ($want_array) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 3 | ▶ | if ($compound_type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 73 | 1 | return ( $a_type, $b_type ); | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 2 | return ( undef, $a_type ); | |||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | if ($compound_type) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | $type = sprintf( '%s[%s]', $a_type, $b_type ); | |||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||
| 83 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $type = $a_type; | |||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | return $type; | |||||||||||||||||||||||||||||||||||||||||
| 89 | } | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | sub query { | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 5 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | 5 | ▶ | if ( !ref( $_[0] ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 2 | return $self->query_by_id(@_); | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 3 | return $self->query_complex(@_); | |||||||||||||||||||||||||||||||||||||||||
| 99 | } | ||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | sub query_complex { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_complex: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | |||||||||||||||||||||||||||||||||||||||||||
| 106 | 3 | my $url = build_complex_query_url( $self->query_url, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||
| 108 | 3 | my $resource = $self->client->http_request_as_resource( 'GET', $url ); | |||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||
| 110 | 3 | ▶ | return wantarray ? $resource->items() : $resource; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | sub query_by_id { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 8 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_by_id: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 8 | my $id = shift; | |||||||||||||||||||||||||||||||||||||||||
| 116 | 8 | ▶ | my $opts = shift || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || {}
MC/DC100%1/1
shift() || {}
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 8 | my $client = $self->client; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 8 | my $url = build_complex_query_url( $self->query_url($id), $opts ); | |||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 8 | return $client->http_request_as_resource( 'GET', $url ); | |||||||||||||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||||||||||||||||
| 124 | sub create { | ||||||||||||||||||||||||||||||||||||||||||
| 125 | 3 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
create: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 126 | |||||||||||||||||||||||||||||||||||||||||||
| 127 | 3 | my $client = $self->client; | |||||||||||||||||||||||||||||||||||||||||
| 128 | 3 | my $url = $self->query_url; | |||||||||||||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||||||||||||
| 130 | 3 | return $client->http_request_as_resource( 'POST', $url, @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||
| 133 | sub is_queryable { | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_queryable: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | ▶ | if ( $self->id eq 'schema' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | 0 | ▶ | if ( $self->link('collection') ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 139 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | sub query_url { | ||||||||||||||||||||||||||||||||||||||||||
| 144 | 15 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_url: called CC=4 SCAR=14.2
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | 15 | my ($id) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 15 | ▶ | my $base_url = $self->id eq 'schema' ? $self->link('schemas') : $self->link('collection'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 15 | ▶ | if ( !defined $base_url ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | die( "Unable to build a query url: schema '" . $self->id . "' has no 'collection' link" ); | |||||||||||||||||||||||||||||||||||||||||
| 150 | } | ||||||||||||||||||||||||||||||||||||||||||
| 151 | 15 | ▶ | if ( defined $id ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 152 | 9 | return abs_url( $base_url, $id ); | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | 6 | return $base_url; | |||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 4 | our %REGISTRY; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | sub registry_add { | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 80 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registry_add: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 80 | my %schemas = @_; | |||||||||||||||||||||||||||||||||||||||||
| 162 | 80 | ▶ | while ( my ( $key, $object ) = each(%schemas) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 80 | $REGISTRY{$key} = $object; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | sub registry_lookup { | ||||||||||||||||||||||||||||||||||||||||||
| 168 | 30 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registry_lookup: called CC=7 SCAR=19.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | 30 | my @possibles = @_; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 30 | foreach my $find (@possibles) { | |||||||||||||||||||||||||||||||||||||||||
| 171 | 30 | ▶ | next unless defined $find; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 26 | ▶ | if ( exists $REGISTRY{$find} and defined $REGISTRY{$find} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $WWW::GoDaddy::REST::Schema::REGISTRY{$find} and defined $WWW::GoDaddy::REST::Schema::REGISTRY{$find}
MC/DC50%1/2
exists $WWW::GoDaddy::REST::Schema::REGISTRY{$find} and defined $WWW::GoDaddy::REST::Schema::REGISTRY{$find}
exists $WWW::GoDaddy::REST::Schema::REGISTRY{$find}
defined $WWW::GoDaddy::REST::Schema::REGISTRY{$find}
Truth table66%2/3
A and B
A= exists $WWW::GoDaddy::REST::Schema::REGISTRY{$find}B= defined $WWW::GoDaddy::REST::Schema::REGISTRY{$find}
| |||||||||||||||||||||||||||||||||||||||||||
| 173 | 25 | return $REGISTRY{$find}; | |||||||||||||||||||||||||||||||||||||||||
| 174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 1 | ▶ | while ( my ( $key, $schema ) = each %REGISTRY ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 20 | ▶ | if ( lc($find) eq lc($key) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | return $schema; | |||||||||||||||||||||||||||||||||||||||||
| 178 | } | ||||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | } | ||||||||||||||||||||||||||||||||||||||||||
| 181 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | sub registry_list { | ||||||||||||||||||||||||||||||||||||||||||
| 186 | 4 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
registry_list: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 4 | my %seen; | |||||||||||||||||||||||||||||||||||||||||
| 188 | 4 | return grep { not $seen{ $_->id }++ } values %REGISTRY; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 4 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||||||||||||||||
| 193 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | WWW::GoDaddy::REST::Schema - schema specific resource class | ||||||||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||||||||
| 197 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | $schema = $client->schema('the_name'); | ||||||||||||||||||||||||||||||||||||||||||
| 200 | $scehama = $resource->schema(); | ||||||||||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||||||||
| 202 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 203 | |||||||||||||||||||||||||||||||||||||||||||
| 204 | This is used to represent a 'schema' which is a very common resource in the | ||||||||||||||||||||||||||||||||||||||||||
| 205 | Go Daddy(r) API specification. | ||||||||||||||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||||||||||||
| 207 | It is a sub class of L<WWW::GoDaddy::REST::Resource>. | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | =head1 METHODS | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | =over 4 | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | =item query | ||||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | This is a helper method that, based on the parameters | ||||||||||||||||||||||||||||||||||||||||||
| 216 | will choose to call C<query_by_id> or C<query_complex>. | ||||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | You probably should not be calling this directly. | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | See the C<query> method on L<WWW::GoDaddy::REST|WWW::GoDaddy::REST>. | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | Example: | ||||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | $schema->query('1234'); # query_by_id('1234') | ||||||||||||||||||||||||||||||||||||||||||
| 225 | $schema->query('1234', { opt => '1' } ); # query_by_id('1234', { opt => '1' } ) | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | =item query_by_id | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | Returns a L<Resource|WWW::GoDaddy::REST::Resource> given | ||||||||||||||||||||||||||||||||||||||||||
| 230 | an C<id> parameter and an optional hash reference with additional key value pairs. | ||||||||||||||||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||||||||||||||||
| 232 | You probably should not be calling this directly. | ||||||||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||||||||
| 234 | See the C<query> method on the L<client instance|WWW::GoDaddy::REST>. | ||||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | Example: | ||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | $resource = $schema->query_by_id('1234'); | ||||||||||||||||||||||||||||||||||||||||||
| 239 | $resource = $schema->query_by_id('1234', { opt => '1' } ); | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | =item query_complex | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | Search against the collection defined by this resource. | ||||||||||||||||||||||||||||||||||||||||||
| 244 | |||||||||||||||||||||||||||||||||||||||||||
| 245 | Returns a L<Collection|WWW::GoDaddy::REST::Collection> given a hash ref with | ||||||||||||||||||||||||||||||||||||||||||
| 246 | key value pairs. | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | Example: | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | $resource = $schema->query_complex( { opt => '1' } ); | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | =head1 AUTHOR | ||||||||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||||||||
| 256 | David Bartle, C<< <davidb@mediatemple.net> >> | ||||||||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||||||||
| 258 | =head1 COPYRIGHT & LICENSE | ||||||||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||||||||
| 260 | Copyright (c) 2014 Go Daddy Operating Company, LLC | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | Permission is hereby granted, free of charge, to any person obtaining a | ||||||||||||||||||||||||||||||||||||||||||
| 263 | copy of this software and associated documentation files (the "Software"), | ||||||||||||||||||||||||||||||||||||||||||
| 264 | to deal in the Software without restriction, including without limitation | ||||||||||||||||||||||||||||||||||||||||||
| 265 | the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||||||||||||||||||||||||||||||||||||||||||
| 266 | and/or sell copies of the Software, and to permit persons to whom the | ||||||||||||||||||||||||||||||||||||||||||
| 267 | Software is furnished to do so, subject to the following conditions: | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | The above copyright notice and this permission notice shall be included in | ||||||||||||||||||||||||||||||||||||||||||
| 270 | all copies or substantial portions of the Software. | ||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||||||||||||||||||||||||||||||||||||||||
| 273 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||||||||||||||||||||||||||||||||||||||||
| 274 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL | ||||||||||||||||||||||||||||||||||||||||||
| 275 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||||||||||||||||||||||||||||||||||||||||
| 276 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||||||||||||||||||||||||||||||||||||||||||
| 277 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||||||||||||||||||||||||||||||||||||||||||
| 278 | DEALINGS IN THE SOFTWARE. | ||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | =cut | ||||||||||||||||||||||||||||||||||||||||||