fmrest-core 0.18.0.rc3 → 0.18.0
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 +3 -0
- data/lib/fmrest/v1/connection.rb +2 -2
- data/lib/fmrest/v1/raise_errors.rb +11 -0
- data/lib/fmrest/v1/token_session.rb +4 -1
- data/lib/fmrest/v1/type_coercer.rb +1 -1
- data/lib/fmrest/version.rb +1 -1
- 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: fdfc316e5474cc3abbf196051aa48846f6b04452e0864a320445079a09a3f449
|
4
|
+
data.tar.gz: d23a6c290f33ab9c43f149de58af85825859aae9f0bc781200395bc883f66009
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48ddb1505f075011675b5bfbeb437d42e70dff62912a6c44b0ac454c205332e8e61da6a628c0ae0cda095214d54dded125f8f98fa0af711d2e8e34b1d24332e1
|
7
|
+
data.tar.gz: 16623334ee707adb60e479d6db8bff23f22aa23cac397e32b839d4dceaa7aed4a2e94558684d08b1eaaa1fb008093b9628014a73b8b7dbe93f3d2cd1bc3498fc
|
data/CHANGELOG.md
CHANGED
@@ -7,6 +7,9 @@
|
|
7
7
|
* Defining an attribute on a model that would collide with an existing method
|
8
8
|
now raises an error
|
9
9
|
* Cleared Faraday deprecation messages on authentication methods
|
10
|
+
* Handle FileMaker Cloud case where HTTP 401 Unauthorized with content-type
|
11
|
+
text/html is returned after token expiry
|
12
|
+
* Add retry option to Rescuable mixin
|
10
13
|
* Added fmrest-ruby/VERSION to User-Agent headers
|
11
14
|
|
12
15
|
### 0.17.1
|
data/lib/fmrest/v1/connection.rb
CHANGED
@@ -39,7 +39,7 @@ module FmRest
|
|
39
39
|
yield conn, settings
|
40
40
|
else
|
41
41
|
conn.use TypeCoercer, settings
|
42
|
-
conn.response :json
|
42
|
+
conn.response :json, content_type: /\bjson$/
|
43
43
|
end
|
44
44
|
|
45
45
|
if settings.log
|
@@ -70,7 +70,7 @@ module FmRest
|
|
70
70
|
conn.response :logger, FmRest.logger, bodies: true, headers: true, log_level: settings.log_level
|
71
71
|
end
|
72
72
|
|
73
|
-
conn.response :json
|
73
|
+
conn.response :json, content_type: /\bjson$/
|
74
74
|
conn.adapter Faraday.default_adapter
|
75
75
|
end
|
76
76
|
end
|
@@ -27,6 +27,17 @@ module FmRest
|
|
27
27
|
}.freeze
|
28
28
|
|
29
29
|
def on_complete(env)
|
30
|
+
# Sometimes, especially when using FileMaker Cloud, a failed
|
31
|
+
# authorization request will return a 401 (Unauthorized) with text/html
|
32
|
+
# content-type instead of the regular JSON, so we need to catch it
|
33
|
+
# manually here, emulating a regular account error
|
34
|
+
if !(/\bjson$/ === env.response_headers["content-type"]) && env.status == 401
|
35
|
+
raise FmRest::APIError::AccountError.new(212, "Authentication failed (HTTP 401: Unauthorized)")
|
36
|
+
end
|
37
|
+
|
38
|
+
# From this point on we want JSON
|
39
|
+
return unless env.body.is_a?(Hash)
|
40
|
+
|
30
41
|
# Sniff for either straight JSON parsing or Spyke's format
|
31
42
|
if env.body[:metadata] && env.body[:metadata][:messages]
|
32
43
|
check_errors(env.body[:metadata][:messages])
|
@@ -132,7 +132,10 @@ module FmRest
|
|
132
132
|
end
|
133
133
|
|
134
134
|
def auth_connection
|
135
|
-
|
135
|
+
# NOTE: this is purposely not memoized so that settings can be
|
136
|
+
# refreshed (since proc-based settings will not be automatically
|
137
|
+
# re-eval'd, for example for fmid_token-based auth)
|
138
|
+
V1.auth_connection(@settings)
|
136
139
|
end
|
137
140
|
end
|
138
141
|
end
|
data/lib/fmrest/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fmrest-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.0
|
4
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pedro Carbajal
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-09-
|
11
|
+
date: 2021-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -104,9 +104,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
104
|
version: '0'
|
105
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
106
106
|
requirements:
|
107
|
-
- - "
|
107
|
+
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version:
|
109
|
+
version: '0'
|
110
110
|
requirements: []
|
111
111
|
rubygems_version: 3.2.3
|
112
112
|
signing_key:
|