Class: DataDomeLocation

Inherits:
Object
  • Object
show all
Defined in:
lib/model/location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#cityObject (readonly)

Returns the value of attribute city.



2
3
4
# File 'lib/model/location.rb', line 2

def city
  @city
end

#countryObject (readonly)

Returns the value of attribute country.



2
3
4
# File 'lib/model/location.rb', line 2

def country
  @country
end

#country_codeObject (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(options = {})
  {
    countryCode: @country_code,
    country: @country,
    city: @city,
  }.to_json
end

#to_sObject



10
11
12
# File 'lib/model/location.rb', line 10

def to_s
  "DataDomeLocation: countryCode=#{@country_code}, country=#{@country}, city=#{@city}"
end