fmrest-core 0.17.0 → 0.18.0.rc3
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 +13 -0
- data/README.md +4 -0
- data/lib/fmrest/v1/connection.rb +6 -5
- data/lib/fmrest/v1/raise_errors.rb +2 -3
- data/lib/fmrest/v1/token_session.rb +7 -1
- data/lib/fmrest/v1/utils.rb +14 -0
- 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: 9070ffa50e9886a1c1a46c91575c3252469ea22423bbc0658d0b4c86f325c1ac
|
4
|
+
data.tar.gz: 29b2bfef12c6352492aa3fbb5f19031aaf263e39dacc3e334bf6470df07de7e7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65ea5b666e2debed130714df05a9275e991e8127d17d44dbee94a4651a05394472ab1381e1bbf35551648234a6d3c6c174fcc4fe8025ec45148bcc27a5aef495
|
7
|
+
data.tar.gz: bfdc063f4701eb03ed3f8e2edc7c9b2131cb6cc82175c88462debdd67891050fd53dfa160f47f35323809d6860d4a89ec341d8116791cae6d4e69b900b7715af
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,18 @@
|
|
1
1
|
## Changelog
|
2
2
|
|
3
|
+
### 0.18.0
|
4
|
+
|
5
|
+
* Better support for portals with mismatching field qualifiers
|
6
|
+
* Better ergonomics for script execution, improved documentation
|
7
|
+
* Defining an attribute on a model that would collide with an existing method
|
8
|
+
now raises an error
|
9
|
+
* Cleared Faraday deprecation messages on authentication methods
|
10
|
+
* Added fmrest-ruby/VERSION to User-Agent headers
|
11
|
+
|
12
|
+
### 0.17.1
|
13
|
+
|
14
|
+
* Fixed crash when `fmid_token` is set but `username` isn't
|
15
|
+
|
3
16
|
### 0.17.0
|
4
17
|
|
5
18
|
* Added support for Claris ID token login
|
data/README.md
CHANGED
@@ -543,6 +543,10 @@ class LoggyBee < FmRest::Layout
|
|
543
543
|
end
|
544
544
|
```
|
545
545
|
|
546
|
+
## Gotchas
|
547
|
+
|
548
|
+
Read about unexpected scenarios in the [gotchas doc](docs/Gotchas.md).
|
549
|
+
|
546
550
|
## API implementation completeness table
|
547
551
|
|
548
552
|
FM Data API reference: https://fmhelp.filemaker.com/docs/18/en/dataapi/
|
data/lib/fmrest/v1/connection.rb
CHANGED
@@ -8,7 +8,8 @@ module FmRest
|
|
8
8
|
BASE_PATH = "/fmi/data/v1"
|
9
9
|
DATABASES_PATH = "#{BASE_PATH}/databases"
|
10
10
|
|
11
|
-
|
11
|
+
DEFAULT_HEADERS = { "User-Agent" => "fmrest-ruby/#{::FmRest::VERSION} Faraday/#{::Faraday::VERSION}" }.freeze
|
12
|
+
AUTH_CONNECTION_HEADERS = DEFAULT_HEADERS.merge("Content-Type" => "application/json").freeze
|
12
13
|
CLARIS_ID_HTTP_AUTH_TYPE = "FMID"
|
13
14
|
|
14
15
|
# Builds a complete DAPI Faraday connection with middleware already
|
@@ -21,7 +22,7 @@ module FmRest
|
|
21
22
|
def build_connection(settings = FmRest.default_connection_settings, &block)
|
22
23
|
settings = ConnectionSettings.wrap(settings)
|
23
24
|
|
24
|
-
base_connection(settings) do |conn|
|
25
|
+
base_connection(settings, headers: DEFAULT_HEADERS) do |conn|
|
25
26
|
conn.use RaiseErrors
|
26
27
|
conn.use TokenSession, settings
|
27
28
|
|
@@ -56,13 +57,13 @@ module FmRest
|
|
56
57
|
def auth_connection(settings = FmRest.default_connection_settings)
|
57
58
|
settings = ConnectionSettings.wrap(settings)
|
58
59
|
|
59
|
-
base_connection(settings,
|
60
|
+
base_connection(settings, headers: AUTH_CONNECTION_HEADERS) do |conn|
|
60
61
|
conn.use RaiseErrors
|
61
62
|
|
62
63
|
if settings.fmid_token?
|
63
|
-
conn.authorization CLARIS_ID_HTTP_AUTH_TYPE, settings.fmid_token
|
64
|
+
conn.request :authorization, CLARIS_ID_HTTP_AUTH_TYPE, settings.fmid_token
|
64
65
|
else
|
65
|
-
conn.basic_auth settings.username!, settings.password!
|
66
|
+
conn.request :basic_auth, settings.username!, settings.password!
|
66
67
|
end
|
67
68
|
|
68
69
|
if settings.log
|
@@ -5,10 +5,9 @@ module FmRest
|
|
5
5
|
# FM Data API response middleware for raising exceptions on API response
|
6
6
|
# errors
|
7
7
|
#
|
8
|
-
# https://fmhelp.filemaker.com/help/17/fmp/en/index.html#page/FMP_Help/error-codes.html
|
9
|
-
#
|
10
8
|
class RaiseErrors < Faraday::Response::Middleware
|
11
|
-
#
|
9
|
+
# Error codes reference:
|
10
|
+
# https://help.claris.com/en/pro-help/content/error-codes.html
|
12
11
|
ERROR_RANGES = {
|
13
12
|
-1 => APIError::UnknownError,
|
14
13
|
100 => APIError::ResourceMissingError,
|
@@ -100,7 +100,13 @@ module FmRest
|
|
100
100
|
# Strip the host part to just the hostname (i.e. no scheme or port)
|
101
101
|
host = @settings.host!
|
102
102
|
host = URI(host).hostname if host =~ /\Ahttps?:\/\//
|
103
|
-
|
103
|
+
identity_segment = if fmid_token = @settings.fmid_token
|
104
|
+
require "digest"
|
105
|
+
Digest::SHA256.hexdigest(fmid_token)
|
106
|
+
else
|
107
|
+
@settings.username!
|
108
|
+
end
|
109
|
+
"#{host}:#{@settings.database!}:#{identity_segment}"
|
104
110
|
end
|
105
111
|
end
|
106
112
|
|
data/lib/fmrest/v1/utils.rb
CHANGED
@@ -8,6 +8,8 @@ module FmRest
|
|
8
8
|
# See https://help.claris.com/en/pro-help/content/finding-text.html
|
9
9
|
FM_FIND_OPERATORS_RE = /([@\*#\?!=<>"])/
|
10
10
|
|
11
|
+
FULLY_QUALIFIED_FIELD_NAME_MATCHER = /\A[^:]+::[^:]+\Z/.freeze
|
12
|
+
|
11
13
|
# Converts custom script options to a hash with the Data API's expected
|
12
14
|
# JSON script format.
|
13
15
|
#
|
@@ -104,6 +106,18 @@ module FmRest
|
|
104
106
|
s.gsub(FM_FIND_OPERATORS_RE, "\\\\\\1")
|
105
107
|
end
|
106
108
|
|
109
|
+
# Returns whether the given FileMaker field name is a fully-qualified
|
110
|
+
# name. In other words, whether it contains the string "::".
|
111
|
+
#
|
112
|
+
# Note that this is a simple naive check which doesn't account for
|
113
|
+
# invalid field names.
|
114
|
+
#
|
115
|
+
# @param field_name [String] The field name to test
|
116
|
+
# @return [Boolean] Whether the field is a FQN
|
117
|
+
def is_fully_qualified?(field_name)
|
118
|
+
FULLY_QUALIFIED_FIELD_NAME_MATCHER === field_name.to_s
|
119
|
+
end
|
120
|
+
|
107
121
|
private
|
108
122
|
|
109
123
|
def convert_script_arguments(script_arguments, suffix = nil)
|
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.
|
4
|
+
version: 0.18.0.rc3
|
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-08
|
11
|
+
date: 2021-09-08 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: 1.3.1
|
110
110
|
requirements: []
|
111
111
|
rubygems_version: 3.2.3
|
112
112
|
signing_key:
|