fmrest 0.15.2 → 0.17.1

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 +24 -9
  3. data/README.md +61 -8
  4. metadata +7 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a521c338828739448e5bd15308c97d5b099fe0c2684728479f93f10125d93892
4
- data.tar.gz: 613f16988c9b1d3516088a4b699171819e6fc6531ae9bb383bdaba6074a68020
3
+ metadata.gz: eba546b2278479156c5d78e0ea73061377984f74cfb816032fd8782abcf7901c
4
+ data.tar.gz: f47068cca3c6deb74b99218c6bde372c55a4ef8dbaa700df3bea11746ddbc3e9
5
5
  SHA512:
6
- metadata.gz: 148467a2ef5570c06605eb94bd2d604e3303062428f218f3c6706483e68c6ec8098b7e6c9214f219b87b10126ec73c627ca4c5ca91974dd4e323446f2436f1ae
7
- data.tar.gz: cb382ee99672a58d215d00398a98c44be9ef840b5b9853f94edfb3c5c58c770f02245baf95545f0732c61c44342126ac314b698293622e8f1ad52aa67fb554ca
6
+ metadata.gz: e3a9812d838849f532fd216509a37c4f620cb740c9eddebe858b74cdf2b7df2bbc26e83805f7a953824806539d755d328f702b1cdba394e076878780ff0e6093
7
+ data.tar.gz: 9a676712ecd39a4bd952d6300d93826d0dc1e258bbc0877766d8fee348762c319f004a8d4fc5783f36b5e29c512c7da77201b12876503775c984e3975e3f1792
data/CHANGELOG.md CHANGED
@@ -1,8 +1,23 @@
1
1
  ## Changelog
2
2
 
3
+ ### 0.17.1
4
+
5
+ * Fixed crash when `fmid_token` is set but `username` isn't
6
+
7
+ ### 0.17.0
8
+
9
+ * Added support for Claris ID token login
10
+ * Added ability to use procs in settings
11
+ * Added `Rescuable` mixin
12
+
13
+ ### 0.16.0
14
+
15
+ * Added `FmRest.logger=`
16
+ * Handle serialization of `nil`, `true` and `false` values
17
+
3
18
  ### 0.15.2
4
19
 
5
- * Fix autoloading of `FmRest::Layout`
20
+ * Fixed autoloading of `FmRest::Layout`
6
21
 
7
22
  ### 0.15.0
8
23
 
@@ -18,13 +33,13 @@
18
33
 
19
34
  ### 0.13.1
20
35
 
21
- * Fix downloading of container field data from FMS19+
36
+ * Fixed downloading of container field data from FMS19+
22
37
 
23
38
  ### 0.13.0
24
39
 
25
40
  * Split `fmrest` gem into `fmrest-core` and `fmrest-spyke`. `fmrest` becomes a
26
41
  wrapper for the two new gems.
27
- * Fix bug preventing connection databases with spaces in their names.
42
+ * Fixed bug preventing connection databases with spaces in their names.
28
43
  * Improved portal support with ability to delete portal records, and better
29
44
  refreshing of portal records after saving the parent.
30
45
  * `FmRest::Spyke::Base#__record_id` and `FmRest::Spyke::Base#__mod_id` now
@@ -39,7 +54,7 @@
39
54
 
40
55
  ### 0.11.1
41
56
 
42
- * Fix a couple crashes due to missing constants
57
+ * Fixed a couple crashes due to missing constants
43
58
 
44
59
  ### 0.11.0
45
60
 
@@ -54,7 +69,7 @@
54
69
 
55
70
  ### 0.10.1
56
71
 
57
- * Fix `URI.escape` obsolete warning messages in Ruby 2.7 by replacing it with
72
+ * Fixed `URI.escape` obsolete warning messages in Ruby 2.7 by replacing it with
58
73
  `URI.encode_www_form_component`
