class FindFrostDates::FrostDates

Attributes

endpoint_url[R]
season[W]
station_id[W]

Public Class Methods

new(args) click to toggle source

this object gets initialized with a station id found in stations.rb and a season. 1 for spring, 2 for fall.

# File lib/farmsense_wrapper/frost_dates.rb, line 10
def initialize(args)
  @station_id = args[:station_id]
  @season = args[:season]
  @endpoint_url = "http://farmsense-prod.apigee.net/v1/frostdates/probabilities/?station=#{@station_id}&season=#{@season}"
end

Public Instance Methods

display() click to toggle source
# File lib/farmsense_wrapper/frost_dates.rb, line 16
def display
  get
  @parsed_response
end
get() click to toggle source
# File lib/farmsense_wrapper/frost_dates.rb, line 21
def get
  raw = HTTParty.get(endpoint_url)
  @parsed_response = parse(raw)
end
parse(data) click to toggle source
# File lib/farmsense_wrapper/frost_dates.rb, line 26
def parse(data)
  JSON.parse(data)
end