Class: Sem4r::Criterion
- Defined in:
- lib/sem4r/ad_group_criterion/criterion.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
-
#ad_param(index = nil, text = nil, &block) ⇒ Object
ad params management.
- #id ⇒ Object
-
#initialize(ad_group) ⇒ Criterion
constructor
A new instance of Criterion.
- #saved? ⇒ Boolean
Methods inherited from Base
Methods included from Sem4rSoap::SoapAttributes
#_from_element, #_to_s, #_to_xml, included
Constructor Details
#initialize(ad_group) ⇒ Criterion
Returns a new instance of Criterion.
35 36 37 38 |
# File 'lib/sem4r/ad_group_criterion/criterion.rb', line 35 def initialize( ad_group ) super( ad_group.adwords, ad_group.credentials ) @ad_group = ad_group end |
Instance Attribute Details
#ad_group ⇒ Object (readonly)
Returns the value of attribute ad_group.
32 33 34 |
# File 'lib/sem4r/ad_group_criterion/criterion.rb', line 32 def ad_group @ad_group end |
#type ⇒ Object
Returns the value of attribute type.
33 34 35 |
# File 'lib/sem4r/ad_group_criterion/criterion.rb', line 33 def type @type end |
Class Method Details
.from_element(ad_group, el) ⇒ Object
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/sem4r/ad_group_criterion/criterion.rb', line 48 def self.from_element( ad_group, el ) xml_type = el.at_xpath("Criterion.Type").text.strip # klass = Module::const_get(type) # klass.from_element(ad_group, el) case xml_type when Keyword CriterionKeyword.from_element(ad_group, el) when Placement CriterionPlacement.from_element(ad_group, el) end end |
Instance Method Details
#ad_param(index = nil, text = nil, &block) ⇒ Object
ad params management
63 64 65 |
# File 'lib/sem4r/ad_group_criterion/criterion.rb', line 63 def ad_param(index = nil, text = nil, &block) ad_group.ad_param(self, index, text, &block) end |
#id ⇒ Object
44 45 46 |
# File 'lib/sem4r/ad_group_criterion/criterion.rb', line 44 def id @id end |
#saved? ⇒ Boolean
40 41 42 |
# File 'lib/sem4r/ad_group_criterion/criterion.rb', line 40 def saved? !@id.nil? end |