class Wunderground::Location

Attributes

airport[RW]
autoip[RW]
city[RW]
country[RW]
lat[RW]
long[RW]
pws[RW]
state[RW]
zip[RW]

Public Class Methods

new(options = {}) click to toggle source
# File lib/wunderground/location.rb, line 5
def initialize(options = {})
  raise ArgumentError, "No Location Options Provided" if options.empty?
  options.each do |key, value|
    instance_variable_set("@#{key}".to_sym, value)
  end
end

Public Instance Methods

location() click to toggle source
# File lib/wunderground/location.rb, line 12
def location
  if zip
    zip
  elsif state && city
    "#{state}/#{city.gsub(' ', '_')}"
  elsif country && city
    "#{country.gsub(' ', '_')}/#{city.gsub(' ', '_')}"
  elsif airport
    airport
  elsif lat && long
    "#{lat},#{long}"
  elsif pws
    "pws:#{pws}"
  elsif autoip
    "autoip"
  else
    raise ArgumentError, "Invalid Location Options"
  end
end