fmrest 0.16.0 → 0.17.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -10
  3. data/README.md +48 -6
  4. metadata +9 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ec213ebe845fe6b4e10e5cf54550d2a73fec05ac33fbeb5a9758b8f04327a8df
4
- data.tar.gz: 9313ec2d6b743a6355535736f5d1fe77656c3f1d5c2648c4dcc2de36d49347d5
3
+ metadata.gz: 2a0bfeddefc77d0886a2467dc654f86c3f57dc7bddd7c9806a05def5ab3e9f2d
4
+ data.tar.gz: 54728b6e690c7662194179f276b4bd6b144fcd7c503b6dc00847ef22f20ba562
5
5
  SHA512:
6
- metadata.gz: 406e098733ea1c945b18d6df1063be38d1e9826c68d58bf1b9ce7d47784b0b8949d4d581e9918182c883ba674f2fff1ce0d4bb5b2854587ff0a1dc3d77a76f2d
7
- data.tar.gz: c6e29a0b3f63adc1bb2c5c03a6c5f0a2eadb6ed4ae864159b9d504f77b1848ed51a94e6d1ca8aeb4abed8f36a08d58a99d4c66bfff04f56e227e4b117bb4e97e
6
+ metadata.gz: 269d71d9075cef8ae7316ac949f8b79a0c659b20b467abb9b0aada27e53c40254658f5a302c16ac91a88ed924f8e3b5ff4233869285ea90f4b4c4a927dfc41dd
7
+ data.tar.gz: cb5d5be9d66ebdaa92f283b22ce600458c08b85f0c91f482dd41b9b2751aad170942533db910a41128964e99ee94a3533f0b4b50936736c5147c74568b998306
data/CHANGELOG.md CHANGED
@@ -1,13 +1,19 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.17.0
4
+
5
+ * Added support for Claris ID token login
6
+ * Added ability to use procs in settings
7
+ * Added `Rescuable` mixin
8
+
3
9
  ### 0.16.0
4
10
 
5
- * Add `FmRest.logger=`
11
+ * Added `FmRest.logger=`
6
12
  * Handle serialization of `nil`, `true` and `false` values
7
13
 
8
14
  ### 0.15.2
9
15
 
10
- * Fix autoloading of `FmRest::Layout`
16
+ * Fixed autoloading of `FmRest::Layout`
11
17
 
12
18
  ### 0.15.0
13
19
 
@@ -23,13 +29,13 @@
23
29
 
24
30
  ### 0.13.1
25
31
 
26
- * Fix downloading of container field data from FMS19+
32
+ * Fixed downloading of container field data from FMS19+
27
33
 
28
34
  ### 0.13.0
29
35
 
30
36
  * Split `fmrest` gem into `fmrest-core` and `fmrest-spyke`. `fmrest` becomes a
31
37
  wrapper for the two new gems.
32
- * Fix bug preventing connection databases with spaces in their names.
38
+ * Fixed bug preventing connection databases with spaces in their names.
33
39
  * Improved portal support with ability to delete portal records, and better
34
40
  refreshing of portal records after saving the parent.
35
41
  * `FmRest::Spyke::Base#__record_id` and `FmRest::Spyke::Base#__mod_id` now
@@ -44,7 +50,7 @@
44
50
 
45
51
  ### 0.11.1
46
52
 
47
- * Fix a couple crashes due to missing constants
53
+ * Fixed a couple crashes due to missing constants
48
54
 
49
55
  ### 0.11.0
50
56
 
@@ -59,7 +65,7 @@
59
65
 
60
66
  ### 0.10.1
61
67
 
62
- * Fix `URI.escape` obsolete warning messages in Ruby 2.7 by replacing it with
68
+ * Fixed `URI.escape` obsolete warning messages in Ruby 2.7 by replacing it with
63
69
  `URI.encode_www_form_component`
