commerce7-rails 0.2.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d17bdff3aaa4490b2fda29996b277c0947c5dcb6539d4bc02b8d81a63cb50fd0
4
- data.tar.gz: b16fc3cdc51a00bf3e8563283db63fbaf2bc14d5508831038cb26c155ca3ad6e
3
+ metadata.gz: 54a31ca6f73ce04f8fe8c32d673e781f53f34a6bab48220a907d57d0d9500a95
4
+ data.tar.gz: afb4810f89069ce03865b4fdb683c7b4d6778f1028dc49e8a7122db063755ea0
5
5
  SHA512:
6
- metadata.gz: 52f6b435f3044adf60b7210a78b1d0b69ccfaa018d126f89432a764875d55a4a370d50c87928a7f7e4024314b3c857a863e6ecc8512ce221c0f281065190ccd6
7
- data.tar.gz: b7160af777302983bc93d39308bcf63a9f4058c177d5e1ddf5b37be021522fcb69dc5d109cbaf12db86550a45e006c52e18d67c98c8e92cbd18df6e56a4f5b94
6
+ metadata.gz: 347fb156c387dc45af3bffff70be82bb3c25f4e67ad5cce37de1fc6203be66dbe834b3d780931986296457601158dba77f0bdb3cab867555e5ba228f8ec9e858
7
+ data.tar.gz: e2424555f6b6948f79fdd8f72cdee26a8997c10d2c93dafc51eac65226c6eac06122fd03d93a90f53ecb62a00f57ef6c487480158e364532f1eafffc2cd26e69
data/README.md CHANGED
@@ -4,11 +4,34 @@ Rails building blocks for building a [Commerce7](https://www.commerce7.com/) App
4
4
 
5
5
  This gem owns the Commerce7-protocol plumbing. Your app owns the business logic: your tenant model's own fields, what a webhook handler actually does, what your App Extension pages render.
6
6
 
7
+ ## Requirements
8
+
9
+ - Rails 8.1.4 or later
10
+ - Faraday 2.14.4 or later
11
+
12
+ Both floors date from v0.3.0. Earlier versions allowed Rails 7.1+ and any Faraday 2.x.
13
+
14
+ **Why:** `json` 3.0 changed the signature of `JSON.parse`, and older Rails and Faraday releases call it in ways it no longer accepts. Nothing in your app has to request `json` 3 for this to happen. It arrives as a transitive dependency (rubocop 1.91 pulls it in, for one), and neither Rails nor Faraday caps `json` below 3, so Bundler will happily resolve a combination that breaks at runtime. The floors rule those combinations out.
15
+
16
+ - **Faraday 2.14.3 and earlier:** the JSON response middleware breaks, so every Commerce7 REST client response raises `Faraday::ParsingError: wrong number of arguments (given 2, expected 1)`.
17
+ - **Rails before 8.1.4:** `ActiveSupport::JSON.decode` breaks, so every `json`/`jsonb` column read raises. That includes the `raw_activation_payload` column the install generator creates. How it fails depends on the Rails line:
18
+
19
+ | Rails | With `json` 3 |
20
+ |---|---|
21
+ | 7.1.x, 8.0.x | `ArgumentError: unknown keyword: quirks_mode` |
22
+ | 7.2.x | JSON decoding works |
23
+ | 8.1.0 to 8.1.3.x | `ArgumentError: wrong number of arguments (given 2, expected 1)` |
24
+ | 8.1.4 and later | Works |
25
+
26
+ A gemspec can't say "7.2.x or 8.1.4 and later", so the floor is 8.1.4.
27
+
28
+ If you're stuck on an older Rails, stay on v0.2.1 and pin `json` below 3 in your app's Gemfile (`gem "json", "~> 2.21"`).
29
+
7
30
  ## Install
8
31
 
9
32
  ```ruby
10
33
  # Gemfile
11
- gem "commerce7-rails", github: "ERCubed/commerce7-rails", tag: "v0.2.0"
34
+ gem "commerce7-rails", github: "ERCubed/commerce7-rails", tag: "v0.3.0"
12
35
  ```
13
36
 
14
37
  ```
@@ -18,15 +18,19 @@ module Commerce7
18
18
  # a cross-site iframe POST where the session cookie may not travel).
19
19
  protect_from_forgery with: :exception
20
20
 
21
- before_action :authenticate_staff!
22
-
23
21
  # Rails sends X-Frame-Options: SAMEORIGIN by default, which blocks
24
22
  # Commerce7's admin panel (a different origin) from framing this page at
25
23
  # all. Commerce7 doesn't publish a stable admin origin to scope a
26
24
  # replacement CSP frame-ancestors to, so this just drops the blanket
27
25
  # deny; a host app that wants a tighter CSP can add its own
28
26
  # frame-ancestors directive once that origin is confirmed.
29
- after_action { response.headers.delete("X-Frame-Options") }
27
+ #
28
+ # A before_action, declared ahead of authenticate_staff!, rather than an
29
+ # after_action: when auth fails, authenticate_staff! renders the error
30
+ # page and halts the chain, and after_actions never run — which left
31
+ # exactly the page staff most need to see blocked inside the iframe.
32
+ before_action { response.headers.delete("X-Frame-Options") }
33
+ before_action :authenticate_staff!
30
34
 
31
35
  rescue_from ActionController::ParameterMissing do |error|
32
36
  render plain: error.message, status: :bad_request
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Commerce7
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: commerce7-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Roberts
@@ -15,28 +15,28 @@ dependencies:
15
15
  requirements:
16
16
  - - ">="
17
17
  - !ruby/object:Gem::Version
18
- version: '7.1'
18
+ version: 8.1.4
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - ">="
24
24
  - !ruby/object:Gem::Version
25
- version: '7.1'
25
+ version: 8.1.4
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: faraday
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: '2.0'
32
+ version: 2.14.4
33
33
  type: :runtime
34
34
  prerelease: false
35
35
  version_requirements: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: '2.0'
39
+ version: 2.14.4
40
40
  description: Activation/deactivation lifecycle, webhook dispatch, App Extension staff-JWT
41
41
  auth, the Commerce7 REST client, and the post-uninstall data purge Commerce7's security
42
42
  review requires — configured once, reused across every Commerce7 app.