myweatherforecast 0.3.0 → 0.3.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: 93c3e36f8033e7eabc0485df30f2c3c2dd71aee7
4
- data.tar.gz: 80958f8cb9d2474d34688a966fd1e0c0d3626973
3
+ metadata.gz: af86dccf7ea42e5895c5507c83438800e40e7a52
4
+ data.tar.gz: d7a8f68980b40d89cfdd3ee6fef3cc22ffffa368
5
5
  SHA512:
6
- metadata.gz: f55f4b2838c35cec9e250d302e66085c651f5264203c8ef54e472ecc3b0464c1365c78a73e7e80d3182710941bc789beac0eb93567167c1bf474b9ad7b169d95
7
- data.tar.gz: 039dfc0543cd1e003e2a17dff23cf833fd2c5cc768ac1eea845bca6a32263de73a6959258d7703400dd1b7c084751f7b6aa774fc596dd7a5ea30259d2e963ec2
6
+ metadata.gz: 2e9e424e01d72a035fe73e5eeec4d56ab7f3dea40a33a634482c9d9c609002a8d92196564daba2d91bec5a35067ec66aa3eebe61c8f7ace0b03ea29853828640
7
+ data.tar.gz: e446c90dfc272c3ffb487dddb9a886155ede21040d19ceaf15c0f1c442fc2bde40e238f06b2a0238127db78c2bd4ca616d1a7c7ec13857a20464cf5f9afdf60f
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -40,10 +40,10 @@ class MyWeatherForecast
40
40
 
41
41
  class Day
42
42
 
43
- def initialize(forecast, tlabel)
43
+ def initialize(forecast, tlabel, i=nil)
44
44
 
45
45
  @forecast = forecast
46
- @x = forecast.currently
46
+ @x = i ? forecast['hourly']['data'][i] : forecast.currently
47
47
  @tlabel = tlabel
48
48
 
49
49
  end
@@ -54,8 +54,7 @@ class MyWeatherForecast
54
54
  i = 0
55
55
  i += 1 until Time.at(@forecast['hourly']['data'][i]['time']).hour \
56
56
  == hour.to_i
57
- @x = @forecast['hourly']['data'][i]
58
- self
57
+ Day.new(@forecast, @tlabel, i)
59
58
  end
60
59
 
61
60
  def humidity()
@@ -99,8 +98,19 @@ class MyWeatherForecast
99
98
  @forecast = forecast
100
99
  @x = forecast['hourly']['data'][index]
101
100
  @tlabel = tlabel
101
+ @i = index
102
102
 
103
103
  end
104
+
105
+ def at(raw_hour)
106
+
107
+ hour = Time.parse(raw_hour).hour
108
+
109
+ i = @i - 12
110
+ i += 1 until Time.at(@forecast['hourly']['data'][i]['time']).hour \
111
+ == hour.to_i
112
+ DaysAhead.new(@forecast, @tlabel, index: i)
113
+ end
104
114
 
105
115
  end
106
116
 
@@ -119,4 +129,4 @@ class MyWeatherForecast
119
129
  DaysAhead.new(@forecast, @tlabel, index: i)
120
130
  end
121
131
 
122
- end
132
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myweatherforecast
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
metadata.gz.sig CHANGED
Binary file