Class: SpreeCmCommissioner::IntercityTaxi::MapPlace
- Inherits:
-
Object
- Object
- SpreeCmCommissioner::IntercityTaxi::MapPlace
- Defined in:
- lib/spree_cm_commissioner/intercity_taxi/map_place.rb
Instance Attribute Summary collapse
-
#lat ⇒ Object
Returns the value of attribute lat.
-
#lng ⇒ Object
Returns the value of attribute lng.
-
#oob_confirmed ⇒ Object
Returns the value of attribute oob_confirmed.
-
#place_name ⇒ Object
Returns the value of attribute place_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ MapPlace
constructor
A new instance of MapPlace.
- #to_h ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ MapPlace
Returns a new instance of MapPlace.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/spree_cm_commissioner/intercity_taxi/map_place.rb', line 6 def initialize( = {}) = .stringify_keys if .is_a?(Hash) @place_name = ['place_name'] @lat = ['lat']&.to_f @lng = ['lng']&.to_f # Normalize truthy/falsey values ("true", "1", 1, etc.) to a real boolean. @oob_confirmed = ActiveModel::Type::Boolean.new.cast(['oob_confirmed']) end |
Instance Attribute Details
#lat ⇒ Object
Returns the value of attribute lat.
4 5 6 |
# File 'lib/spree_cm_commissioner/intercity_taxi/map_place.rb', line 4 def lat @lat end |
#lng ⇒ Object
Returns the value of attribute lng.
4 5 6 |
# File 'lib/spree_cm_commissioner/intercity_taxi/map_place.rb', line 4 def lng @lng end |
#oob_confirmed ⇒ Object
Returns the value of attribute oob_confirmed.
4 5 6 |
# File 'lib/spree_cm_commissioner/intercity_taxi/map_place.rb', line 4 def oob_confirmed @oob_confirmed end |
#place_name ⇒ Object
Returns the value of attribute place_name.
4 5 6 |
# File 'lib/spree_cm_commissioner/intercity_taxi/map_place.rb', line 4 def place_name @place_name end |
Class Method Details
.from_hash(hash) ⇒ Object
17 18 19 |
# File 'lib/spree_cm_commissioner/intercity_taxi/map_place.rb', line 17 def self.from_hash(hash) new(hash || {}) end |
Instance Method Details
#to_h ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/spree_cm_commissioner/intercity_taxi/map_place.rb', line 21 def to_h { 'place_name' => @place_name, 'lat' => @lat, 'lng' => @lng, 'oob_confirmed' => @oob_confirmed }.compact end |