Class: Cinch::Plugins::Weather::Wx

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/cinch/plugins/weather/wx.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(apikey, type = :metric) ⇒ Wx

Returns a new instance of Wx


16
17
18
# File 'lib/cinch/plugins/weather/wx.rb', line 16

def initialize(apikey, type=:metric)
  @type, @apikey = type,apikey
end

Instance Attribute Details

#apikeyObject (readonly)

Returns the value of attribute apikey


14
15
16
# File 'lib/cinch/plugins/weather/wx.rb', line 14

def apikey
  @apikey
end

#typeObject

Returns the value of attribute type


13
14
15
# File 'lib/cinch/plugins/weather/wx.rb', line 13

def type
  @type
end

Instance Method Details

#get(query, *features) ⇒ Object


20
21
22
23
# File 'lib/cinch/plugins/weather/wx.rb', line 20

def get(query, *features)
  features << :conditions if features.empty?
  Hashie::Mash.new(self.class.get("/#{@apikey}/#{features * "/"}/q/#{query}.json"))
end