wwo 0.3.1 → 0.3.2

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wwo.rb +7 -5
  3. data/lib/wwo/version.rb +1 -1
  4. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 603dff73ad4a1de3e8baed08cfcf3f5cfdd75897
4
- data.tar.gz: 6f5fb065b93dae018eb300d0cf582e1471758522
3
+ metadata.gz: 29c2054a0faa82f2991b6291e860bb360d01ee03
4
+ data.tar.gz: 27402f1292fd441fd1fabf31148cac9464b84574
5
5
  SHA512:
6
- metadata.gz: 410cc81c6761f6641e079666e58650ad1c7b9dce0a9414fe2d35e35773343f971f32cbca2bf8e131032801c012f6310e4572db647134bc526dd6f35d5d3e0173
7
- data.tar.gz: e5f821d77c50965dc44e063838059bce6baa885c5b49b202c97e0306f80520f20e09a5765fc646100d8acc33d2c1d06d85f3b53d98602f200d918c20e8f93bc3
6
+ metadata.gz: d22510e41b7d6679882e982e8d57a5c1afe8603aa3ebd2e878da86ad067908ae8c32439726f70218ad85e4074e7976bc059ea49454eabe05523974d7c2fd8890
7
+ data.tar.gz: 08545cda1a9bd0606d53587a56ab57897b2c8319afae96d2849af60ca2c2ed1d19a220149d0bf32ec97d8f3b719892bc80d122c9aa3d99f805e2983d4d91fb6e
data/lib/wwo.rb CHANGED
@@ -21,17 +21,19 @@ module Wwo
21
21
  starting = start_date.strftime('%F')
22
22
  ending = (Time.now - 1.day).strftime('%F')
23
23
 
24
-
25
- if end_date.to_i > Time.now.utc.to_i
24
+ if starting == Time.now.strftime('%F') || start_date.to_i > Time.now.utc.to_i || end_date.to_i > Time.now.utc.to_i
26
25
  forecast_uri = "#{Wwo.api_endpoint}/weather.ashx?q=#{latitude},#{longitude}&format=json&num_of_days=7&date=today&cc=no&mca=no&tp=24&key=#{Wwo.api_key}"
27
26
  forecast_response = api_call(forecast_uri)
28
27
  else
29
28
  forecast_response = {}
30
29
  end
31
30
 
32
- uri = "#{Wwo.api_endpoint}/past-weather.ashx?q=#{latitude},#{longitude}&format=json&extra=utcDateTime&date=#{starting}&enddate=#{ending}&show_comments=no&tp=24&key=#{Wwo.api_key}&mca=false&show_comments=false"
33
- api_response = api_call(uri)
34
-
31
+ if starting == Time.now.strftime('%F') || start_date.to_i > Time.now.utc.to_i
32
+ uri = "#{Wwo.api_endpoint}/past-weather.ashx?q=#{latitude},#{longitude}&format=json&extra=utcDateTime&date=#{starting}&enddate=#{ending}&show_comments=no&tp=24&key=#{Wwo.api_key}&mca=false&show_comments=false"
33
+ api_response = api_call(uri)
34
+ else
35
+ api_response = {}
36
+ end
35
37
 
36
38
  if forecast_compat
37
39
  past = make_into_forecast_response(api_response)
@@ -1,3 +1,3 @@
1
1
  module Wwo
2
- VERSION = "0.3.1"
2
+ VERSION = "0.3.2"
3
3
  end
metadata CHANGED
@@ -1,16 +1,16 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wwo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
- - "株式会社アルム Allm Inc"
7
+ - 株式会社アルム Allm Inc
8
8
  - Ryan Stenhouse
9
9
  - David Czarnecki
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-02-26 00:00:00.000000000 Z
13
+ date: 2016-03-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: faraday
@@ -209,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  requirements: []
211
211
  rubyforge_project:
212
- rubygems_version: 2.4.8
212
+ rubygems_version: 2.5.1
213
213
  signing_key:
214
214
  specification_version: 4
215
215
  summary: Rubygem for accessing the free and premium weather APIs from World Weather