Class: Sem4r::AdGroupAd
- Defined in:
- lib/sem4r/ad_group_ad/ad_group_ad.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#ad_group ⇒ Object
readonly
Returns the value of attribute ad_group.
-
#type ⇒ Object
Returns the value of attribute type.
Attributes inherited from Base
#adwords, #credentials, #service
Class Method Summary collapse
Instance Method Summary collapse
-
#id ⇒ Object
try to save when accessing id.
-
#initialize(ad_group, &block) ⇒ AdGroupAd
constructor
A new instance of AdGroupAd.
- #saved? ⇒ Boolean
Methods inherited from Base
Methods included from Sem4rSoap::SoapAttributes
#_from_element, #_to_s, #_to_xml, included
Constructor Details
#initialize(ad_group, &block) ⇒ AdGroupAd
Returns a new instance of AdGroupAd.
70 71 72 73 74 75 76 |
# File 'lib/sem4r/ad_group_ad/ad_group_ad.rb', line 70 def initialize(ad_group, &block) super( ad_group.adwords, ad_group.credentials ) @ad_group = ad_group if block_given? block.arity < 1 ? instance_eval(&block) : block.call(self) end end |
Instance Attribute Details
#ad_group ⇒ Object (readonly)
Returns the value of attribute ad_group.
62 63 64 |
# File 'lib/sem4r/ad_group_ad/ad_group_ad.rb', line 62 def ad_group @ad_group end |
#type ⇒ Object
Returns the value of attribute type.
63 64 65 |
# File 'lib/sem4r/ad_group_ad/ad_group_ad.rb', line 63 def type @type end |
Class Method Details
.from_element(ad_group, el) ⇒ Object
88 89 90 91 92 93 94 95 96 |
# File 'lib/sem4r/ad_group_ad/ad_group_ad.rb', line 88 def self.from_element( ad_group, el ) xml_type = el.at_xpath("Ad.Type").text.strip case xml_type when TextAd AdGroupTextAd.from_element(ad_group, el) when MobileAd AdGroupMobileAd.from_element(ad_group, el) end end |
Instance Method Details
#id ⇒ Object
try to save when accessing id
83 84 85 86 |
# File 'lib/sem4r/ad_group_ad/ad_group_ad.rb', line 83 def id save unless @id @id end |
#saved? ⇒ Boolean
78 79 80 |
# File 'lib/sem4r/ad_group_ad/ad_group_ad.rb', line 78 def saved? !@id.nil? end |