cloudpayments 0.4.1 → 0.4.2

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: 34375a70e47d3fe33b24b207d430db57bbfba877f195202931609ea0c7ea2e67
4
- data.tar.gz: 390825dcb308c8d90c79b270ec928a5fa9171beb4581011eb1eb98baf1784d1f
3
+ metadata.gz: 71c73a688527d0e855cb7e6de0e7a11d49faa9c89c070095a031c96bf9046b20
4
+ data.tar.gz: dca3f590fe26425a45e1f2cdf5ab49f5694489f3e3a0e2dc3e65dfb88d1f7fd8
5
5
  SHA512:
6
- metadata.gz: b5c07b9d0e5554d60b0385e2c26ffbe9e94b93a7f97e6e478bf88df2a0644713d260c96e5b185a298c1d6aa39607d62a74e1af7d0d8bcb9c2e765c29c05d9d6f
7
- data.tar.gz: 7388f1836c960801f449b924cd329f6ed1646684fcaeccc399daa8d4189d1c67d6179ffb7f8cefa72f5731f73d13771cb07b8909fd29b36fa8d7b544f259414d
6
+ metadata.gz: c413a93259ddec0788629d08594f1f1ba7e07b96b857b574f5696a2d004acda96569b27618de22fe2db18b71bd83d712356ea077c128b2cb2b5f429dce58f02d
7
+ data.tar.gz: '088d7087317264cd40e5e73c03ef146e363aad9622fe87b9b06b8244b5cd9616b8c4aec928405e5979b7ce9c07e2f3c717308a07421b63b10c5eef6cff852dd0'
@@ -4,8 +4,8 @@ module Cloudpayments
4
4
  class Base
5
5
  include Cloudpayments::Connection
6
6
 
7
- def self.call(*args, &block)
8
- response = new(*args, &block).call
7
+ def self.call(*args, **kwargs, &block)
8
+ response = new(*args, **kwargs, &block).call
9
9
  Cloudpayments::Client::Response::Base.new(response)
10
10
  end
11
11
  end
@@ -4,14 +4,15 @@ module Cloudpayments
4
4
  module Receipts
5
5
  module Correction
6
6
  class Create < Cloudpayments::Client::Request::Base
7
- attr_reader :params
7
+ attr_reader :params, :request_id
8
8
 
9
- def initialize(params)
9
+ def initialize(params, request_id: SecureRandom.uuid)
10
10
  @params = params
11
+ @request_id = request_id
11
12
  end
12
13
 
13
14
  def call
14
- post("kkt/correction-receipt", params)
15
+ post("kkt/correction-receipt", params, { "X-Request-ID" => request_id })
15
16
  end
16
17
  end
17
18
  end
@@ -4,14 +4,15 @@ module Cloudpayments
4
4
  module Receipts
5
5
  module Correction
6
6
  class Get < Cloudpayments::Client::Request::Base
7
- attr_reader :id
7
+ attr_reader :id, :request_id
8
8
 
9
- def initialize(id)
9
+ def initialize(id, request_id: SecureRandom.uuid)
10
10
  @id = id
11
+ @request_id = request_id
11
12
  end
12
13
 
13
14
  def call
14
- post("kkt/correction-receipt/get", { Id: id })
15
+ post("kkt/correction-receipt/get", { Id: id }, { "X-Request-ID" => request_id })
15
16
  end
16
17
  end
17
18
  end
@@ -4,14 +4,15 @@ module Cloudpayments
4
4
  module Receipts
5
5
  module Correction
6
6
  class GetStatus < Cloudpayments::Client::Request::Base
7
- attr_reader :id
7
+ attr_reader :id, :request_id
8
8
 
9
- def initialize(id)
9
+ def initialize(id, request_id: SecureRandom.uuid)
10
10
  @id = id
11
+ @request_id = request_id
11
12
  end
12
13
 
13
14
  def call
14
- post("kkt/correction-receipt/status/get", { Id: id })
15
+ post("kkt/correction-receipt/status/get", { Id: id }, { "X-Request-ID" => request_id })
15
16
  end
16
17
  end
17
18
  end
@@ -3,14 +3,15 @@ module Cloudpayments
3
3
  module Request
