bambora-client 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: 0ba08f9e38a85141dce37a2cc1ef6b85a7935ecda24d06abc4811cfbd467e1d4
4
- data.tar.gz: 5d5608a1401b10ced7a4881456941531346e8fb903da6e7016785fa6bcc7e586
3
+ metadata.gz: c558cd0eb1fa8548cbe1f789247e8212eef01751816352f16a5de1d481c8d976
4
+ data.tar.gz: 41c21bf3ff0c31642177d5f7cd170a9cf955903a8f451d4f4c6f0a8a281366b9
5
5
  SHA512:
6
- metadata.gz: 68935433385cd450909aee6f18ed9dce231d68e6c4d960bc33f888f0ae5ce7ed83936b66f58d1ca9db9989487505009cbd0459a058c6b3ba4b7bee88ad0a5f60
7
- data.tar.gz: 348eaec713407d64e216e64f462c6d3c2298e1d3b84caa31d85b8424fba19f6ddf4e6a5803a664143894a29a58d913e4a55770cfe0e4a1668fbd07626d3eda06
6
+ metadata.gz: 53e587d5ae1e54ce4042d80f1e5a9869cad0a11d47a733322ceeca1f4a727fdbc86a70b9e029a358413d2044a7dc3209c6988230c25bc46f08ef62a60dcf6640
7
+ data.tar.gz: 467774ca8f4ea52e0fc23e91a41182d67a162bcc7554083c6824437800bb9f8f9909bfca9ec8752b224aebf75f2b8cad281f5cc0a20959f8e668524c7743d95a
data/.gitignore CHANGED
@@ -10,3 +10,6 @@
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
12
  bambora-client-*.gem
13
+
14
+ # Ruby-specific files
15
+ Gemfile.lock
@@ -1,3 +1,7 @@
1
+ ## 0.3.0 (2020-05-27)
2
+
3
+ - Add `Bambora::V1::ProfileResource#update` method
4
+
1
5
  ## 0.2.0 (2020-05-11)
2
6
 
3
7
  - Add `Bambora::V1::ProfileResource#get` method
data/README.md CHANGED
@@ -92,6 +92,31 @@ profiles.delete(customer_code: '02355E2e58Bf488EAB4EaFAD7083dB6A')
92
92
  # }
