Class: NoaaNceiWeather::Weather Abstract
- Inherits:
-
Object
- Object
- NoaaNceiWeather::Weather
- Extended by:
- Connection
- Defined in:
- lib/noaa_ncei_weather/weather.rb
Overview
This class is abstract.
Superclass to all of the resource classes used to help filter data queried using Data
Direct Known Subclasses
DataCategory, DataType, Dataset, Location, LocationCategory, Station
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ String
readonly
The descriptive name of the resource.
Attributes included from Connection
Class Method Summary collapse
-
.all ⇒ Array<Weather>
Used to query for all the resources without any filter.
-
.find(endpoint) ⇒ Object
Used to query for a single ID.
-
.first ⇒ Object
Used to retrieve a single record with no specification.
Instance Method Summary collapse
-
#initialize(id, name) ⇒ Weather
constructor
Creates a new Weather object.
Methods included from Connection
parse_params, request, token=, where
Constructor Details
#initialize(id, name) ⇒ Weather
Creates a new Weather object
15 16 17 18 |
# File 'lib/noaa_ncei_weather/weather.rb', line 15 def initialize(id, name) @id = id @name = name end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
12 |
# File 'lib/noaa_ncei_weather/weather.rb', line 12 attr_reader :name, :id |
#name ⇒ String (readonly)
Returns The descriptive name of the resource.
12 13 14 |
# File 'lib/noaa_ncei_weather/weather.rb', line 12 def name @name end |
Class Method Details
.all ⇒ Array<Weather>
Used to query for all the resources without any filter
23 24 25 |
# File 'lib/noaa_ncei_weather/weather.rb', line 23 def self.all self.where end |
.find(endpoint) ⇒ Object
Used to query for a single ID
28 29 30 |
# File 'lib/noaa_ncei_weather/weather.rb', line 28 def self.find(endpoint) self.request(endpoint) end |
.first ⇒ Object
Used to retrieve a single record with no specification
33 34 35 |
# File 'lib/noaa_ncei_weather/weather.rb', line 33 def self.first self.where(limit: 1).first end |