class MyWeatherFeed

Public Class Methods

new(location: nil, api_key: nil, sps_host: 'sps', \ sps_port: 59000, feed_url: '') click to toggle source
# File lib/myweatherfeed.rb, line 12
def initialize(location: nil, api_key: nil, sps_host: 'sps', \
               sps_port: 59000, feed_url: '')

  @w = MyWeatherForecast.new location, api_key: api_key
          
  @sps = SPSPub.new(address: sps_host, port: sps_port)
          
  @title = 'My weather feed for ' + \
                      (location.is_a?(Array) ? location.join(', ') :location)
  @description = 'Weather data fetched from forecast.io'    
          
  
end

Public Instance Methods

initialize_feed() click to toggle source
# File lib/myweatherfeed.rb, line 26
def initialize_feed()
      
  @sps.notice 'notice/weather/title: ' + @title
  sleep 0.3
  @sps.notice 'notice/weather/profile: ' + @description    
  
end
update() click to toggle source
# File lib/myweatherfeed.rb, line 34
def update()
  @sps.notice 'notice/weather: ' + @w.now.to_s
end