flexirest 1.6.6 → 1.6.7
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/docs/authentication.md +1 -1
- data/lib/flexirest/attribute_parsing.rb +2 -2
- data/lib/flexirest/version.rb +1 -1
- data/spec/lib/attribute_parsing_spec.rb +4 -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: d07c8260f4147a07a88031a028a1062a40f8fecc
|
4
|
+
data.tar.gz: db5f43a0ac0a8a2dc7b7e60dd8742d83ec614ddf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: abd6a9d4e215781f4f2a421cd796bd2c76878e47fb969c5191092d72c6ad6e613cef9bba5cf005a6651fadaa4637ba8475160c3f41eb089b3007994ea326d94b
|
7
|
+
data.tar.gz: 3934022f4a3ee6a28e6f4290a7228fe89a9f6cc116d00ceb6746c1fe29e6b4b4756c25277e200549f8c0b1bfb6577342343841d5104422b4f3041c8f3ae58084
|
data/CHANGELOG.md
CHANGED
data/docs/authentication.md
CHANGED
@@ -27,7 +27,7 @@ class Person < Flexirest::Base
|
|
27
27
|
end
|
28
28
|
```
|
29
29
|
|
30
|
-
|
30
|
+
Note in the above code sample, we've used a proc in one of them and a block in the other. There's no difference at all, we just wanted to demonstrate both syntaxes. Also, both will accept a single parameter (`obj` in the above) to receive an optional parameter for the current Flexirest object (if not called from a class context). For example, the `username` call above handles things differently if it's called from an object context:
|
31
31
|
|
32
32
|
```ruby
|
33
33
|
person = Person.new(id: 1234)
|
@@ -6,9 +6,9 @@ module Flexirest
|
|
6
6
|
return v if v.is_a?(Date) || v.is_a?(DateTime)
|
7
7
|
|
8
8
|
if v.to_s[(/\A(((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))\Z/)]
|
9
|
-
Date.parse(v)
|
9
|
+
Date.parse(v) rescue v
|
10
10
|
elsif v.to_s[/\A([\+-]?\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)?)?))\Z/]
|
11
|
-
DateTime.parse(v)
|
11
|
+
DateTime.parse(v) rescue v
|
12
12
|
else
|
13
13
|
v
|
14
14
|
end
|
data/lib/flexirest/version.rb
CHANGED
@@ -39,4 +39,8 @@ describe Flexirest::AttributeParsing do
|
|
39
39
|
it "should return floats for float values" do
|
40
40
|
expect(subject.test(1980.12)).to eq(1980.12)
|
41
41
|
end
|
42
|
+
|
43
|
+
it "should return as a string a date-like string that can't be parsed" do
|
44
|
+
expect(subject.test("7/29/2018")).to eq("7/29/2018")
|
45
|
+
end
|
42
46
|
end
|
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.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Jeffries
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|