93
93
  ```
94
94
 
95
+ ### Update a Profile
96
+
97
+ ```ruby
98
+ profiles.update(
99
+ customer_code: '02355E2e58Bf488EAB4EaFAD7083dB6A',
100
+ payment_profile_data: {
101
+ language: 'en',
102
+ comments: 'hello',
103
+ card: {
104
+ name: 'Hup Podling',
105
+ number: '4030000010001234',
106
+ expiry_month: '12',
107
+ expiry_year: '23',
108
+ cvd: '123',
109
+ },
110
+ },
111
+ )
112
+
113
+ # => {
114
+ # :code => 1,
115
+ # :message => "Operation Successful",
116
+ # :customer_code => "02355E2e58Bf488EAB4EaFAD7083dB6A",
117
+ # }
118
+ ```
119
+
95
120
  ### Payments
96
121
 
97
122
  *Summary*: Process payments using Credit Card, Payment Profile, Legato Token, Cash, Cheque, Interac, Apple Pay, or
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Bambora
4
4
  class Client
5
- VERSION = '0.2.0'
5
+ VERSION = '0.3.0'
6
6
  end
7
7
  end
@@ -38,6 +38,10 @@ module Bambora
38
38
  end
39
39
  end
40
40
 
41
+ def put(path:, body:, headers:)
42
+ connection.put(path, body, headers)
43
+ end
44
+
41
45
  def connection
42
46
  @connection ||= Faraday.new(url: base_url) do |faraday|
43
47
  faraday.request :multipart
@@ -99,6 +99,55 @@ module Bambora
99
99
  ).to_h
100
100
  end
101
101
 
102
+ # Make a PUT Request.
103
+ #
104
+ # @example
105
+ #
106
+ # client = Bambora::Rest::JSONClient(base_url: '...', merchant_id: '...')
107
+ #
108
+ # data = {
109
+ # billing: {
110
+ # name: "joh doe",
111
+ # address_line1: "123 main st",
112
+ # address_line2: "111",
113
+ # city: "victoria",
114
+ # province: "bc",
115
+ # country: "ca",
116
+ # postal_code: "V8T4M3",
117
+ # phone_number: "25012312345",
118
+ # email_address: "bill@smith.com"
119
+ # },
120
+ # card: {
121
+ # name: 'Hup Podling',
122
+ # number: '4030000010001234',
123
+ # expiry_month: '12',
124
+ # expiry_year: '23',
125
+ # cvd: '123',
126
+ # },
127
+ # }
128
+ #
129
+ # client.put(
130
+ # path: 'v1/profiles',
131
+ # body: data,
132
+ # api_key: '...'
133
+ # )
134
+ # # => {
135
+ # # :code => 1,
136
+ # # :message => "Operation Successful",
137
+ # # :customer_code => "02355E2e58Bf488EAB4EaFAD7083dB6A",
138
+ # # }
139
+ #
140
+ # @param path [String] Indicating request path.
141
+ # @param body [Hash] Data to be sent in the body of the request.
142
+ # @param api_key [String] Indicating the API Key to be used with the request.
143
+ #
144
+ # @return [Hash] Indicating success or failure of the operation.
145
+ def put(path:, body:, api_key:)
146
+ parse_response_body(
147
+ super(path: path, body: body.to_json.to_s, headers: build_headers(api_key: api_key)),
148
+ ).to_h
149
+ end
150
+
102
151
  private
103
152
 
104
153
  def build_headers(api_key:)
@@ -54,8 +54,8 @@ module Bambora
54
54
  # @see https://dev.na.bambora.com/docs/guides/payment_profiles
55
55
  #
56
56
  # @return [Hash] Indicating success or failure of the operation.
57
- def create(card_data)
58
- client.post(path: sub_path, body: card_data, api_key: api_key)
57
+ def create(payment_profile_data)
58
+ client.post(path: sub_path, body: payment_profile_data, api_key: api_key)
59
59
  end
60
60
 
61
61
  ##
@@ -100,6 +100,50 @@ module Bambora
100
100
  client.get(path: "#{sub_path}/#{customer_code}", api_key: api_key)
101
101
  end
102
102
 
103
+ # Make a PUT Request.
104
+ #
105
+ # @example
106
+ #
107
+ # client = Bambora::Rest::JSONClient(base_url: '...', api_key: '...', merchant_id: '...')
108
+ # profiles = Bambora::V1::ProfileResource(client: client)
109
+ # customer_code = '02355E2e58Bf488EAB4EaFAD7083dB6A'
110
+ #
111
+ # data = {
112
+ # billing: {
113
+ # name: "joh doe",
114
+ # address_line1: "123 main st",
115
+ # address_line2: "111",
116
+ # city: "victoria",
117
+ # province: "bc",
118
+ # country: "ca",
119
+ # postal_code: "V8T4M3",
120
+ # phone_number: "25012312345",
121
+ # email_address: "bill@smith.com"
122
+ # },
123
+ # card: {
124
+ # name: 'Hup Podling',
125
+ # number: '4030000010001234',
126
+ # expiry_month: '12',
127
+ # expiry_year: '23',
128
+ # cvd: '123',
129
+ # },
130
+ # }
131
+ #
132
+ # profiles.update(customer_code: customer_code, payment_profile_data: data)
133
+ # # => {
134
+ # # :code => 1,
135
+ # # :message => "Operation Successful",
136
+ # # :customer_code => "02355E2e58Bf488EAB4EaFAD7083dB6A",
137
+ # # }
138
+ #
139
+ # @param customer_code [String] A unique identifier for the associated payment profile.
140
+ # @param data [Hash] Payment profile data to be sent in the body of the request.
141
+ #
142
+ # @return [Hash] Indicating success or failure of the operation.
143
+ def update(customer_code:, payment_profile_data:)
144
+ client.put(path: "#{@sub_path}/#{customer_code}", body: payment_profile_data, api_key: api_key)
145
+ end
146
+
103
147
  ##
104
148
  # Delete a Bambora payment profile given a customer code.
105
149
  #
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bambora-client
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
  - Cassidy K
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-12 00:00:00.000000000 Z
11
+ date: 2020-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
@@ -197,7 +197,6 @@ files:
197
197
  - CHANGELOG.md
198
198
  - CODE_OF_CONDUCT.md
199
199
  - Gemfile
200
- - Gemfile.lock
201
200
  - LICENSE.txt
202
201
  - README.md
203
202
  - Rakefile
@@ -251,7 +250,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
251
250
  - !ruby/object:Gem::Version
252
251
  version: '0'
253
252
  requirements: []
254
- rubygems_version: 3.0.3
253
+ rubyforge_project:
254
+ rubygems_version: 2.7.6.2
255
255
  signing_key:
256
256
  specification_version: 4
257
257
  summary: A thread-safe client for the Bambora/Beanstream API.
@@ -1,93 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- bambora-client (0.1.3)
5
- excon (< 1.0)
6
- faraday (< 1.0)
7
- gyoku (~> 1.0)
8
- multiparty (~> 0)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- addressable (2.7.0)
14
- public_suffix (>= 2.0.2, < 5.0)
15
- ast (2.4.0)
16
- builder (3.2.4)
17
- byebug (11.0.1)
18
- coderay (1.1.2)
19
- crack (0.4.3)
20
- safe_yaml (~> 1.0.0)
21
- diff-lcs (1.3)
22
- excon (0.73.0)
23
- faraday (0.17.3)
24
- multipart-post (>= 1.2, < 3)
25
- gyoku (1.3.1)
26
- builder (>= 2.1.2)
27
- hashdiff (1.0.0)
28
- jaro_winkler (1.5.3)
29
- method_source (0.9.2)
30
- mime-types (3.3.1)
31
- mime-types-data (~> 3.2015)
32
- mime-types-data (3.2020.0425)
33
- multipart-post (2.1.1)
34
- multiparty (0.2.0)
35
- mime-types
36
- parallel (1.18.0)
37
- parser (2.6.5.0)
38
- ast (~> 2.4.0)
39
- pry (0.12.2)
40
- coderay (~> 1.1.0)
41
- method_source (~> 0.9.0)
42
- pry-byebug (3.7.0)
43
- byebug (~> 11.0)
44
- pry (~> 0.10)
45
- public_suffix (4.0.1)
46
- rainbow (3.0.0)
47
- rake (13.0.1)
48
- rspec (3.9.0)
49
- rspec-core (~> 3.9.0)
50
- rspec-expectations (~> 3.9.0)
51
- rspec-mocks (~> 3.9.0)
52
- rspec-core (3.9.0)
53
- rspec-support (~> 3.9.0)
54
- rspec-expectations (3.9.0)
55
- diff-lcs (>= 1.2.0, < 2.0)
56
- rspec-support (~> 3.9.0)
57
- rspec-mocks (3.9.0)
58
- diff-lcs (>= 1.2.0, < 2.0)
59
- rspec-support (~> 3.9.0)
60
- rspec-support (3.9.0)
61
- rspec_junit_formatter (0.4.1)
62
- rspec-core (>= 2, < 4, != 2.12.0)
63
- rubocop (0.74.0)
64
- jaro_winkler (~> 1.5.1)
65
- parallel (~> 1.10)
66
- parser (>= 2.6)
67
- rainbow (>= 2.2.2, < 4.0)
68
- ruby-progressbar (~> 1.7)
69
- unicode-display_width (>= 1.4.0, < 1.7)
70
- ruby-progressbar (1.10.1)
71
- safe_yaml (1.0.5)
72
- unicode-display_width (1.6.0)
73
- webmock (3.7.6)
74
- addressable (>= 2.3.6)
75
- crack (>= 0.3.2)
76
- hashdiff (>= 0.4.0, < 2.0.0)
77
-
78
- PLATFORMS
79
- ruby
80
-
81
- DEPENDENCIES
82
- bambora-client!
83
- bundler (~> 2)
84
- pry (~> 0.12.0)
85
- pry-byebug (~> 3.7)
86
- rake (~> 13.0)
87
- rspec (~> 3.0)
88
- rspec_junit_formatter (~> 0.4.1)
89
- rubocop (~> 0.74.0)
90
- webmock (~> 3.7)
91
-
92
- BUNDLED WITH
93
- 2.1.1