shift4 2.0.0 → 2.1.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: '07539d434b346dfb29dac676752d4092b16d0eb8505256892faf077305a80db3'
4
- data.tar.gz: 633888e89d127192b15f2d68708d914d34a4bb090e8e1f2c55dc39d003fbaee9
3
+ metadata.gz: 7de9e08271e1c5ba30a77d0b1c042b2d2c4d77dfe5abcc2575ccdf48edb1cc7f
4
+ data.tar.gz: a8703f50147daade03309a81d3be80dadd0e054661e3de87b1e1fe025d0ff885
5
5
  SHA512:
6
- metadata.gz: 2a3f1da475ce49f70a83ac114efa899d3c06445c3f5305aec46b37f3f3729a02a41f34464d3669ca1f09a110e771cbfb920eed6b39bced3b3dc7092d245ae31b
7
- data.tar.gz: e353e59012771baa7173df0e62ca1cc9d57a9d0aa076fbf98e0209749dae0203414bde1f6896c3612ce9f6b8d769e29552313f70b3fa4235fa9cd9f07f6500d2
6
+ metadata.gz: ff5e87306468578452ad0598a7a7cdd120cddcc8e57057d67c45fe263a86b390e5af2c24154e19ad5ad42fa80072017e688c2c359ec944a470ba3efaa5211096
7
+ data.tar.gz: b8cd9e6d74effd4c6adc6839fee5fab4d12a9fb57b6aa79a65d292322a64352046fd153fd3127d2f4090d4c27dda1d71df3d41f077abc1fc72fa4ac0d78ddcec
@@ -34,6 +34,9 @@ module Shift4
34
34
  "Accept" => "application/json",
35
35
  }
36
36
  headers["Shift4-Merchant"] = config.merchant unless config.merchant.nil?
37
+ if config.is_a?(RequestOptions) && !config.idempotency_key.nil?
38
+ headers["Idempotency-Key"] = config.idempotency_key
39
+ end
37
40
 
38
41
  if json
39
42
  raise ArgumentError("Cannot specify both body and json") if body
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Shift4
4
+ class RequestOptions < Configuration
5
+ class << self
6
+ attr_reader :idempotency_key
7
+ end
8
+
9
+ def initialize(
10
+ config = Configuration,
11
+ idempotency_key: nil
12
+ )
13
+ super(
14
+ secret_key: config.secret_key,
15
+ merchant: config.merchant,
16
+ api_url: config.api_url,
17
+ uploads_url: config.uploads_url
18
+ )
19
+ @idempotency_key = idempotency_key
20
+ end
21
+
22
+ attr_reader :idempotency_key
23
+ end
24
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Shift4
4
- VERSION = '2.0.0'
4
+ VERSION = '2.1.0'
5
5
  end
data/lib/shift4.rb CHANGED
@@ -17,6 +17,7 @@ require 'shift4/file_uploads'
17
17
  require 'shift4/fraud_warnings'
18
18
  require 'shift4/payment_methods'
19
19
  require 'shift4/plans'
20
+ require 'shift4/request_options'
20
21
  require 'shift4/subscriptions'
21
22
  require 'shift4/tokens'
22
23
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shift4
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shift4
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-11-09 00:00:00.000000000 Z
11
+ date: 2024-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -186,6 +186,7 @@ files:
186
186
  - lib/shift4/fraud_warnings.rb
187
187
  - lib/shift4/payment_methods.rb
188
188
  - lib/shift4/plans.rb
189
+ - lib/shift4/request_options.rb
189
190
  - lib/shift4/shift4_pay_exception.rb
190
191
  - lib/shift4/subscriptions.rb
191
192
  - lib/shift4/tokens.rb
@@ -210,7 +211,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
211
  - !ruby/object:Gem::Version
211
212
  version: '0'
212
213
  requirements: []
213
- rubygems_version: 3.4.10
214
+ rubygems_version: 3.5.11
214
215
  signing_key:
215
216
  specification_version: 4
216
217
  summary: Shift4 Ruby Gem