File Coverage

blib/lib/Yahoo/Marketing/ComplexType.pm
Criterion Covered Total %
statement 16 18 88.8
branch n/a
condition n/a
subroutine 6 6 100.0
pod n/a
total 22 24 91.6


line stmt bran cond sub pod time code
1             package Yahoo::Marketing::ComplexType;
2             # Copyright (c) 2009 Yahoo! Inc. All rights reserved.
3             # The copyrights to the contents of this file are licensed under the Perl Artistic License (ver. 15 Aug 1997)
4              
5 165     165   1041 use strict; use warnings;
  165     165   366  
  165         5023  
  165         879  
  165         354  
  165         5011  
6              
7 165     165   824 use base qw/ Yahoo::Marketing::DateTimeAccessor Yahoo::Marketing /;
  165         314  
  165         96069  
8              
9 165     165   1022 use Carp;
  165         2889  
  165         10090  
10 165     165   2137 use Scalar::Util qw/ blessed /;
  165         364  
  165         8891  
11 165     165   137225 use SOAP::Lite;
  0            
  0            
12              
13              
14             =head1 NAME
15              
16             Yahoo::Marketing::ComplexType - a base class for complex types.
17              
18             =cut
19              
20             =head1 SYNOPSIS
21              
22             See L for documentation of the various data objects.
23              
24             This module is not intended to be used directly. Documentation for each of the complex types is in the appropriate module.
25              
26             See perldoc Yahoo::Marketing::Account
27             ...::Ad
28             ...::AdEditorialReasons
29             ...::AdGroup
30             ...::AdGroupOptimizationGuidelines
31             ...::Address
32             ...::AmbiguousGeoMatch
33             ...::ApiFault
34             ...::Authorization
35             ...::BasicReportRequest
36             ...::BidInformation
37             ...::BucketType
38             ...::Campaign
39             ...::CampaignOptimizationGuidelines
40             ...::Capability
41             ...::ComplexType
42             ...::CreditCardInfo
43             ...::ErrorType
44             ...::ExcludedWord
45             ...::FileOutputFormat
46             ...::ForecastKeyword
47             ...::ForecastKeywordResponse
48             ...::ForecastRequestData
49             ...::ForecastResponse
50             ...::ForecastResponseData
51             ...::Keyword
52             ...::KeywordOptimizationGuidelines
53             ...::KeywordRejectionReasons
54             ...::MasterAccount
55             ...::PageRelatedKeywordRequestType
56             ...::PendingAd
57             ...::PendingKeyword
58             ...::RangeDefinitionRequestType
59             ...::RangeDefinitionResponseType
60             ...::RangeDefinitionType
61             ...::RangeValueType
62             ...::RelatedKeywordRequestType
63             ...::RelatedKeywordResponseType
64             ...::RelatedKeywordType
65             ...::ReportInfo
66             ...::ResponseStatusType
67             ...::Role
68             ...::Serializer
69             ...::SetGeographicLocationResponse
70             ...::Term
71             ...::User
72             ...::UserAuthorization
73              
74             =head2 user_setable_attributes
75              
76             Returns the name of all attributes that are not read-only in EWS
77              
78             =head2 read_only_attributes
79              
80             Returns the name of all attributes that are read-only in EWS
81              
82              
83              
84             =cut
85              
86              
87             sub _type {
88             my $self = shift;
89              
90             return (split /::/, ref $self)[-1] ;
91             }
92              
93              
94             sub _new_from_hash {
95             my ( $self, $hash ) = @_;
96              
97             $self = $self->new unless blessed( $self ); # allow this to be called w/o new() first
98              
99             my $obj_type = ref $self;
100              
101             my $new_obj = $obj_type->new;
102              
103             foreach my $key ( keys %$hash ){
104             $new_obj->$key( $hash->{ $key } );
105             }
106             return $new_obj;
107             }
108              
109             sub user_setable_attributes {
110             return shift->_user_setable_attributes;
111             }
112              
113             sub read_only_attributes {
114             return shift->_read_only_attributes;
115             }
116              
117             sub _user_setable_attributes {
118             confess "Must implement _user_setable_attributes in child class!\n";
119             }
120              
121             sub _read_only_attributes {
122             confess "Must implement _read_only_attributes in child class!\n";
123             }
124              
125              
126             1;