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 +4 -4
- data/CHANGELOG.md +6 -0
- data/lib/flexirest/base.rb +2 -2
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/base_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c564fe224c8e375c4b642b3b9f8a168d5d63af41
|
4
|
+
data.tar.gz: bc07fc942ef8daeb435acac6321e58fa7b8f4645
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4a93604ff42353ccc6c6776d5703e0f9250251eccb7d39c3237ecade09b5a145e7edf798eaf4a7208f1395e6d9ffd1fe1a481934ca54919ce924a559bbbdfc9
|
7
|
+
data.tar.gz: e2cb5b1154e0758db0efa52d6850a78bfd84859aa7371124f680a286e8b1c97e8dcbd9548f3b8359db87d819b3bcc7b35d3e3fe56de02a2af5fb48edbaa9cba1
|
data/CHANGELOG.md
CHANGED
data/lib/flexirest/base.rb
CHANGED
@@ -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[/^(
|
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
|
data/lib/flexirest/version.rb
CHANGED
data/spec/lib/base_spec.rb
CHANGED
@@ -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.
|
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:
|
11
|
+
date: 2016-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|