59
74
  ([PR#40](https://github.com/beezwax/fmrest-ruby/pull/40))
60
75
 
@@ -128,20 +143,20 @@
128
143
 
129
144
  ### 0.3.2
130
145
 
131
- * Fix support for ActiveSupport < 5.2
146
+ * Fixed support for ActiveSupport < 5.2
132
147
  ([#27](https://github.com/beezwax/fmrest-ruby/issues/27))
133
148
 
134
149
  ### 0.3.0
135
150
 
136
- * Add Moneta token store
151
+ * Added Moneta token store
137
152
 
138
153
  ### 0.2.5
139
154
 
140
- * Fix crash in `fetch_container_data` when no proxy options were set
155
+ * Fixed crash in `fetch_container_data` when no proxy options were set
141
156
 
142
157
  ### 0.2.4
143
158
 
144
159
  * Use `String#=~` instead of `String#match?` for Ruby <2.4 compatibility (Fixes
145
160
  [#26](https://github.com/beezwax/fmrest-ruby/issues/26))
146
- * Deprecate `FmRest.config` in favor of `FmRest.default_connection_settings`
161
+ * Deprecated `FmRest.config` in favor of `FmRest.default_connection_settings`
147
162
  * 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,9 +153,11 @@ 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`
160
+ `:log_level` | Which log level to log into | Values accepted by `Logger#level=` | `:debug`
155
161
  `:coerce_dates` | See section on [date fields](#date-fields-and-timezones) | Boolean \| `:hybrid` \| `:full` | `false`
156
162
  `:date_format` | Date parsing format | String (FM date format) | `"MM/dd/yyyy"`
157
163
  `:timestamp_format` | Timestmap parsing format | String (FM date format) | `"MM/dd/yyyy HH:mm:ss"`
@@ -282,10 +288,12 @@ Also, if not set, your model will try to use
282
288
  #### Connection settings overlays
283
289
 
284
290
  There may be cases where you want to use a different set of connection settings
285
- depending on context. For example, if you want to use username and password
286
- provided by the user in a web application. Since `.fmrest_config`
287
- is set at the class level, changing the username/password for the model in one
288
- 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.
289
297
 
290
298
  To solve this scenario, fmrest-ruby provides a way of defining thread-local and
291
299
  reversible connection settings overlays through
@@ -322,7 +330,7 @@ Requests a Data API session token using the connection settings in
322
330
 
323
331
  You normally don't need to use this method as fmrest-ruby will automatically
324
332
  request and store session tokens for you (provided that `:autologin` is
325
- `true`).
333
+ `true` in the connection settings, which it is by default).
326
334
 
327
335
  ### FmRest::Layout.logout
328
336
 
@@ -451,13 +459,48 @@ field values on the database that model is configured for.
451
459
  See the [main document on setting global field values](docs/GlobalFields.md)
452
460
  for details.
453
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
+
454
497
  ## Logging
455
498
 
456
499
  If using `fmrest-spyke` with Rails then pretty log output will be set up for
457
500
  you automatically by Spyke (see [their
458
501
  README](https://github.com/balvig/spyke#log-output)).
459
502
 
460
- You can also enable simple Faraday STDOUT logging of raw requests (useful for
503
+ You can also enable simple Faraday logging of raw requests (useful for
461
504
  debugging) by passing `log: true` in the options hash for either
462
505
  `FmRest.default_connection_settings=` or your models' `fmrest_config=`, e.g.:
463
506
 
@@ -478,7 +521,17 @@ class LoggyBee < FmRest::Layout
478
521
  end
479
522
  ```
480
523
 
481
- If you need to set up more complex logging for your models can use the
524
+ You can also pass `log_level` to connection settings to change the severity of
525
+ log output (defaults to `:debug`).
526
+
527
+ By default fmrest-ruby logs to STDOUT or to Rails' logger object if available.
528
+ You can change this by providing your own logger object to `FmRest.logger=`:
529
+
530
+ ```ruby
531
+ FmRest.logger = Logger.new("fmrest.log")
532
+ ```
533
+
534
+ If you need to set up more complex logging for your models you can use the
482
535
  `faraday` block inside your class to inject your own logger middleware into the
483
536
  Faraday connection, e.g.:
484
537
 
@@ -499,7 +552,7 @@ FM Data API reference: https://fmhelp.filemaker.com/docs/18/en/dataapi/
499
552
  | Log in using HTTP Basic Auth | Yes | Yes |
500
553
  | Log in using OAuth | No | No |
501
554
  | Log in to an external data source | No | No |
502
- | Log in using a FileMaker ID account | No | No |
555
+ | Log in using Claris ID account | Yes | Yes |
503
556
  | Log out | Yes | Yes |
504
557
  | Get product information | Manual* | No |
505
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.15.2
4
+ version: 0.17.1
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-06 00:00:00.000000000 Z
11
+ date: 2021-08-29 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.15.2
19
+ version: 0.17.1
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.15.2
26
+ version: 0.17.1
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.15.2
33
+ version: 0.17.1
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.15.2
40
+ version: 0.17.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -277,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0'
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