Class: Accuweather::Conditions::Local

Inherits:
Object
  • Object
show all
Defined in:
lib/accuweather/conditions/local.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(city:, state:, latitude:, longitude:, time:, time_zone:, obs_daylight:, current_gmt_offset:, time_zone_abbreviation:) ⇒ Local

Returns a new instance of Local.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/accuweather/conditions/local.rb', line 6

def initialize(city:, state:, latitude:, longitude:, time:, time_zone:, obs_daylight:, current_gmt_offset:, time_zone_abbreviation:)
  @city = city
  @state = state
  @latitude = latitude
  @longitude = longitude
  @time = time
  @time_zone = time_zone
  @obs_daylight = obs_daylight
  @current_gmt_offset = current_gmt_offset
  @time_zone_abbreviation = time_zone_abbreviation
end

Instance Attribute Details

#cityObject (readonly)

Returns the value of attribute city.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def city
  @city
end

#current_gmt_offsetObject (readonly)

Returns the value of attribute current_gmt_offset.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def current_gmt_offset
  @current_gmt_offset
end

#latitudeObject (readonly)

Returns the value of attribute latitude.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def latitude
  @latitude
end

#longitudeObject (readonly)

Returns the value of attribute longitude.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def longitude
  @longitude
end

#obs_daylightObject (readonly)

Returns the value of attribute obs_daylight.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def obs_daylight
  @obs_daylight
end

#stateObject (readonly)

Returns the value of attribute state.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def state
  @state
end

#timeObject (readonly)

Returns the value of attribute time.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def time
  @time
end

#time_zoneObject (readonly)

Returns the value of attribute time_zone.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def time_zone
  @time_zone
end

#time_zone_abbreviationObject (readonly)

Returns the value of attribute time_zone_abbreviation.



4
5
6
# File 'lib/accuweather/conditions/local.rb', line 4

def time_zone_abbreviation
  @time_zone_abbreviation
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/accuweather/conditions/local.rb', line 18

def ==(other)
  city == other.city &&
    state == other.state &&
    latitude == other.latitude &&
    longitude == other.longitude &&
    time == other.time &&
    time_zone == other.time_zone &&
    obs_daylight == other.obs_daylight &&
    current_gmt_offset == other.current_gmt_offset &&
    time_zone_abbreviation == other.time_zone_abbreviation
rescue NoMethodError
  false
end

#to_sObject



32
33
34
# File 'lib/accuweather/conditions/local.rb', line 32

def to_s
  "city: #{city}, state: #{state}, latitude: #{latitude}, longitude: #{longitude}, time: #{time}, time_zone: #{time_zone}, obs_daylight: #{obs_daylight}, current_gmt_offset: #{current_gmt_offset}, time_zone_abbreviation: #{time_zone_abbreviation}"
end