64
70
  ([PR#40](https://github.com/beezwax/fmrest-ruby/pull/40))
65
71
 
@@ -133,20 +139,20 @@
133
139
 
134
140
  ### 0.3.2
135
141
 
136
- * Fix support for ActiveSupport < 5.2
142
+ * Fixed support for ActiveSupport < 5.2
137
143
  ([#27](https://github.com/beezwax/fmrest-ruby/issues/27))
138
144
 
139
145
  ### 0.3.0
140
146
 
141
- * Add Moneta token store
147
+ * Added Moneta token store
142
148
 
143
149
  ### 0.2.5
144
150
 
145
- * Fix crash in `fetch_container_data` when no proxy options were set
151
+ * Fixed crash in `fetch_container_data` when no proxy options were set
146
152
 
147
153
  ### 0.2.4
148
154
 
149
155
  * Use `String#=~` instead of `String#match?` for Ruby <2.4 compatibility (Fixes
150
156
  [#26](https://github.com/beezwax/fmrest-ruby/issues/26))
151
- * Deprecate `FmRest.config` in favor of `FmRest.default_connection_settings`
157
+ * Deprecated `FmRest.config` in favor of `FmRest.default_connection_settings`
152
158
  * Honor Faraday SSL and proxy settings when fetching container files
data/README.md CHANGED
@@ -125,6 +125,10 @@ The minimum required connection settings are `:host`, `:database`, `:username`
125
125
  and `:password`, but fmrest-ruby has many other options you can pass when
126
126
  setting up a connection (see [full list](#full-list-of-available-options) below).
127
127
 
128
+ If you're using FileMaker Cloud you may need to pass `:fmid_token` instead
129
+ of the regular `:username` and `:password`. See the [main document on
130
+ connecting to FileMaker Cloud](docs/FileMakerCloud.md) for more info.
131
+
128
132
  `:ssl` and `:proxy` are forwarded to the underlying
129
133
  [Faraday](https://github.com/lostisland/faraday) connection. You can use this
130
134
  to, for instance, disable SSL verification:
@@ -149,6 +153,7 @@ Option | Description | Format
149
153
  `:username` | A Data API-ready account | String | None
150
154
  `:password` | Your password | String | None
151
155
  `:account_name` | Alias of `:username` | String | None
156
+ `:fmid_token` | Claris ID token (only needed for FileMaker Cloud) | String | None
152
157
  `:ssl` | SSL options to be forwarded to Faraday | Faraday SSL options | None
153
158
  `:proxy` | Proxy options to be forwarded to Faraday | Faraday proxy options | None
154
159
  `:log` | Log JSON responses to STDOUT | Boolean | `false`
@@ -283,10 +288,12 @@ Also, if not set, your model will try to use
283
288
  #### Connection settings overlays
284
289
 
285
290
  There may be cases where you want to use a different set of connection settings
286
- depending on context. For example, if you want to use username and password
287
- provided by the user in a web application. Since `.fmrest_config`
288
- is set at the class level, changing the username/password for the model in one
289
- context would also change it in all other contexts, leading to security issues.
291
+ depending on context, or simply change the connection settings over time. For
292
+ example, if you want to use username and password provided by the user in a web
293
+ application, or if you're connecting using an expiring Claris ID token. Since
294
+ `.fmrest_config` is set at the class level, changing the username/password for
295
+ the model in one context would also change it in all other contexts, leading to
296
+ security issues.
290
297
 
291
298
  To solve this scenario, fmrest-ruby provides a way of defining thread-local and
292
299
  reversible connection settings overlays through
@@ -323,7 +330,7 @@ Requests a Data API session token using the connection settings in
323
330
 
324
331
  You normally don't need to use this method as fmrest-ruby will automatically
325
332
  request and store session tokens for you (provided that `:autologin` is
326
- `true`).
333
+ `true` in the connection settings, which it is by default).
327
334
 
328
335
  ### FmRest::Layout.logout
329
336
 
@@ -452,6 +459,41 @@ field values on the database that model is configured for.
452
459
  See the [main document on setting global field values](docs/GlobalFields.md)
453
460
  for details.
454
461
 
462
+ ### Rescuable mixin
463
+
464
+ Sometimes you may want to handle Data API errors at the model level. For
465
+ instance, if you're logging in to a file hosted by FileMaker Cloud using a
466
+ Claris ID token, and you want to be able to renew said token when it fails to
467
+ log you in. For such cases fmrest-ruby provides an off-by-default mixin called
468
+ `Rescuable` that provides convenience macros for that. If you've used Ruby on
469
+ Rails you may be familiar with its syntax from controllers. E.g.
470
+
471
+ ```ruby
472
+ class BeeBase < FmRest::Layout
473
+ include FmRest::Spyke::Model::Rescuable
474
+
475
+ rescue_from FmRest::APIError::SystemError, with: :notify_admin_of_system_error
476
+
477
+ # Shorthand for rescue_with FmRest::APIError::AccountError, ...
478
+ rescue_account_error { ClarisIDTokenManager.expire_token }
479
+
480
+ def self.notify_admin_of_system_error(e)
481
+ # Shoot an email to the FM admin...
482
+ end
483
+ end
484
+ ```
485
+
486
+ Since `Rescuable` uses `ActiveSupport::Rescuable` internally, you may want to
487
+ check [Rails'
488
+ documentation](https://api.rubyonrails.org/classes/ActiveSupport/Rescuable/ClassMethods.html)
489
+ too for details on how it works.
490
+
491
+ One caveat of using `rescue_from` is that it always catches exceptions at the
492
+ class level, so if you pass a method name to `with:` that method has to be a
493
+ class method. Also note that this will only catch exceptions raised during an
494
+ API call to the Data API server (in other words, only on actions that perform
495
+ an HTTP request).
496
+
455
497
  ## Logging
456
498
 
457
499
  If using `fmrest-spyke` with Rails then pretty log output will be set up for
@@ -510,7 +552,7 @@ FM Data API reference: https://fmhelp.filemaker.com/docs/18/en/dataapi/
510
552
  | Log in using HTTP Basic Auth | Yes | Yes |
511
553
  | Log in using OAuth | No | No |
512
554
  | Log in to an external data source | No | No |
513
- | Log in using a FileMaker ID account | No | No |
555
+ | Log in using Claris ID account | Yes | Yes |
514
556
  | Log out | Yes | Yes |
515
557
  | Get product information | Manual* | No |
516
558
  | Get database names | Manual* | No |
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fmrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.17.0.rc1
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-14 00:00:00.000000000 Z
11
+ date: 2021-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fmrest-core
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 0.16.0
19
+ version: 0.17.0.rc1
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.16.0
26
+ version: 0.17.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fmrest-spyke
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 0.16.0
33
+ version: 0.17.0.rc1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 0.16.0
40
+ version: 0.17.0.rc1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -273,11 +273,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
273
273
  version: '0'
274
274
  required_rubygems_version: !ruby/object:Gem::Requirement
275
275
  requirements:
276
- - - ">="
276
+ - - ">"
277
277
  - !ruby/object:Gem::Version
278
- version: '0'
278
+ version: 1.3.1
279
279
  requirements: []
280
- rubygems_version: 3.0.6
280
+ rubygems_version: 3.2.3
281
281
  signing_key:
282
282
  specification_version: 4
283
283
  summary: FileMaker Data API client