synapse_payments 0.9.0 → 0.10.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
  SHA1:
3
- metadata.gz: 6e19445a449894bb263dbefc9ec9de55a269a78d
4
- data.tar.gz: ba81c9bf397d457d2bba4c5b071553e0ef096739
3
+ metadata.gz: 47e1470165a16740934597afc37166a114f3f0af
4
+ data.tar.gz: b3a30a3698fd799720b62b1306c24232f9cae76d
5
5
  SHA512:
6
- metadata.gz: 864733c89e1c880ff0113b72c4abf273eb4fb9cf297687b7f6d452a5a4a2566e2c0a28a13a8f18baeff96d5b56c81c3e064c82b93d9bdc45b8ccc8e3994b4bff
7
- data.tar.gz: d6bc784aea3c72536b427f886349ebd450a99291b1cdd1cbaefd0c0c5d6f03d56472ea44f944956398989410a2acf79f7d939f1b8db4ec8bafd70b6b041ac8d0
6
+ metadata.gz: 79fe5926d304821e18201f7b967593199c9bb794a4ac5f109fcaa75604390b1cd0db47ccb99c323c65e6c4629ee68a973dc5b23e853bccda47ee40e6f3688925
7
+ data.tar.gz: 6818b4254d7c6f91dbf2067ed443d7089a5c09a91f797e060077986bc305e7e428bb455d9b126386220f40f88371feb19e16ea35ca3676404fe18d556338c543
@@ -53,8 +53,8 @@ module SynapsePayments
53
53
  Request.new(client: self, method: :get, path: path, oauth_key: oauth_key, fingerprint: fingerprint).perform
54
54
  end
55
55
 
56
- def post(path:, json:, oauth_key: nil, fingerprint: nil)
57
- Request.new(client: self, method: :post, path: path, oauth_key: oauth_key, fingerprint: fingerprint, json: json).perform
56
+ def post(path:, json:, oauth_key: nil, fingerprint: nil, idempotency_key: nil)
57
+ Request.new(client: self, method: :post, path: path, oauth_key: oauth_key, fingerprint: fingerprint, json: json, idempotency_key: idempotency_key).perform
58
58
  end
59
59
 
60
60
  def patch(path:, json:, oauth_key: nil, fingerprint: nil)
@@ -7,13 +7,14 @@ module SynapsePayments
7
7
  'X-Ruby-Platform' => RUBY_PLATFORM
8
8
  }
9
9
 
10
- def initialize(client:, method:, path:, oauth_key: nil, fingerprint: nil, json: nil)
10
+ def initialize(client:, method:, path:, oauth_key: nil, fingerprint: nil, json: nil, idempotency_key: nil)
11
11
  @client = client
12
12
  @method = method
13
13
  @path = path
14
14
  @oauth_key = oauth_key
15
15
  @fingerprint = fingerprint
16
16
  @json = json
17
+ @idempotency_key = idempotency_key
17
18
  end
18
19
 
19
20
  def perform
@@ -31,6 +32,11 @@ module SynapsePayments
31
32
  'X-SP-USER' => "#{@oauth_key}|#{@fingerprint}",
32
33
  'X-SP-USER-IP' => ''
33
34
  })
35
+
36
+ if !@idempotency_key.nil?
37
+ headers = headers.merge({ 'X-SP-IDEMPOTENCY-KEY' => @idempotency_key })
38
+ end
39
+
34
40
  HTTP.headers(headers).accept(:json).timeout(@client.timeout_options)
35
41
  end
36
42
 
@@ -13,7 +13,7 @@ module SynapsePayments
13
13
  @client.get(path: "/users/#{@user_id}/nodes/#{@node_id}/trans", oauth_key: @oauth_key, fingerprint: @fingerprint)
14
14
  end
15
15
 
16
- def create(node_id:, node_type:, amount:, currency:, ip_address:, **args)
16
+ def create(node_id:, node_type:, amount:, currency:, ip_address:, idempotency_key: nil, **args)
17
17
  data = {
18
18
  to: {
19
19
  type: node_type,
@@ -28,7 +28,7 @@ module SynapsePayments
28
28
 
29
29
  data = data.merge(fees: args[:fees]) if args[:fees]
30
30
 
31
- @client.post(path: "/users/#{@user_id}/nodes/#{@node_id}/trans", oauth_key: @oauth_key, fingerprint: @fingerprint, json: data)
31
+ @client.post(path: "/users/#{@user_id}/nodes/#{@node_id}/trans", oauth_key: @oauth_key, fingerprint: @fingerprint, json: data, idempotency_key: idempotency_key)
32
32
  end
33
33
 
34
34
  def delete(id)
@@ -1,3 +1,3 @@
1
1
  module SynapsePayments
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synapse_payments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Julio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-05-10 00:00:00.000000000 Z
11
+ date: 2016-07-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  requirements: []
175
175
  rubyforge_project:
176
- rubygems_version: 2.5.0
176
+ rubygems_version: 2.6.4
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: A tested Ruby interface to the SynapsePay v3 API.