Class: DataDomeLocation
- Inherits:
-
Object
- Object
- DataDomeLocation
- Defined in:
- lib/model/location.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#country ⇒ Object
readonly
Returns the value of attribute country.
-
#country_code ⇒ Object
readonly
Returns the value of attribute country_code.
Instance Method Summary collapse
-
#initialize(location: nil) ⇒ DataDomeLocation
constructor
A new instance of DataDomeLocation.
- #to_json(options = {}) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(location: nil) ⇒ DataDomeLocation
Returns a new instance of DataDomeLocation.
4 5 6 7 8 |
# File 'lib/model/location.rb', line 4 def initialize(location: nil) @country_code = location&.fetch("countryCode", nil) @country = location&.fetch("country", nil) @city = location&.fetch("city", nil) end |
Instance Attribute Details
#city ⇒ Object (readonly)
Returns the value of attribute city.
2 3 4 |
# File 'lib/model/location.rb', line 2 def city @city end |
#country ⇒ Object (readonly)
Returns the value of attribute country.
2 3 4 |
# File 'lib/model/location.rb', line 2 def country @country end |
#country_code ⇒ Object (readonly)
Returns the value of attribute country_code.
2 3 4 |
# File 'lib/model/location.rb', line 2 def country_code @country_code end |
Instance Method Details
#to_json(options = {}) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/model/location.rb', line 14 def to_json( = {}) { countryCode: @country_code, country: @country, city: @city, }.to_json end |
#to_s ⇒ Object
10 11 12 |
# File 'lib/model/location.rb', line 10 def to_s "DataDomeLocation: countryCode=#{@country_code}, country=#{@country}, city=#{@city}" end |