4
4
  module Receipts
5
5
  class Create < Cloudpayments::Client::Request::Base
6
- attr_reader :params
6
+ attr_reader :params, :request_id
7
7
 
8
- def initialize(params)
8
+ def initialize(params, request_id: SecureRandom.uuid)
9
9
  @params = params
10
+ @request_id = request_id
10
11
  end
11
12
 
12
13
  def call
13
- post("kkt/receipt", params)
14
+ post("kkt/receipt", params, { "X-Request-ID" => request_id })
14
15
  end
15
16
  end
16
17
  end
@@ -3,14 +3,15 @@ module Cloudpayments
3
3
  module Request
4
4
  module Receipts
5
5
  class Get < Cloudpayments::Client::Request::Base
6
- attr_reader :id
6
+ attr_reader :id, :request_id
7
7
 
8
- def initialize(id)
8
+ def initialize(id, request_id: SecureRandom.uuid)
9
9
  @id = id
10
+ @request_id = request_id
10
11
  end
11
12
 
12
13
  def call
13
- post("kkt/receipt/get", { Id: id })
14
+ post("kkt/receipt/get", { Id: id }, { "X-Request-ID" => request_id })
14
15
  end
15
16
  end
16
17
  end
@@ -3,14 +3,15 @@ module Cloudpayments
3
3
  module Request
4
4
  module Receipts
5
5
  class GetStatus < Cloudpayments::Client::Request::Base
6
- attr_reader :id
6
+ attr_reader :id, :request_id
7
7
 
8
- def initialize(id)
8
+ def initialize(id, request_id: SecureRandom.uuid)
9
9
  @id = id
10
+ @request_id = request_id
10
11
  end
11
12
 
12
13
  def call
13
- post("kkt/receipt/status/get", { Id: id })
14
+ post("kkt/receipt/status/get", { Id: id }, { "X-Request-ID" => request_id })
14
15
  end
15
16
  end
16
17
  end
@@ -1,15 +1,16 @@
1
1
  module Cloudpayments
2
2
  module Connection
3
- def post(path, data = {})
4
- request(:post, path, data)
3
+ def post(path, data = {}, headers = {})
4
+ request(:post, path, data, headers)
5
5
  end
6
6
 
7
7
  private
8
8
 
9
- def request(method, path, data)
9
+ def request(method, path, data, headers = {})
10
10
  connection.send(method) do |req|
11
11
  req.url path
12
12
  req.headers["Content-Type"] = "application/json"
13
+ req.headers.merge!(headers)
13
14
  req.body = data.to_json
14
15
  end
15
16
  end
@@ -0,0 +1,3 @@
1
+ module Cloudpayments
2
+ VERSION = "0.4.2"
3
+ end
data/lib/cloudpayments.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "faraday"
2
2
  require "json"
3
+ require "securerandom"
3
4
  require_relative "cloudpayments/configuration"
4
5
  require_relative "cloudpayments/connection"
5
6
  require_relative "cloudpayments/client/response/base"
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudpayments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Spiridonov
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-08-12 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: faraday
@@ -24,7 +23,6 @@ dependencies:
24
23
  - - "<"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '3'
27
- description:
28
26
  email: alex9spiridonov@gmail.com
29
27
  executables: []
30
28
  extensions: []
@@ -43,11 +41,11 @@ files:
43
41
  - lib/cloudpayments/client/response/body.rb
44
42
  - lib/cloudpayments/configuration.rb
45
43
  - lib/cloudpayments/connection.rb
44
+ - lib/cloudpayments/version.rb
46
45
  homepage: https://github.com/alex9spiridonov/cloudpayments
47
46
  licenses:
48
47
  - MIT
49
48
  metadata: {}
50
- post_install_message:
51
49
  rdoc_options: []
52
50
  require_paths:
53
51
  - lib
@@ -62,8 +60,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
62
60
  - !ruby/object:Gem::Version
63
61
  version: '0'
64
62
  requirements: []
65
- rubygems_version: 3.2.22
66
- signing_key:
63
+ rubygems_version: 3.6.9
67
64
  specification_version: 4
68
65
  summary: Сloudpayments API wrapper
69
66
  test_files: []