openweather2 0.1.2 → 0.1.3

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: a0f4c95c1dc25a97134cdb801673ec3c4a65189f
4
- data.tar.gz: b35cdcfbb608d2e2ee6b8a05c823004771b4f600
3
+ metadata.gz: 2928fc7bb5e1e2a33d0bab9262c2580e1870cf1b
4
+ data.tar.gz: bae53bbc5263b753ec836a5fb3f479a97df4a32a
5
5
  SHA512:
6
- metadata.gz: a346a5ecc41e8006ee1d674c2ea1dff3a4e4d58543cd165e2d764cf1852eaae2f7eb20ee4cb1d1102df266705690d3ec51026787eb2ca0841ed4c1e369ec1fdc
7
- data.tar.gz: e887affdf7d3ae48bcdcd1ccc6621e7fee5ccc47b0f1ade0ca9d2f407c93391445d76cf95569376d9723cc893e63e74110d52465f0e74ae2ee82423652c3aca3
6
+ metadata.gz: 64ff8d5212e3b2d00a08dc6ed7f3b2afe1dab414faa901bd1258cbb87fbccd0590fd02428e7f491eff114ac4377769e3894bf7806744899306e21bfdccf05071
7
+ data.tar.gz: fd29d80784491b4b6f882bcde125b9591ae55453a69911e6f0c5451dbf1ee0bd48b2bed3a0cb3d76ee7fadaf65cc1f46216812faa603f2310fadf65e1005671b
@@ -1,3 +1,4 @@
1
1
  require "openweather2/version"
2
2
  require "openweather2/client"
3
3
  require "openweather2/weather"
4
+ require "openweather2/temperature"
@@ -0,0 +1,15 @@
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
@@ -1,3 +1,3 @@
1
1
  module Openweather2
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -8,11 +8,11 @@ module Openweather2
8
8
  @city = json['name']
9
9
  @longitude = json['coord']['lon']
10
10
  @latitude = json['coord']['lat']
11
- @temperature = json['main']['temp']
11
+ @temperature = Openweather2::Temperature.new(json['main']['temp'])
12
12
  @pressure = json['main']['pressure']
13
13
  @humidity = json['main']['humidity']
14
- @min_temperature = json['main']['temp_min']
15
- @max_temperature = json['main']['temp_max']
14
+ @min_temperature = Openweather2::Temperature.new(json['main']['temp_min'])
15
+ @max_temperature = Openweather2::Temperature.new(json['main']['temp_max'])
16
16
  @clouds = json['clouds']['all']
17
17
  @wind_speed = json['wind']['speed']
18
18
  @wind_angle = json['wind']['deg']
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openweather2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Ocon
@@ -82,6 +82,7 @@ files:
82
82
  - bin/setup
83
83
  - lib/openweather2.rb
84
84
  - lib/openweather2/client.rb
85
+ - lib/openweather2/temperature.rb
85
86
  - lib/openweather2/version.rb
86
87
  - lib/openweather2/weather.rb
87
88
  - openweather.gemspec