Class: SpreeCmCommissioner::Integrations::VireakBuntham::Resources::Location
- Inherits:
-
Base
- Object
- Base
- SpreeCmCommissioner::Integrations::VireakBuntham::Resources::Location
- Defined in:
- app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb
Overview
Wraps a VET location returned by POST /destination/from.
Example payload:
{
"id": "ce982b94fbb21ff7cd3825691ba56ba2",
"name": "Phnom Penh (Japan Hospital Branch)",
"address": "#29 St. 47, Songkat Sras Jork, Khan Donpenh",
"lat": "11.580118",
"long": "104.9201612"
}
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#long ⇒ Object
Returns the value of attribute long.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #display_name ⇒ Object
-
#initialize(data) ⇒ Location
constructor
rubocop:disable Lint/MissingSuper.
- #to_h ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(data) ⇒ Location
rubocop:disable Lint/MissingSuper
15 16 17 18 19 20 21 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb', line 15 def initialize(data) # rubocop:disable Lint/MissingSuper @id = data['id'] @name = data['name'] @address = data['address'] @lat = data['lat'] @long = data['long'] end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
13 14 15 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb', line 13 def address @address end |
#id ⇒ Object
Returns the value of attribute id.
13 14 15 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb', line 13 def id @id end |
#lat ⇒ Object
Returns the value of attribute lat.
13 14 15 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb', line 13 def lat @lat end |
#long ⇒ Object
Returns the value of attribute long.
13 14 15 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb', line 13 def long @long end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb', line 13 def name @name end |
Instance Method Details
#display_name ⇒ Object
23 24 25 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb', line 23 def display_name [name, address].compact_blank.join(' - ') end |
#to_h ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/services/spree_cm_commissioner/integrations/vireak_buntham/resources/location.rb', line 27 def to_h { id: id, name: name, address: address, lat: lat, long: long } end |