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: 7509a2d4163d8d10f94db97575b59deec95663a2
4
- data.tar.gz: a540de64f15a6196656ca31b43efdee89c816c66
3
+ metadata.gz: dbbe2d009a9aa2f4ca2f9ebd47f0ed29ef6e7435
4
+ data.tar.gz: ab32cc814d71d29fc7c80bf59c7c1d7191defd03
5
5
  SHA512:
6
- metadata.gz: e1860666ecc1aa458a8f35121c6b98017af00161f1ce418476d12c823efa77b4f5e19b24ba6c559b9855cfccbe9ec1827d37d5c3f12400a1bedbf3aadf282a20
7
- data.tar.gz: 9d22a6386bc3f13727f7a3e2ea56112b07012874237f340b78b77d5b07a7422c009f160ecb01a0311c6ffa341ea24f8fa63f1595b2137f815d8b8a9607ab7c0a
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.21)
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.2)
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.3.4.1)
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.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.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.38)
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
@@ -1,3 +1,3 @@
1
1
  module ApiResource
2
- VERSION = "0.6.22"
2
+ VERSION = "0.6.23"
3
3
  end
@@ -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)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.22
4
+ version: 0.6.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Langevin