flexirest 1.6.6 → 1.6.7

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: 3515fbcc420fd60dd7e4ba9bf60c7024746577f8
4
- data.tar.gz: 2f0170a3acfdf49ea822579bd38bda1ebad2ccc5
3
+ metadata.gz: d07c8260f4147a07a88031a028a1062a40f8fecc
4
+ data.tar.gz: db5f43a0ac0a8a2dc7b7e60dd8742d83ec614ddf
5
5
  SHA512:
6
- metadata.gz: 1efda5ef18d2c289f1d0c82732b2cf65adce2ea7367dd9be11506d81e7858a95ba9944012c33d8fc6e8bc630a741201055f8054e24685bdf9222fe393b2c4d09
7
- data.tar.gz: 7fe7c9f5276d3e17ccc7fd3d44244cd88707905c9c98c55f78d9776fc061f76f8144015cf6e9cbd411cba295ee94f25129f447abf7cc719dad68d989a84ed531
6
+ metadata.gz: abd6a9d4e215781f4f2a421cd796bd2c76878e47fb969c5191092d72c6ad6e613cef9bba5cf005a6651fadaa4637ba8475160c3f41eb089b3007994ea326d94b
7
+ data.tar.gz: 3934022f4a3ee6a28e6f4290a7228fe89a9f6cc116d00ceb6746c1fe29e6b4b4756c25277e200549f8c0b1bfb6577342343841d5104422b4f3041c8f3ae58084
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.7
4
+
5
+ Bugfix:
6
+
7
+ - Returning the string value for a field that looks like a Date/DateTime instead of raising an error when the value can't be parsed (thanks to Give Corps for the pull request)
8
+
3
9
  ## 1.6.6
4
10
 
5
11
  Feature:
@@ -27,7 +27,7 @@ class Person < Flexirest::Base
27
27
  end
28
28
  ```
29
29
 
30
- In the above example, the `username` call handles things differently if it's called from an object context:
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
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.6.6"
2
+ VERSION = "1.6.7"
3
3
  end
@@ -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.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-09 00:00:00.000000000 Z
11
+ date: 2018-04-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler