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 +4 -4
- data/lib/openweather2/client.rb +6 -6
- data/lib/openweather2/version.rb +1 -1
- data/lib/openweather2/weather.rb +3 -3
- data/lib/openweather2.rb +0 -1
- metadata +2 -3
- data/lib/openweather2/temperature.rb +0 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31795559ddff60a2dfc0755965c1449ce32342d8
|
4
|
+
data.tar.gz: 8b7316544bf04460f8f61dfee9113f78165e130f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fd00fe93e63130132aa6d725b89d42e563445810ef49e242ef1c905ec0e2f1ead6b50129ab4e948f2856963f2d32206dcf0cb2d66289511aa096c2bc3a70a90b
|
7
|
+
data.tar.gz: 0a5d198bf91a3bd9eb4744e5dda30f58a10815421f86092d4653b265b0fd3cf7b5c9ec6972ce52b9082c9d8516c8c61364fa35fa3c745ca28a79d2baec74d5c2
|
data/lib/openweather2/client.rb
CHANGED
@@ -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,
|
45
|
+
raise UnprocessableError, 'Bad URI param!'
|
46
46
|
else
|
47
|
-
raise UnknownResponse,
|
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,
|
55
|
+
raise ArgumentError, 'You must configure Openweather2'
|
56
56
|
end
|
57
57
|
end
|
58
58
|
|
59
59
|
def default_params
|
60
|
-
{:
|
60
|
+
{ APPID: Openweather2.configuration.apikey }
|
61
61
|
end
|
62
62
|
|
63
63
|
end
|
data/lib/openweather2/version.rb
CHANGED
data/lib/openweather2/weather.rb
CHANGED
@@ -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 =
|
11
|
+
@temperature = json['main']['temp']
|
12
12
|
@pressure = json['main']['pressure']
|
13
13
|
@humidity = json['main']['humidity']
|
14
|
-
@min_temperature =
|
15
|
-
@max_temperature =
|
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
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
|
+
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-
|
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
|