api_resource 0.6.22 → 0.6.23
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbbe2d009a9aa2f4ca2f9ebd47f0ed29ef6e7435
|
4
|
+
data.tar.gz: ab32cc814d71d29fc7c80bf59c7c1d7191defd03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 187060c119364c9fd916b3d1e546f90f071c64c4f07ced872e1413bbb3b4ea0dd20992d4881c93f83eb6e54adeeb28fac987c1346484f318dd3b49b9149a2946
|
7
|
+
data.tar.gz: 84ec52412d9104cf988976d4d62bcdf1726069ba81a89cdb4503a3fa624c597e71a67a82f030ffc1ca22df0dc081d22aef1c9f159f0daddb688e3feb86c164b5
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
api_resource (0.6.
|
4
|
+
api_resource (0.6.22)
|
5
5
|
activemodel
|
6
6
|
colorize
|
7
7
|
differ
|
@@ -40,7 +40,7 @@ GEM
|
|
40
40
|
activesupport (3.2.10)
|
41
41
|
i18n (~> 0.6)
|
42
42
|
multi_json (~> 1.0)
|
43
|
-
arel (3.0.
|
43
|
+
arel (3.0.3)
|
44
44
|
builder (3.0.4)
|
45
45
|
byebug (2.3.0)
|
46
46
|
columnize (~> 0.3.6)
|
@@ -84,7 +84,7 @@ GEM
|
|
84
84
|
colorize
|
85
85
|
i18n
|
86
86
|
hike (1.2.3)
|
87
|
-
httpclient (2.
|
87
|
+
httpclient (2.4.0)
|
88
88
|
i18n (0.6.1)
|
89
89
|
journey (1.0.4)
|
90
90
|
json (1.8.1)
|
@@ -97,11 +97,11 @@ GEM
|
|
97
97
|
treetop (~> 1.4.8)
|
98
98
|
metaclass (0.0.1)
|
99
99
|
method_source (0.8.1)
|
100
|
-
mime-types (1.25)
|
100
|
+
mime-types (1.25.1)
|
101
101
|
mocha (0.12.7)
|
102
102
|
metaclass (~> 0.0.1)
|
103
103
|
multi_json (1.5.0)
|
104
|
-
polyglot (0.3.
|
104
|
+
polyglot (0.3.5)
|
105
105
|
pry (0.9.10)
|
106
106
|
coderay (~> 1.0.5)
|
107
107
|
method_source (~> 0.8)
|
@@ -109,7 +109,7 @@ GEM
|
|
109
109
|
rack (1.4.5)
|
110
110
|
rack-cache (1.2)
|
111
111
|
rack (>= 0.4)
|
112
|
-
rack-ssl (1.3.
|
112
|
+
rack-ssl (1.3.4)
|
113
113
|
rack
|
114
114
|
rack-test (0.6.2)
|
115
115
|
rack (>= 1.0)
|
@@ -159,7 +159,7 @@ GEM
|
|
159
159
|
treetop (1.4.15)
|
160
160
|
polyglot
|
161
161
|
polyglot (>= 0.3.1)
|
162
|
-
tzinfo (0.3.
|
162
|
+
tzinfo (0.3.41)
|
163
163
|
yarjuf (1.0.5)
|
164
164
|
builder
|
165
165
|
rspec (>= 2.0)
|
@@ -21,7 +21,7 @@ module ApiResource
|
|
21
21
|
time_info = Date._parse(value)
|
22
22
|
time_info[:micro] = ((time_info[:sec_fraction].to_f % 1) * 1_000_000).to_i
|
23
23
|
|
24
|
-
if time_info[:zone].present?
|
24
|
+
if time_info[:zone].present? && time_info[:zone] =~ /^(\+|\-)[0-9]{1,2}:[0-9]{2}$/
|
25
25
|
new_time(true, *time_info.values_at(:year, :mon, :mday, :hour, :min, :sec, :zone))
|
26
26
|
else
|
27
27
|
new_time(false, *time_info.values_at(:year, :mon, :mday, :hour, :min, :sec, :micro))
|
@@ -38,6 +38,7 @@ module ApiResource
|
|
38
38
|
def self.new_time(use_zone, *args)
|
39
39
|
year = args.first
|
40
40
|
return nil if year.nil? || year == 0
|
41
|
+
|
41
42
|
if use_zone
|
42
43
|
Time.new(*args).utc rescue nil
|
43
44
|
else
|
data/lib/api_resource/version.rb
CHANGED
@@ -35,6 +35,12 @@ describe ApiResource::Typecast::TimeTypecaster do
|
|
35
35
|
val.zone.to_s.should eql("UTC")
|
36
36
|
end
|
37
37
|
|
38
|
+
it "should parse a date not in ISO format in UTC" do
|
39
|
+
val = klass.from_api("2012-12-21T19:29:20Z")
|
40
|
+
val.hour.should eql(19)
|
41
|
+
val.zone.to_s.should eql("UTC")
|
42
|
+
end
|
43
|
+
|
38
44
|
it "should parse a date not in ISO format" do
|
39
45
|
val = klass.from_api("2012/08/09")
|
40
46
|
val.year.should eql(2012)
|