google_tz 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebac84f78b5c7163a62ab7987aad8c49974a8278
4
- data.tar.gz: 9d223135d1bd84a46d233857630fed328d49d2da
3
+ metadata.gz: 2c96f0de679da3f4f300107e23d8a4351971bb31
4
+ data.tar.gz: ffe0469a19a1047fcf52f87a50f3e438dce9b39e
5
5
  SHA512:
6
- metadata.gz: 35814a140a8526aa299dcca006d130db60118c925802a5eb3f57f69b36f57fa8fc5f1265c05a3e8ce7a62dc358f60fa0a596b399b82c6a8b4c97de9b1fec127b
7
- data.tar.gz: 1260fc9024a09442ab7b8712fb8f1da75480714bec45e8718607268a971658f450575b030f5b5b4e395c729616f2ac47717c97b06eeef7aba974a4e309435e17
6
+ metadata.gz: 19f36000ca8569149be3f26b9d19710b4243991c6b42b8e021f004865537380bded5c4de9abf9cc5df64a21af1cadf3d0c0bbed4b869dcbb19d1d6aeddf2e167
7
+ data.tar.gz: edc79ae204d1938ede820068b4cc81f50ed6f56b492fa7b5c07f4d1c03c7232b664de7afd0065a71720c221cc90c2b5811e14d95980fd79999313c8bc700a386
data/Histroy.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## HEAD
2
2
 
3
+ ## 0.3.1 / 2013-09-03
4
+
5
+ ### Development Fixes
6
+ * Stub lookup calls in specs
7
+ * Add response documentation
8
+
3
9
  ## 0.3.0 / 2013-09-02
4
10
 
5
11
  ### Major Enhancements
data/README.md CHANGED
@@ -5,12 +5,47 @@
5
5
 
6
6
  gem install google_tz
7
7
 
8
- ## Usage
9
-
8
+ ## Usage
9
+
10
+ ### Require
10
11
  require 'google_tz'
11
12
 
13
+ ### Lookup
14
+
12
15
  # Lookup timezone information on a location using latitude and longitude.
13
16
  GoogleTZ.lookup(39.7392, -104.9847)
14
17
 
15
- # Lookup timezone infomration on a location using latitude, longitude, timestamp, and language
16
- GoogleTZ.lookup(39.7392, -104.9847, timestamp: 1377891332, language: "es")
18
+ # Lookup timezone information on a location using latitude, longitude, timestamp, and language
19
+ GoogleTZ.lookup(39.7392, -104.9847, timestamp: 1377891332, language: "es")
20
+
21
+ ### Response
22
+
23
+ # Seeing if the Google API call was a success.
24
+ resp = GoogleTZ.lookup(39.7392, -104.9847)
25
+ resp.success?
26
+ => true
27
+
28
+ # Getting data out of the lookup response object.
29
+ resp = GoogleTZ.lookup(39.7392, -104.9847)
30
+ resp.data
31
+ => {"dstOffset"=>3600, "rawOffset"=>-25200, "status"=>"OK", "timeZoneId"=>"America/Denver", "timeZoneName"=>"Mountain Daylight Time"}
32
+
33
+ # Get daylight saving time offset
34
+ resp.dst_offset
35
+ => 3600
36
+
37
+ # Get the raw time zone offset
38
+ resp.raw_offset
39
+ => -25200
40
+
41
+ # Get the status of the google api call
42
+ resp.status
43
+ => "OK"
44
+
45
+ # Get the time zone id
46
+ resp.timezone_id
47
+ => "America/Denver"
48
+
49
+ # Get the time zone name
50
+ resp.timezone_name
51
+ => "Mountain Daylight Time"
@@ -1,3 +1,3 @@
1
1
  module GoogleTZAPI
2
- VERSION = '0.3.0'
2
+ VERSION = '0.3.1'
3
3
  end
@@ -3,8 +3,9 @@ require 'spec_helper'
3
3
  describe 'GoogleTZ' do
4
4
  describe 'lookup' do
5
5
  it 'fetches timezone info for a given latitude, longitude' do
6
+ GoogleTZ.should_receive(:lookup).and_return(GoogleTZAPI::Response.new("{\n \"dstOffset\" : 3600,\n \"rawOffset\" : -25200,\n \"status\" : \"OK\",\n \"timeZoneId\" : \"America/Denver\",\n \"timeZoneName\" : \"Mountain Daylight Time\"\n}\n"))
6
7
  resp = GoogleTZ.lookup(39.7392, -104.9847)
7
-
8
+
8
9
  resp.success?.should == true
9
10
  resp.status.should == 'OK'
10
11
  resp.dst_offset.should == 3600
@@ -14,19 +15,15 @@ describe 'GoogleTZ' do
14
15
  end
15
16
 
16
17
  it 'fetches timezone info when given optional arguments' do
18
+ GoogleTZ.should_receive(:lookup).and_return(GoogleTZAPI::Response.new("{\n \"dstOffset\" : 3600,\n \"rawOffset\" : -25200,\n \"status\" : \"OK\",\n \"timeZoneId\" : \"America/Denver\",\n \"timeZoneName\" : \"Rocky Mountain Sommerzeit\"\n}\n"))
17
19
  resp = GoogleTZ.lookup(39.7392, -104.9847, timestamp: 1377891332, sensor: false, language: "de")
18
20
 
19
- resp.success?.should == true
20
- resp.status.should == 'OK'
21
- resp.dst_offset.should == 3600
22
- resp.raw_offset.should == -25200
23
- resp.timezone_id.should == "America/Denver"
24
- resp.timezone_name.should == "Rocky Mountain Sommerzeit"
21
+ resp.success?.should == true
22
+ resp.status.should == 'OK'
23
+ resp.dst_offset.should == 3600
24
+ resp.raw_offset.should == -25200
25
+ resp.timezone_id.should == "America/Denver"
26
+ resp.timezone_name.should == "Rocky Mountain Sommerzeit"
25
27
  end
26
28
  end
27
- end
28
-
29
-
30
-
31
- "{\n \"dstOffset\" : 3600,\n \"rawOffset\" : -25200,\n \"status\" : \"OK\",\n \"timeZoneId\" : \"America/Denver\",\n \"timeZoneName\" : \"Hora de verano de Montaña\"\n}\n"
32
- '{\n \"dstOffset\" : 3600,\n \"rawOffset\" : -25200,\n \"status\" : \"OK\",\n \"timeZoneId\" : \"America/Denver\",\n \"timeZoneName\" : \"Hora de verano de Monta\\xC3\\xB1a\"\n}\n'
29
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google_tz
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
  - Daniel McGraw