mirror of
https://github.com/Fishwaldo/huginn.git
synced 2025-03-15 19:31:26 +00:00
WeatherAgent should take the Wunderground API key as an option.
This commit is contained in:
parent
d15bb7ccee
commit
33cd371bfc
1 changed files with 8 additions and 3 deletions
|
@ -44,15 +44,20 @@ module Agents
|
|||
end
|
||||
|
||||
def wunderground
|
||||
Wunderground.new("your-api-key")
|
||||
Wunderground.new(options[:api_key])
|
||||
end
|
||||
|
||||
def default_options
|
||||
{ :zipcode => "94103" }
|
||||
{
|
||||
:api_key => "",
|
||||
:zipcode => "94103"
|
||||
}
|
||||
|
||||
end
|
||||
|
||||
def validate_options
|
||||
errors.add(:base, "zipcode is required") unless options[:zipcode].present?
|
||||
errors.add(:base, "api_key is required") unless options[:api_key].present?
|
||||
end
|
||||
|
||||
def check
|
||||
|
@ -67,4 +72,4 @@ module Agents
|
|||
Time.zone.at(day["date"]["epoch"].to_i).to_date == Time.zone.now.tomorrow.to_date
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue