hg-weather 0.1.0 → 0.1.1

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: c7d4ec3fd09af7a164322701fa97a41c42175df8
4
- data.tar.gz: 0ceb34a84d0615f0066ee6fc436b269f03c357aa
3
+ metadata.gz: 19de981128e3fc22ef4110d61d3dfb27e9dfe52a
4
+ data.tar.gz: 7f5f82a3dabcba0e6863288da883942456e83f7d
5
5
  SHA512:
6
- metadata.gz: 59d305e2b8af1144dc45abcffb5ef27edbb3521fbf8a5faf0945dae92124241085fd32c0df2d487d914db46af1b412e7c5fd415cff1a3404fc87e8c552315705
7
- data.tar.gz: f941ba9d787daaf439193e0649ffc80d273c5a026a2c2aa943920fa29390ed8e9357499569f37a97ec12696f9fec16da00fc55c8dbee7939fd8276eafde70272
6
+ metadata.gz: a444fb2a8fe20493aa100e654305340500e02475a42b06e75f8bd3861277c0056dc134156588cc90085e2033f01833eaf1acfe74d7a20a943c51dec8fb87dd22
7
+ data.tar.gz: 682dcbbf75879d901593b395e2cf345c6ba17b919598514a34e27fc2009c91b523b7f32466252b7ccd19e2174b0ca9552b966ccfa38ba86f1676dce5d52d210f
@@ -1,4 +1,5 @@
1
1
  require 'hg/weather/temperature'
2
+ require 'hg/weather/speed'
2
3
 
3
4
  module HG
4
5
  module Weather
@@ -54,7 +55,7 @@ module HG
54
55
  @image_id = options[:image_id] if options[:image_id]
55
56
  @description = options[:description] if options[:description]
56
57
  @slug = options[:slug].to_sym if options[:slug]
57
- @wind_speed = options[:wind_speed] if options[:wind_speed]
58
+ @wind_speed = Speed.new(options[:wind_speed]) if options[:wind_speed]
58
59
  @currently = (options[:currently] == 'dia' ? :day : :night) if options[:currently]
59
60
  @datetime = process_datetime(options[:date], options[:time]) if options[:date]
60
61
  @sunrise = process_sunrise(options[:sunrise]) if options[:sunrise]
@@ -61,7 +61,7 @@ module HG
61
61
  max_temperature: r['max'],
62
62
  min_temperature: r['min'],
63
63
  description: r['description'],
64
- condition_slug: r['condition'],
64
+ slug: r['condition'],
65
65
  is_forecast: true
66
66
  }
67
67
  end
@@ -0,0 +1,25 @@
1
+ module HG
2
+ module Weather
3
+
4
+ class Speed
5
+ attr_accessor :km_h
6
+ attr_accessor :miles_h
7
+
8
+ attr_accessor :direction
9
+
10
+ def initialize speed, direction = nil, format = :km
11
+ return if speed.nil?
12
+ speed = speed.to_f
13
+
14
+ if format == :km
15
+ @km_h = speed
16
+ @miles_h = speed * 0.621371
17
+ else
18
+ @miles_h = speed
19
+ @km_h = speed * 1.60934
20
+ end
21
+ end
22
+ end
23
+
24
+ end
25
+ end
@@ -1,5 +1,5 @@
1
1
  module HG
2
2
  module Weather
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hg-weather
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hugo Demiglio
@@ -20,6 +20,7 @@ files:
20
20
  - lib/hg/weather.rb
21
21
  - lib/hg/weather/condition.rb
22
22
  - lib/hg/weather/data.rb
23
+ - lib/hg/weather/speed.rb
23
24
  - lib/hg/weather/temperature.rb
24
25
  - lib/hg/weather/version.rb
25
26
  homepage: http://hgbrasil.com/weather
@@ -42,7 +43,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
42
43
  version: '0'
43
44
  requirements: []
44
45
  rubyforge_project:
45
- rubygems_version: 2.4.8
46
+ rubygems_version: 2.4.5.1
46
47
  signing_key:
47
48
  specification_version: 4
48
49
  summary: Simple gem to get weather data from HG Weather.