openweather2 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8ef3f8e41cba45a0f32e7fef1b9e04ff26a62468
4
- data.tar.gz: 2c347a76100236c5ebce073b72545ad3bdc8c0d2
3
+ metadata.gz: 31795559ddff60a2dfc0755965c1449ce32342d8
4
+ data.tar.gz: 8b7316544bf04460f8f61dfee9113f78165e130f
5
5
  SHA512:
6
- metadata.gz: 74725fc9f20473e27ac3e28b0a24cf75a946f37f8c8495aed506995cad72a66727c1d93a74bb9d4dcbfd8a60e3ed2b3d0f63d71a2e412eb2410446fa9e503dbd
7
- data.tar.gz: a1d01c89957949d6b7850df12cc23da2aae4c66429a07dd4c8e064f85dd51f81dc36159136a0483e5c9c1bc00bbbdf183eeaaf3ec77f053584545428e6f35f4b
6
+ metadata.gz: fd00fe93e63130132aa6d725b89d42e563445810ef49e242ef1c905ec0e2f1ead6b50129ab4e948f2856963f2d32206dcf0cb2d66289511aa096c2bc3a70a90b
7
+ data.tar.gz: 0a5d198bf91a3bd9eb4744e5dda30f58a10815421f86092d4653b265b0fd3cf7b5c9ec6972ce52b9082c9d8516c8c61364fa35fa3c745ca28a79d2baec74d5c2
@@ -24,11 +24,11 @@ module Openweather2
24
24
  yield(configuration)
25
25
  end
26
26
 
27
- def weather(city)
27
+ def weather(city, units = nil)
28
28
  configure_required!
29
29
 
30
30
  uri = URI(Openweather2.configuration.endpoint)
31
- uri.query = URI.encode_www_form(default_params.merge(:q => city))
31
+ uri.query = URI.encode_www_form(default_params.merge(:q => city, :units => units))
32
32
  req = Net::HTTP::Get.new(uri.request_uri)
33
33
 
34
34
  http_params = [uri.hostname, uri.port, use_ssl: uri.scheme == 'https']
@@ -42,9 +42,9 @@ module Openweather2
42
42
  Openweather2::Weather.new(json)
43
43
 
44
44
  when Net::HTTPUnprocessableEntity
45
- raise UnprocessableError, "Bad URI param!"
45
+ raise UnprocessableError, 'Bad URI param!'
46
46
  else
47
- raise UnknownResponse, "Something was wrong!"
47
+ raise UnknownResponse, 'Something was wrong!'
48
48
  end
49
49
  end
50
50
 
@@ -52,12 +52,12 @@ module Openweather2
52
52
 
53
53
  def configure_required!
54
54
  if Openweather2.configuration.instance_variables.size < 2
55
- raise ArgumentError, "You must configure Openweather2"
55
+ raise ArgumentError, 'You must configure Openweather2'
56
56
  end
57
57
  end
58
58
 
59
59
  def default_params
60
- {:APPID => Openweather2.configuration.apikey }
60
+ { APPID: Openweather2.configuration.apikey }
61
61
  end
62
62
 
63
63
  end
@@ -1,3 +1,3 @@
1
1
  module Openweather2
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -8,11 +8,11 @@ module Openweather2
8
8
  @city = json['name']
9
9
  @longitude = json['coord'] && json['coord']['lon']
10
10
  @latitude = json['coord'] && json['coord']['lat']
11
- @temperature = Openweather2::Temperature.new(json['main']['temp'])
11
+ @temperature = json['main']['temp']
12
12
  @pressure = json['main']['pressure']
13
13
  @humidity = json['main']['humidity']
14
- @min_temperature = Openweather2::Temperature.new(json['main']['temp_min'])
15
- @max_temperature = Openweather2::Temperature.new(json['main']['temp_max'])
14
+ @min_temperature = json['main']['temp_min']
15
+ @max_temperature = json['main']['temp_max']
16
16
  @clouds = json['clouds']['all']
17
17
  @wind_speed = json['wind']['speed']
18
18
  @wind_angle = json['wind']['deg']
data/lib/openweather2.rb CHANGED
@@ -1,4 +1,3 @@
1
1
  require "openweather2/version"
2
2
  require "openweather2/client"
3
3
  require "openweather2/weather"
4
- require "openweather2/temperature"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openweather2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Ocon
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-13 00:00:00.000000000 Z
11
+ date: 2015-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: minitest
@@ -82,7 +82,6 @@ files:
82
82
  - bin/setup
83
83
  - lib/openweather2.rb
84
84
  - lib/openweather2/client.rb
85
- - lib/openweather2/temperature.rb
86
85
  - lib/openweather2/version.rb
87
86
  - lib/openweather2/weather.rb
88
87
  - openweather.gemspec
@@ -1,15 +0,0 @@
1
- module Openweather2
2
- class Temperature
3
- def initialize(kelvin)
4
- @kelvin = kelvin
5
- end
6
-
7
- def to_metric
8
- "#{(@kelvin - 273.15).round(2)}°C"
9
- end
10
-
11
- def to_imperial
12
- "#{(1.8 * (@kelvin - 273.15) + 32).round(2)}°F"
13
- end
14
- end
15
- end