flexirest 1.2.9 → 1.2.10

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: 81462a92874dcd46c379c35a305f9fa6c0cfbdea
4
- data.tar.gz: fad159ec5aa84dc8f60e840f18a8ea161101cbd8
3
+ metadata.gz: c564fe224c8e375c4b642b3b9f8a168d5d63af41
4
+ data.tar.gz: bc07fc942ef8daeb435acac6321e58fa7b8f4645
5
5
  SHA512:
6
- metadata.gz: d5354c2a387defe3e442edd48a41fc859e9c52143785cd13c3f119c7b3e3e0e3d4a88eed08aed1392c7a37de687dfc4c2611e4fec3fcd098f15179e1a0e96951
7
- data.tar.gz: 273024d2280a99e634bea16561f6d364842a6dc88335993751d46ed658bac0323ad5dc859a3187f610b536475a504488b6d42d93a7f2cf45eafd05132e32b162
6
+ metadata.gz: b4a93604ff42353ccc6c6776d5703e0f9250251eccb7d39c3237ecade09b5a145e7edf798eaf4a7208f1395e6d9ffd1fe1a481934ca54919ce924a559bbbdfc9
7
+ data.tar.gz: e2cb5b1154e0758db0efa52d6850a78bfd84859aa7371124f680a286e8b1c97e8dcbd9548f3b8359db87d819b3bcc7b35d3e3fe56de02a2af5fb48edbaa9cba1
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.10
4
+
5
+ Bugfixes:
6
+
7
+ - Changes the date regexes to not misinterpret strings of 8 digits to be dates (thanks Tom Hoen)
8
+
3
9
  ## 1.2.9
4
10
 
5
11
  Bugfixes:
@@ -24,9 +24,9 @@ module Flexirest
24
24
 
25
25
  attrs.each do |attribute_name, attribute_value|
26
26
  attribute_name = attribute_name.to_sym
27
- if attribute_value.to_s[/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6]))))$/]
27
+ if attribute_value.to_s[(/^(((19|20)\d\d[- \/.](0[1-9]|1[012]|[1-9])[- \/.](0[1-9]|[12][0-9]|3[01]|[1-9]))|((0[1-9]|1[012]|[1-9])[- \/.](0[1-9]|[12][0-9]|3[01]|[1-9])[- \/.](19|20)\d\d))$/)]
28
28
  @attributes[attribute_name] = Date.parse(attribute_value)
29
- elsif attribute_value.to_s[/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)$/]
29
+ elsif attribute_value.to_s[/^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-2])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?))$/]
30
30
  @attributes[attribute_name] = DateTime.parse(attribute_value)
31
31
  else
32
32
  @attributes[attribute_name] = attribute_value
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.2.9"
2
+ VERSION = "1.2.10"
3
3
  end
@@ -94,11 +94,21 @@ describe Flexirest::Base do
94
94
  expect(client["test"]).to eq(d)
95
95
  end
96
96
 
97
+ it "should automatically parse date/time strings regardless if the date portion has no delimiters" do
98
+ client = EmptyExample.new(:test => "20151230T09:48:50-05:00")
99
+ expect(client["test"]).to be_an_instance_of(DateTime)
100
+ end
101
+
97
102
  it "should allow strings of 4 digits and not intepret them as dates" do
98
103
  client = EmptyExample.new(:test => "2015")
99
104
  expect(client["test"]).to be_an_instance_of(String)
100
105
  end
101
106
 
107
+ it "should allow strings of 8 digits and not intepret them as dates" do
108
+ client = EmptyExample.new(:test => "1266129")
109
+ expect(client["test"]).to be_an_instance_of(String)
110
+ end
111
+
102
112
  it "should store attributes set using missing method names and mark them as dirty" do
103
113
  client = EmptyExample.new()
104
114
  client.test = "Something"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexirest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.9
4
+ version: 1.2.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-16 00:00:00.000000000 Z
11
+ date: 2016-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler