fmrest-spyke 0.15.2 → 0.16.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +13 -2
- data/lib/fmrest/spyke/model/serialization.rb +8 -0
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a91619fdca8717119b8b299648d3388948551e653bececb0a90a422850be0a2
|
4
|
+
data.tar.gz: 9e666b8f8162522b1269a3b4d18cda8724ad7439d0398672c02d228149cb636d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fee0ccdc7bb75ae47f620c0cbf3da137806394225a565f5227d9a63e4ea4612b78200997dfc84594ba4eb2db84a156a28d3b05109d9dfb95f6851434bd94f6b
|
7
|
+
data.tar.gz: bab901d8024b1331358325f149ebc297c206e549aba81b73187748b2f168c7eecac2409170722e7a062901317084348c4ac3811bddffa07613bf944aa0f61f00
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -152,6 +152,7 @@ Option | Description | Format
|
|
152
152
|
`:ssl` | SSL options to be forwarded to Faraday | Faraday SSL options | None
|
153
153
|
`:proxy` | Proxy options to be forwarded to Faraday | Faraday proxy options | None
|
154
154
|
`:log` | Log JSON responses to STDOUT | Boolean | `false`
|
155
|
+
`:log_level` | Which log level to log into | Values accepted by `Logger#level=` | `:debug`
|
155
156
|
`:coerce_dates` | See section on [date fields](#date-fields-and-timezones) | Boolean \| `:hybrid` \| `:full` | `false`
|
156
157
|
`:date_format` | Date parsing format | String (FM date format) | `"MM/dd/yyyy"`
|
157
158
|
`:timestamp_format` | Timestmap parsing format | String (FM date format) | `"MM/dd/yyyy HH:mm:ss"`
|
@@ -457,7 +458,7 @@ If using `fmrest-spyke` with Rails then pretty log output will be set up for
|
|
457
458
|
you automatically by Spyke (see [their
|
458
459
|
README](https://github.com/balvig/spyke#log-output)).
|
459
460
|
|
460
|
-
You can also enable simple Faraday
|
461
|
+
You can also enable simple Faraday logging of raw requests (useful for
|
461
462
|
debugging) by passing `log: true` in the options hash for either
|
462
463
|
`FmRest.default_connection_settings=` or your models' `fmrest_config=`, e.g.:
|
463
464
|
|
@@ -478,7 +479,17 @@ class LoggyBee < FmRest::Layout
|
|
478
479
|
end
|
479
480
|
```
|
480
481
|
|
481
|
-
|
482
|
+
You can also pass `log_level` to connection settings to change the severity of
|
483
|
+
log output (defaults to `:debug`).
|
484
|
+
|
485
|
+
By default fmrest-ruby logs to STDOUT or to Rails' logger object if available.
|
486
|
+
You can change this by providing your own logger object to `FmRest.logger=`:
|
487
|
+
|
488
|
+
```ruby
|
489
|
+
FmRest.logger = Logger.new("fmrest.log")
|
490
|
+
```
|
491
|
+
|
492
|
+
If you need to set up more complex logging for your models you can use the
|
482
493
|
`faraday` block inside your class to inject your own logger middleware into the
|
483
494
|
Faraday connection, e.g.:
|
484
495
|
|
@@ -73,6 +73,10 @@ module FmRest
|
|
73
73
|
# Modifies the given hash in-place encoding non-string values (e.g.
|
74
74
|
# dates) to their string representation when appropriate.
|
75
75
|
#
|
76
|
+
# nil gets converted to empty string as the Data API doesn't accept
|
77
|
+
# nulls in JSON. Likewise, true and false get converted to 1 and 0
|
78
|
+
# respectively.
|
79
|
+
#
|
76
80
|
def serialize_values!(params)
|
77
81
|
params.transform_values! do |value|
|
78
82
|
case value
|
@@ -80,6 +84,10 @@ module FmRest
|
|
80
84
|
FmRest::V1.convert_datetime_timezone(value.to_datetime, fmrest_config.timezone).strftime(FmRest::V1::Dates::FM_DATETIME_FORMAT)
|
81
85
|
when *FmRest::V1.date_classes
|
82
86
|
value.strftime(FmRest::V1::Dates::FM_DATE_FORMAT)
|
87
|
+
when nil
|
88
|
+
""
|
89
|
+
when true, false
|
90
|
+
value ? 1 : 0
|
83
91
|
else
|
84
92
|
value
|
85
93
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fmrest-spyke
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Carbajal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-04-
|
11
|
+
date: 2021-04-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fmrest-core
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.16.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.16.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: spyke
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|