Class: SpreeCmCommissioner::Integrations::BookMeBusV1::Resources::Branch
- Inherits:
-
Base
- Object
- Base
- SpreeCmCommissioner::Integrations::BookMeBusV1::Resources::Branch
- Defined in:
- app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#code ⇒ Object
Returns the value of attribute code.
-
#description ⇒ Object
Returns the value of attribute description.
-
#id ⇒ Object
Returns the value of attribute id.
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#location ⇒ Object
Returns the value of attribute location.
-
#location_id ⇒ Object
Returns the value of attribute location_id.
-
#lon ⇒ Object
Returns the value of attribute lon.
-
#name ⇒ Object
Returns the value of attribute name.
-
#operator_branch_id ⇒ Object
Returns the value of attribute operator_branch_id.
-
#operator_id ⇒ Object
Returns the value of attribute operator_id.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#place_type ⇒ Object
Returns the value of attribute place_type.
-
#shared ⇒ Object
Returns the value of attribute shared.
-
#timezone ⇒ Object
Returns the value of attribute timezone.
-
#type ⇒ Object
Returns the value of attribute type.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Branch
constructor
A new instance of Branch.
- #latitude ⇒ Object
- #location_name ⇒ Object
- #longitude ⇒ Object
- #to_h ⇒ Object
- #vendor_place_type ⇒ Object
Methods inherited from Base
from_json_api, from_json_api_item, from_json_api_single
Constructor Details
#initialize(attributes = {}) ⇒ Branch
Returns a new instance of Branch.
21 22 23 24 25 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 21 def initialize(attributes = {}) super(attributes) @location = Location.new(attributes['location']) if attributes['location'].is_a?(Hash) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def address @address end |
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def code @code end |
#description ⇒ Object
Returns the value of attribute description.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def description @description end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def id @id end |
#lat ⇒ Object
Returns the value of attribute lat.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def lat @lat end |
#location ⇒ Object
Returns the value of attribute location.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def location @location end |
#location_id ⇒ Object
Returns the value of attribute location_id.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def location_id @location_id end |
#lon ⇒ Object
Returns the value of attribute lon.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def lon @lon end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def name @name end |
#operator_branch_id ⇒ Object
Returns the value of attribute operator_branch_id.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def operator_branch_id @operator_branch_id end |
#operator_id ⇒ Object
Returns the value of attribute operator_id.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def operator_id @operator_id end |
#phone ⇒ Object
Returns the value of attribute phone.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def phone @phone end |
#place_type ⇒ Object
Returns the value of attribute place_type.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def place_type @place_type end |
#shared ⇒ Object
Returns the value of attribute shared.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def shared @shared end |
#timezone ⇒ Object
Returns the value of attribute timezone.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def timezone @timezone end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def type @type end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 3 def url @url end |
Instance Method Details
#latitude ⇒ Object
27 28 29 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 27 def latitude lat.to_f end |
#location_name ⇒ Object
35 36 37 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 35 def location_name location&.name end |
#longitude ⇒ Object
31 32 33 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 31 def longitude lon.to_f end |
#to_h ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 43 def to_h { id: id, type: type, code: code, name: name, lat: lat, lon: lon, description: description, timezone: timezone, url: url, place_type: place_type, shared: shared, operator_id: operator_id, operator_branch_id: operator_branch_id, location_id: location_id, address: address, phone: phone, location: location&.to_h }.compact end |
#vendor_place_type ⇒ Object
39 40 41 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/branch.rb', line 39 def vendor_place_type :branch end |