darksky 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,11 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 1.0.1
4
+
5
+ * Added `options` hash to API endpoints as final parameter
6
+ * Default options for API endpoints disable SSL peer verification while DarkSky API is in beta and still uses a self-signed certificate
7
+ * Fixed response parsing for `precipitation` API endpoint
8
+
3
9
  ## 1.0.0
4
10
 
5
11
  * Initial release
@@ -4,6 +4,9 @@ require 'json'
4
4
  module Darksky
5
5
  class API
6
6
  DARKSKY_API_URL = 'https://api.darkskyapp.com/v1'
7
+ DEFAULT_OPTIONS = {
8
+ :disable_ssl_peer_verification => true
9
+ }
7
10
 
8
11
  # Create a new instance of the Darksky::API using your API key.
9
12
  #
@@ -16,17 +19,18 @@ module Darksky
16
19
  #
17
20
  # @param latitude [String] Latitude in decimal degrees.
18
21
  # @param longitude [String] Longitude in decimal degrees.
19
- def forecast(latitude, longitude)
20
- response = Typhoeus::Request.get("#{DARKSKY_API_URL}/forecast/#{@api_key}/#{latitude},#{longitude}")
22
+ def forecast(latitude, longitude, options = {})
23
+ response = Typhoeus::Request.get("#{DARKSKY_API_URL}/forecast/#{@api_key}/#{latitude},#{longitude}", DEFAULT_OPTIONS.dup.merge(options))
21
24
  JSON.parse(response.body) if response.code == 200
22
25
  end
23
26
 
24
27
  # Returns forecasts for a collection of arbitrary points.
25
28
  #
26
29
  # @param latitudes_longitudes_times [Array] Triplets of latitude, longitude and time. Example: ['42.7','-73.6',1325607100,'42.0','-73.0',1325607791]
27
- def precipitation(latitudes_longitudes_times)
30
+ def precipitation(latitudes_longitudes_times, options = {})
28
31
  return if latitudes_longitudes_times.size % 3 != 0
29
- response = Typhoeus::Request.get("#{DARKSKY_API_URL}/precipitation/#{@api_key}/#{latitudes_longitudes_times.join(',')}")
32
+ response = Typhoeus::Request.get("#{DARKSKY_API_URL}/precipitation/#{@api_key}/#{latitudes_longitudes_times.join(',')}", DEFAULT_OPTIONS.dup.merge(options))
33
+ JSON.parse(response.body) if response.code == 200
30
34
  end
31
35
  end
32
36
  end
@@ -1,3 +1,3 @@
1
1
  module Darksky
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: darksky
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-07 00:00:00.000000000 Z
12
+ date: 2012-03-08 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: typhoeus
16
- requirement: &70209839569900 !ruby/object:Gem::Requirement
16
+ requirement: &2161902360 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70209839569900
24
+ version_requirements: *2161902360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rake
27
- requirement: &70209839569480 !ruby/object:Gem::Requirement
27
+ requirement: &2161901940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70209839569480
35
+ version_requirements: *2161901940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70209839569060 !ruby/object:Gem::Requirement
38
+ requirement: &2161901520 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70209839569060
46
+ version_requirements: *2161901520
47
47
  description: Ruby gem for retrieving data from the Dark Sky API
48
48
  email:
49
49
  - me@davidczarnecki
@@ -78,7 +78,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
78
78
  version: '0'
79
79
  segments:
80
80
  - 0
81
- hash: -3643920897857846086
81
+ hash: -1193096420889366995
82
82
  required_rubygems_version: !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
@@ -87,7 +87,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
87
  version: '0'
88
88
  segments:
89
89
  - 0
90
- hash: -3643920897857846086
90
+ hash: -1193096420889366995
91
91
  requirements: []
92
92
  rubyforge_project: darksky
93
93
  rubygems_version: 1.8.10