Class: WeatherApi::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/current_weather/client.rb

Constant Summary collapse

BASE_URL =
'http://www.google.com'

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



8
9
10
# File 'lib/current_weather/client.rb', line 8

def initialize
  @connection = Faraday.new(BASE_URL)
end

Instance Method Details

#get_weather(location) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/current_weather/client.rb', line 12

def get_weather(location)
  response = @connection.get do |req|
    req.url '/ig/api'
    req.headers['Accept'] = 'application/xml'
    req.params['weather'] = location
  end
  response.body
end