hg-weather 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hg/weather/condition.rb +2 -1
- data/lib/hg/weather/data.rb +1 -1
- data/lib/hg/weather/speed.rb +25 -0
- data/lib/hg/weather/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19de981128e3fc22ef4110d61d3dfb27e9dfe52a
|
4
|
+
data.tar.gz: 7f5f82a3dabcba0e6863288da883942456e83f7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a444fb2a8fe20493aa100e654305340500e02475a42b06e75f8bd3861277c0056dc134156588cc90085e2033f01833eaf1acfe74d7a20a943c51dec8fb87dd22
|
7
|
+
data.tar.gz: 682dcbbf75879d901593b395e2cf345c6ba17b919598514a34e27fc2009c91b523b7f32466252b7ccd19e2174b0ca9552b966ccfa38ba86f1676dce5d52d210f
|
data/lib/hg/weather/condition.rb
CHANGED
@@ -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]
|
data/lib/hg/weather/data.rb
CHANGED
@@ -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
|
data/lib/hg/weather/version.rb
CHANGED
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.
|
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.
|
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.
|