Class: Weather::Location

Inherits:
Object
  • Object
show all
Defined in:
lib/weather-api/location.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(payload) ⇒ Location

Returns a new instance of Location.



12
13
14
15
16
# File 'lib/weather-api/location.rb', line 12

def initialize(payload)
  @city = payload[:city].strip
  @country = payload[:country].strip
  @region = payload[:region].strip
end

Instance Attribute Details

#cityObject (readonly)

the name of the city



4
5
6
# File 'lib/weather-api/location.rb', line 4

def city
  @city
end

#countryObject (readonly)

the name of the country



7
8
9
# File 'lib/weather-api/location.rb', line 7

def country
  @country
end

#regionObject (readonly)

name of the region, such as a state or province



10
11
12
# File 'lib/weather-api/location.rb', line 10

def region
  @region
end