Class: OpenWeather::Client

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/open_weather/client.rb

Instance Method Summary collapse

Instance Method Details

#build_query(args, use_id = true) ⇒ Object



27
28
29
# File 'lib/open_weather/client.rb', line 27

def build_query(args, use_id=true)
  QueryBuilder.new(args, use_id).build
end

#daily_forecast(*args) ⇒ Object



15
16
17
# File 'lib/open_weather/client.rb', line 15

def daily_forecast(*args)
  get '/forecast/daily', build_query(args)
end

#find(*args) ⇒ Object



23
24
25
# File 'lib/open_weather/client.rb', line 23

def find(*args)
  get '/find', build_query(args, false)
end

#forecast(*args) ⇒ Object



19
20
21
# File 'lib/open_weather/client.rb', line 19

def forecast(*args)
  get '/forecast', build_query(args)
end

#get(path, query) ⇒ Object



31
32
33
# File 'lib/open_weather/client.rb', line 31

def get(path, query)
  self.class.get(path, query: query.merge(units: "metric"))
end

#weather(*args) ⇒ Object



11
12
13
# File 'lib/open_weather/client.rb', line 11

def weather(*args)
  get '/weather', build_query(args)
end