Class: AdWords::Location
- Inherits:
-
Struct
- Object
- Struct
- AdWords::Location
- Defined in:
- lib/adwords_location/location.rb
Constant Summary collapse
- POSTAL_CODE =
'Postal Code'- US =
'US'
Instance Attribute Summary collapse
-
#canonical_name ⇒ Object
Returns the value of attribute canonical_name.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#criteria_id ⇒ Object
Returns the value of attribute criteria_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#parent_id ⇒ Object
Returns the value of attribute parent_id.
-
#status ⇒ Object
Returns the value of attribute status.
-
#target_type ⇒ Object
Returns the value of attribute target_type.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#canonical_name ⇒ Object
Returns the value of attribute canonical_name
6 7 8 |
# File 'lib/adwords_location/location.rb', line 6 def canonical_name @canonical_name end |
#country_code ⇒ Object
Returns the value of attribute country_code
6 7 8 |
# File 'lib/adwords_location/location.rb', line 6 def country_code @country_code end |
#criteria_id ⇒ Object
Returns the value of attribute criteria_id
6 7 8 |
# File 'lib/adwords_location/location.rb', line 6 def criteria_id @criteria_id end |
#name ⇒ Object
Returns the value of attribute name
6 7 8 |
# File 'lib/adwords_location/location.rb', line 6 def name @name end |
#parent_id ⇒ Object
Returns the value of attribute parent_id
6 7 8 |
# File 'lib/adwords_location/location.rb', line 6 def parent_id @parent_id end |
#status ⇒ Object
Returns the value of attribute status
6 7 8 |
# File 'lib/adwords_location/location.rb', line 6 def status @status end |
#target_type ⇒ Object
Returns the value of attribute target_type
6 7 8 |
# File 'lib/adwords_location/location.rb', line 6 def target_type @target_type end |
Class Method Details
.all ⇒ Object
24 25 26 27 28 |
# File 'lib/adwords_location/location.rb', line 24 def self.all data.drop(1).map do |row| AdWords::Location.new(row[0].to_i, row[1], row[2], row[3].to_i, row[4], row[5], row[6]) end end |
Instance Method Details
#description ⇒ Object
11 12 13 |
# File 'lib/adwords_location/location.rb', line 11 def description "#{canonical_name} (#{target_type})" end |
#postal_code ⇒ Object
15 16 17 18 |
# File 'lib/adwords_location/location.rb', line 15 def postal_code raise "Call postal_code the the record targeting type is: #{target_type}" unless target_type == POSTAL_CODE name.rjust(5,'0') end |
#us_postal_code? ⇒ Boolean
20 21 22 |
# File 'lib/adwords_location/location.rb', line 20 def us_postal_code? target_type == POSTAL_CODE and country_code == US end |