Class: DarkSky::Location::Current

Inherits:
CommonMethods show all
Defined in:
lib/darksky-api/current.rb

Instance Method Summary collapse

Methods inherited from CommonMethods

#apparent_temperature, #clear?, #cloud_cover, #cloudy?, #dew_point, #foggy?, #humidity, #icon, #ozone, #precip_intensity, #precip_intensity_text, #precip_probability, #precip_type, #pressure, #rainy?, #sleet?, #snowy?, #summary, #uv_index, #visibility, #wind_bearing, #wind_bearing_text, #wind_gust, #wind_speed, #windy?

Constructor Details

#initialize(location) ⇒ Current

automatically called by Location

Parameters:

  • location (Location)

    where to get data from

Since:

  • 0.1.0



7
8
9
# File 'lib/darksky-api/current.rb', line 7

def initialize(location)
  @location = location
end

Instance Method Details

#nearest_storm_bearingNumeric

Returns nearest storm bearing at location.

Examples:

location = DarkSky::Location.new [45, -90]
location.current.nearest_storm_bearing #=> nearest storm bearing at location

Returns:

  • (Numeric)

    nearest storm bearing at location

Since:

  • 0.1.0



16
17
18
# File 'lib/darksky-api/current.rb', line 16

def nearest_storm_bearing
  data[:nearestStormBearing]
end

#nearest_storm_bearing_textString

Returns text representation of bearing.

Examples:

location = DarkSky::Location.new [45, -90]
location.current.nearest_storm_bearing_text #=> text representation of bearing (N, NW, etc.)

Returns:

  • (String)

    text representation of bearing

Since:

  • 0.1.0



25
26
27
# File 'lib/darksky-api/current.rb', line 25

def nearest_storm_bearing_text
  _bearing_text(nearest_storm_bearing)
end

#nearest_storm_distanceNumeric

Returns nearest storm distance from location.

Examples:

location = DarkSky::Location.new [45, -90]
location.current.nearest_storm_distance #=> nearest storm distance from location

Returns:

  • (Numeric)

    nearest storm distance from location

Since:

  • 0.1.0



34
35
36
# File 'lib/darksky-api/current.rb', line 34

def nearest_storm_distance
  data[:nearestStormDistance]
end

#temperatureNumeric

Returns current temperature at location.

Examples:

location = DarkSky::Location.new [45, -90]
location.current.temperature #=> temperature at location

Returns:

  • (Numeric)

    current temperature at location

Since:

  • 0.1.0



43
44
45
# File 'lib/darksky-api/current.rb', line 43

def temperature
  data[:temperature]
end