fmrest-spyke 0.23.1 → 0.24.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4e30c2055c096479e79ba9c5d4fd2d5376ba854b9295cb8936e81a86fc4e231
4
- data.tar.gz: d18a1d36aca81732e4e90d67a13575d5e891f6504e48f8e7df529d23acaf576d
3
+ metadata.gz: ebd19342bbf84f1a13e8aacb58af0479f085b0b67712e5dc7feb67b94b8f0372
4
+ data.tar.gz: bf58fdb4882b2dacf66d03768d50134be239239e7221af91e27a2350613f06a2
5
5
  SHA512:
6
- metadata.gz: 4e1748cc9448aa032c4683ba809a7298e3f6a9ef4530ac7811ee0d24cabe9911ddd447f4773af06919a5bbb0c08fd85ae4e5908ee14f87f88f7fd6ae7778e05c
7
- data.tar.gz: b8e6828dcf31aeb7a6443483d560e529833606b0a55e2454532db855d4d3bef9e4357aaa3c1bff073015df0d2370047826ba38f555631ed9a0ac8f4add2a9609
6
+ metadata.gz: ae8b64ca0398e4e6d49dd5d0c6660c8674614bc36590d40a5e62e67f1c062a4b84789bb48f01c6aad9850a99790ef6373071743ad5db6df1d703d8a5a2af9edf
7
+ data.tar.gz: c96aa5a722e4f9a099d3a3c82be5c3f0d431f62364f3e4a2670334f912ce657a237c7ffe87e03cd6c8ecef8b7c43378c26b376cf3595ee3395d6e9ca49f30667
data/README.md CHANGED
@@ -469,6 +469,36 @@ class method. Also note that this will only catch exceptions raised during an
469
469
  API call to the Data API server (in other words, only on actions that perform
470
470
  an HTTP request).
471
471
 
472
+ ### Optional `modId`
473
+
474
+ The Data API provides an optional `modId` value that gets set on a record every
475
+ time you fetch or update it. This value then gets included in the API request
476
+ when you save the record, and FileMaker compares it against the current value,
477
+ preventing the update in case of a mismatch.
478
+
479
+ This safety feature is enabled by default in `fmrest-spyke` models, but you can
480
+ disable it using the inheritable `ignore_mod_id` flag on your model classes or
481
+ instances. E.g.
482
+
483
+ ```ruby
484
+ class Bee < FmRest::Layout
485
+ # This disables modId for all instances and subclasses
486
+ self.ignore_mod_id = true
487
+ end
488
+
489
+ # Or set it on instances:
490
+ bee = Bee.new
491
+ bee.ignore_mod_id # => true (set in class)
492
+ bee.ignore_mod_id = false # (affects only this instance)
493
+ ```
494
+
495
+ You can also set it directly on `FmRest::Layout` if you want to disable it for
496
+ your entire app:
497
+
498
+ ```ruby
499
+ FmRest::Layout.ignore_mod_id = true
500
+ ```
501
+
472
502
  ## Logging
473
503
 
474
504
  If using `fmrest-spyke` with Rails then pretty log output will be set up for
@@ -4,6 +4,16 @@ module FmRest
4
4
  module Spyke
5
5
  module Model
6
6
  module Serialization
7
+ extend ::ActiveSupport::Concern
8
+
9
+ included do
10
+ # Set this flag to `true` to prevent sending modId with update
11
+ # requests, as it's optional in the Data API specs.
12
+ # Note that `class_attribute` provides an instance-level attribute
13
+ # too that can override the class-level one (without modifying it)
14
+ class_attribute :ignore_mod_id
15
+ end
16
+
7
17
  # Spyke override -- Return FM Data API's expected JSON format,
8
18
  # including only modified fields.
9
19
  #
@@ -12,7 +22,7 @@ module FmRest
12
22
  fieldData: serialize_values!(changed_params_not_embedded_in_url).merge(serialize_portal_deletions)
13
23
  }
14
24
 
15
- params[:modId] = __mod_id.to_s if __mod_id
25
+ params[:modId] = __mod_id.to_s if __mod_id && !ignore_mod_id?
16
26
 
17
27
  portal_data = serialize_portals
18
28
 
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.23.1
4
+ version: 0.24.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: 2022-07-14 00:00:00.000000000 Z
11
+ date: 2022-10-12 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.23.1
19
+ version: 0.24.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.23.1
26
+ version: 0.24.0.rc1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: spyke
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -88,9 +88,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
- - - ">="
91
+ - - ">"
92
92
  - !ruby/object:Gem::Version
93
- version: '0'
93
+ version: 1.3.1
94
94
  requirements: []
95
95
  rubygems_version: 3.3.3
96
96
  signing_key: