Sha256: c3ef176bc8fd996864fd2202234a33965cde9e5ab4951b3564d0396d31125a01

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

require 'uri'
require 'httpclient'

class SimpleOpenWeatherMap::HttpConnection

  def initialize(uri)
    @uri = uri
  end

  def get_contents(params = {})
    client = ::HTTPClient.new
    client.get_content(url_with_params(params))
  end

  protected

  def url_with_params(params = {})
    encoded_params = URI.encode_www_form(params)
    [@uri, encoded_params].join("?")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
simple_open_weather_map-0.1.0 lib/simple_open_weather_map/http_connection.rb