Class: SpreeCmCommissioner::Integrations::BookMeBusV1::Resources::Location
- Inherits:
-
Base
- Object
- Base
- SpreeCmCommissioner::Integrations::BookMeBusV1::Resources::Location
- Defined in:
- app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb
Instance Attribute Summary collapse
-
#abbreviation ⇒ Object
Returns the value of attribute abbreviation.
-
#city_tel_code ⇒ Object
Returns the value of attribute city_tel_code.
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#country_name ⇒ Object
Returns the value of attribute country_name.
-
#hits_destination ⇒ Object
Returns the value of attribute hits_destination.
-
#hits_origin ⇒ Object
Returns the value of attribute hits_origin.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#name_khmer ⇒ Object
Returns the value of attribute name_khmer.
-
#name_lower ⇒ Object
Returns the value of attribute name_lower.
-
#photo ⇒ Object
Returns the value of attribute photo.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #display_name ⇒ Object
-
#initialize(attributes = {}) ⇒ Location
constructor
A new instance of Location.
- #photo_standard ⇒ Object
- #photo_thumb ⇒ Object
- #to_h ⇒ Object
Methods inherited from Base
from_json_api, from_json_api_item, from_json_api_single
Constructor Details
#initialize(attributes = {}) ⇒ Location
Returns a new instance of Location.
17 18 19 20 21 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 17 def initialize(attributes = {}) super(attributes) @photo = attributes['photo'] if attributes['photo'].is_a?(Hash) end |
Instance Attribute Details
#abbreviation ⇒ Object
Returns the value of attribute abbreviation.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def abbreviation @abbreviation end |
#city_tel_code ⇒ Object
Returns the value of attribute city_tel_code.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def city_tel_code @city_tel_code end |
#country_code ⇒ Object
Returns the value of attribute country_code.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def country_code @country_code end |
#country_name ⇒ Object
Returns the value of attribute country_name.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def country_name @country_name end |
#hits_destination ⇒ Object
Returns the value of attribute hits_destination.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def hits_destination @hits_destination end |
#hits_origin ⇒ Object
Returns the value of attribute hits_origin.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def hits_origin @hits_origin end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def name @name end |
#name_khmer ⇒ Object
Returns the value of attribute name_khmer.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def name_khmer @name_khmer end |
#name_lower ⇒ Object
Returns the value of attribute name_lower.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def name_lower @name_lower end |
#photo ⇒ Object
Returns the value of attribute photo.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def photo @photo end |
#slug ⇒ Object
Returns the value of attribute slug.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def slug @slug end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 3 def type @type end |
Instance Method Details
#display_name ⇒ Object
31 32 33 34 35 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 31 def display_name return name if name_khmer.blank? "#{name} (#{name_khmer})" end |
#photo_standard ⇒ Object
27 28 29 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 27 def photo_standard @photo&.dig('standard') end |
#photo_thumb ⇒ Object
23 24 25 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 23 def photo_thumb @photo&.dig('thumb') end |
#to_h ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/location.rb', line 37 def to_h { id: id, type: type, name: name, name_lower: name_lower, abbreviation: abbreviation, city_tel_code: city_tel_code, photo: photo, name_khmer: name_khmer, country_code: country_code, country_name: country_name, hits_origin: hits_origin, hits_destination: hits_destination, slug: slug }.compact end |