currency_cloud 0.11.2 → 0.12.4

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: a3d86d137b05ff91df7c4347269163febf64ef026b7937aa85bfa1e5c005415a
4
- data.tar.gz: d02b48b511db91cf9123b35db168d14bfba85d55a52b8b30342f6faf5b5bbc76
3
+ metadata.gz: 8769ddb100767e2a3e0126d1e59096b515b962fdf8a7d916189649fcd0c67743
4
+ data.tar.gz: '06812fbddff99b861924480e8bfa8d91dfc56f46567795d430660e63970768d2'
5
5
  SHA512:
6
- metadata.gz: 6e703590da55833c1ae5a04f5ba8a8ab2abb243ae2d9d459023d8d2a2a03467ea4c0fc1f57c11a9f21be6ed54db0b3ca1e964d245b1fc1195762b0287a91db9c
7
- data.tar.gz: ff6b0dc8a71a8236afaddf54700f935d27530f19db5d1b0634600c99967c945137e4688fd48fd5a8caa1c04cf08606fa53a1b62cd907dd269938a6466f1b5d68
6
+ metadata.gz: '09c4d829fc6c1ac0f72eda2e4ba1f435a17219f0fdc7982b4a8ea8a097f532b0790c77a9a7267413591595ea7437aa4b977b0a0e0cbc0b6279023ca58c66d041'
7
+ data.tar.gz: 5c711b797d6814dd9c35f150f8dd7841d03c6f58dbbdb683fb44e056d5ad318ad60a379c7d91487ba2e3a35e20c5b50ea16da8c19e52b89035ab0cf2e7574d4b
@@ -4,5 +4,16 @@ module CurrencyCloud
4
4
 
5
5
  resource :accounts
6
6
  actions :create, :retrieve, :find, :update, :current
7
+
8
+ def self.get_payment_charges_settings(account_id, params={})
9
+ settings = client.get("#{account_id}/payment_charges_settings", params)
10
+ settings["payment_charges_settings"].map { |s| AccountPaymentChargesSetting.new(s) }
11
+ end
12
+
13
+ def self.update_payment_charges_settings(account_id, charge_settings_id, params)
14
+ settings = client.post("#{account_id}/payment_charges_settings/#{charge_settings_id}", params)
15
+ AccountPaymentChargesSetting.new(settings)
16
+ end
17
+
7
18
  end
8
19
  end
@@ -0,0 +1,5 @@
1
+ module CurrencyCloud
2
+ class AccountPaymentChargesSetting
3
+ include CurrencyCloud::Resource
4
+ end
5
+ end
@@ -2,5 +2,5 @@
2
2
 
3
3
  module CurrencyCloud
4
4
  API_VERSION = 'v2'.freeze # API Version
5
- VERSION = '0.11.2'.freeze # Gem Version
5
+ VERSION = '0.12.4'.freeze # Gem Version
6
6
  end
@@ -0,0 +1,48 @@
1
+ require "spec_helper"
2
+
3
+ describe "Accounts", vcr: true do
4
+ before do
5
+ CurrencyCloud.login_id = "development@currencycloud.com"
6
+ CurrencyCloud.api_key = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"
7
+ CurrencyCloud.environment = :demonstration
8
+ CurrencyCloud.reset_session
9
+ end
10
+
11
+ it "can retrieve #account_payment_charges_settings" do
12
+
13
+ settings = CurrencyCloud::Account.get_payment_charges_settings("3e12053j-ae22-40b1-cc4e-cc0230c009a5")
14
+ expect(settings.count).to eq(2)
15
+
16
+ settings1 = settings[0]
17
+ expect(settings1).to be_a_kind_of(CurrencyCloud::AccountPaymentChargesSetting)
18
+ expect(settings1.charge_settings_id).to eq("090baf7e-5chh-4bfd-9b7l-ad3f8a310123")
19
+ expect(settings1.account_id).to eq("3e12053j-ae22-40b1-cc4e-cc0230c009a5")
20
+ expect(settings1.charge_type).to eq("ours")
21
+ expect(settings1.enabled).to eq(false)
22
+ expect(settings1.default).to eq(false)
23
+
24
+ settings2 = settings[1]
25
+ expect(settings2).to be_a_kind_of(CurrencyCloud::AccountPaymentChargesSetting)
26
+ expect(settings2.charge_settings_id).to eq("12345678-24b5-4af3-b88f-3aa27de4c6ba")
27
+ expect(settings2.account_id).to eq("3e12053j-ae22-40b1-cc4e-cc0230c009a5")
28
+ expect(settings2.charge_type).to eq("shared")
29
+ expect(settings2.enabled).to eq(true)
30
+ expect(settings2.default).to eq(true)
31
+ end
32
+
33
+ it "can update #account_payment_charges_settings" do
34
+
35
+ params = {enabled: true, default: true}
36
+ updated = CurrencyCloud::Account.update_payment_charges_settings("3e12053j-ae22-40b1-cc4e-cc0230c009a5",
37
+ "090baf7e-5chh-4bfd-9b7l-ad3f8a310123",
38
+ params)
39
+
40
+ expect(updated).to be_a_kind_of(CurrencyCloud::AccountPaymentChargesSetting)
41
+ expect(updated.charge_settings_id).to eq("090baf7e-5chh-4bfd-9b7l-ad3f8a310123")
42
+ expect(updated.account_id).to eq("3e12053j-ae22-40b1-cc4e-cc0230c009a5")
43
+ expect(updated.charge_type).to eq("ours")
44
+ expect(updated.enabled).to eq(true)
45
+ expect(updated.default).to eq(true)
46
+ end
47
+ end
48
+
@@ -0,0 +1,119 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://devapi.currencycloud.com/v2/authenticate/api
6
+ body:
7
+ encoding: US-ASCII
8
+ string: login_id=development%40currencycloud.com&api_key=deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef
9
+ headers:
10
+ User-Agent:
11
+ - CurrencyCloudSDK/2.0 Ruby/0.9.0
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Date:
18
+ - Mon, 16 Jul 2018 08:20:14 GMT
19
+ Content-Type:
20
+ - application/json;charset=utf-8
21
+ Transfer-Encoding:
22
+ - chunked
23
+ Connection:
24
+ - keep-alive
25
+ Set-Cookie:
26
+ - AWSALB=JpWe8cJzRhv4y6vw/IU+s5GhiuDyGrTi6vtz6co+S0h3gIbGe216G4tO/ShPFipDpVbIyjW2adc1dWbedPE6KtLb6Zd8EkruEcNHxASHm2VPkAp32QK3biCRFUkv; Expires=Mon, 23 Jul 2018 08:20:13 GMT; Path=/
27
+ - __cfduid=d0c32af71ff0925dd045630165ce66c121531729213; expires=Tue, 16-Jul-19 08:20:13 GMT; path=/; domain=.currencycloud.com; HttpOnly
28
+ Access-Control-Allow-Origin:
29
+ - "*"
30
+ X-Request-Id:
31
+ - e8908fc1-4f80-4c60-9c44-363928bed983
32
+ Access-Control-Allow-Methods:
33
+ - POST
34
+ X-Content-Type-Options:
35
+ - nosniff
36
+ Vary:
37
+ - Origin
38
+ Access-Control-Allow-Headers:
39
+ - authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction,X-Auth-Token,Origin,Authority
40
+ Expect-Ct:
41
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
42
+ Server:
43
+ - cloudflare
44
+ Cf-Ray:
45
+ - 43b30c5d1b930a8a-LHR
46
+ body:
47
+ encoding: US-ASCII
48
+ string: '{"auth_token":"deadbeefdeadbeefdeadbeefdeadbeef"}'
49
+ http_version:
50
+ recorded_at: Mon, 16 Jul 2018 08:20:14 GMT
51
+ - request:
52
+ method: get
53
+ uri: https://devapi.currencycloud.com/v2/accounts/3e12053j-ae22-40b1-cc4e-cc0230c009a5/payment_charges_settings
54
+ body:
55
+ encoding: US-ASCII
56
+ string: ''
57
+ headers:
58
+ X-Auth-Token:
59
+ - deadbeefdeadbeefdeadbeefdeadbeef
60
+ User-Agent:
61
+ - CurrencyCloudSDK/2.0 Ruby/0.9.0
62
+ response:
63
+ status:
64
+ code: 200
65
+ message: OK
66
+ headers:
67
+ Date:
68
+ - Mon, 16 Jul 2018 08:20:15 GMT
69
+ Content-Type:
70
+ - application/json;charset=utf-8
71
+ Transfer-Encoding:
72
+ - chunked
73
+ Connection:
74
+ - keep-alive
75
+ Set-Cookie:
76
+ - AWSALB=f61uJIdQJ62af6qzIvrUyJ/GuWAfhANu0wtDcexsHBbOaAWvC7AoyaVAebCjVgxZ3oyt3y7xdvr8TmJhcmtxkFE3YVOtliw8PJm2Nb66/OMzp5C0zgAnUn+FagXL; Expires=Mon, 23 Jul 2018 08:20:14 GMT; Path=/
77
+ - __cfduid=db268a59c300ca9cb4728d291492bb4cd1531729214; expires=Tue, 16-Jul-19 08:20:14 GMT; path=/; domain=.currencycloud.com; HttpOnly
78
+ Access-Control-Allow-Origin:
79
+ - "*"
80
+ X-Request-Id:
81
+ - 54f7d95c-dd88-4cf4-bf3c-35b21bd66a63
82
+ Access-Control-Allow-Methods:
83
+ - GET
84
+ X-Content-Type-Options:
85
+ - nosniff
86
+ Vary:
87
+ - Origin
88
+ Access-Control-Allow-Headers:
89
+ - authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction,X-Auth-Token,Origin,Authority
90
+ Expect-Ct:
91
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
92
+ Server:
93
+ - cloudflare
94
+ Cf-Ray:
95
+ - 43b30c692e8606d0-LHR
96
+ body:
97
+ encoding: US-ASCII
98
+ string: >-
99
+ {
100
+ "payment_charges_settings": [
101
+ {
102
+ "charge_settings_id": "090baf7e-5chh-4bfd-9b7l-ad3f8a310123",
103
+ "account_id": "3e12053j-ae22-40b1-cc4e-cc0230c009a5",
104
+ "charge_type": "ours",
105
+ "enabled": false,
106
+ "default": false
107
+ },
108
+ {
109
+ "charge_settings_id": "12345678-24b5-4af3-b88f-3aa27de4c6ba",
110
+ "account_id": "3e12053j-ae22-40b1-cc4e-cc0230c009a5",
111
+ "charge_type": "shared",
112
+ "enabled": true,
113
+ "default": true
114
+ }
115
+ ]
116
+ }
117
+ http_version:
118
+ recorded_at: Mon, 16 Jul 2018 08:20:15 GMT
119
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,108 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://devapi.currencycloud.com/v2/authenticate/api
6
+ body:
7
+ encoding: US-ASCII
8
+ string: login_id=development%40currencycloud.com&api_key=deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef
9
+ headers:
10
+ User-Agent:
11
+ - CurrencyCloudSDK/2.0 Ruby/0.9.0
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ Date:
18
+ - Mon, 16 Jul 2018 08:20:14 GMT
19
+ Content-Type:
20
+ - application/json;charset=utf-8
21
+ Transfer-Encoding:
22
+ - chunked
23
+ Connection:
24
+ - keep-alive
25
+ Set-Cookie:
26
+ - AWSALB=JpWe8cJzRhv4y6vw/IU+s5GhiuDyGrTi6vtz6co+S0h3gIbGe216G4tO/ShPFipDpVbIyjW2adc1dWbedPE6KtLb6Zd8EkruEcNHxASHm2VPkAp32QK3biCRFUkv; Expires=Mon, 23 Jul 2018 08:20:13 GMT; Path=/
27
+ - __cfduid=d0c32af71ff0925dd045630165ce66c121531729213; expires=Tue, 16-Jul-19 08:20:13 GMT; path=/; domain=.currencycloud.com; HttpOnly
28
+ Access-Control-Allow-Origin:
29
+ - "*"
30
+ X-Request-Id:
31
+ - e8908fc1-4f80-4c60-9c44-363928bed983
32
+ Access-Control-Allow-Methods:
33
+ - POST
34
+ X-Content-Type-Options:
35
+ - nosniff
36
+ Vary:
37
+ - Origin
38
+ Access-Control-Allow-Headers:
39
+ - authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction,X-Auth-Token,Origin,Authority
40
+ Expect-Ct:
41
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
42
+ Server:
43
+ - cloudflare
44
+ Cf-Ray:
45
+ - 43b30c5d1b930a8a-LHR
46
+ body:
47
+ encoding: US-ASCII
48
+ string: '{"auth_token":"deadbeefdeadbeefdeadbeefdeadbeef"}'
49
+ http_version:
50
+ recorded_at: Mon, 16 Jul 2018 08:20:14 GMT
51
+ - request:
52
+ method: post
53
+ uri: https://devapi.currencycloud.com/v2/accounts/3e12053j-ae22-40b1-cc4e-cc0230c009a5/payment_charges_settings/090baf7e-5chh-4bfd-9b7l-ad3f8a310123
54
+ body:
55
+ encoding: US-ASCII
56
+ string: ''
57
+ headers:
58
+ X-Auth-Token:
59
+ - deadbeefdeadbeefdeadbeefdeadbeef
60
+ User-Agent:
61
+ - CurrencyCloudSDK/2.0 Ruby/0.9.0
62
+ response:
63
+ status:
64
+ code: 200
65
+ message: OK
66
+ headers:
67
+ Date:
68
+ - Mon, 16 Jul 2018 08:20:15 GMT
69
+ Content-Type:
70
+ - application/json;charset=utf-8
71
+ Transfer-Encoding:
72
+ - chunked
73
+ Connection:
74
+ - keep-alive
75
+ Set-Cookie:
76
+ - AWSALB=f61uJIdQJ62af6qzIvrUyJ/GuWAfhANu0wtDcexsHBbOaAWvC7AoyaVAebCjVgxZ3oyt3y7xdvr8TmJhcmtxkFE3YVOtliw8PJm2Nb66/OMzp5C0zgAnUn+FagXL; Expires=Mon, 23 Jul 2018 08:20:14 GMT; Path=/
77
+ - __cfduid=db268a59c300ca9cb4728d291492bb4cd1531729214; expires=Tue, 16-Jul-19 08:20:14 GMT; path=/; domain=.currencycloud.com; HttpOnly
78
+ Access-Control-Allow-Origin:
79
+ - "*"
80
+ X-Request-Id:
81
+ - 54f7d95c-dd88-4cf4-bf3c-35b21bd66a63
82
+ Access-Control-Allow-Methods:
83
+ - POST
84
+ X-Content-Type-Options:
85
+ - nosniff
86
+ Vary:
87
+ - Origin
88
+ Access-Control-Allow-Headers:
89
+ - authorization,Access-Control-Allow-Origin,Content-Type,SOAPAction,X-Auth-Token,Origin,Authority
90
+ Expect-Ct:
91
+ - max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
92
+ Server:
93
+ - cloudflare
94
+ Cf-Ray:
95
+ - 43b30c692e8606d0-LHR
96
+ body:
97
+ encoding: US-ASCII
98
+ string: >-
99
+ {
100
+ "charge_settings_id": "090baf7e-5chh-4bfd-9b7l-ad3f8a310123",
101
+ "account_id": "3e12053j-ae22-40b1-cc4e-cc0230c009a5",
102
+ "charge_type": "ours",
103
+ "enabled": true,
104
+ "default": true
105
+ }
106
+ http_version:
107
+ recorded_at: Mon, 16 Jul 2018 08:20:15 GMT
108
+ recorded_with: VCR 4.0.0
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: currency_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.12.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Liam McAndrew
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-06-12 00:00:00.000000000 Z
12
+ date: 2019-07-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
@@ -130,6 +130,7 @@ files:
130
130
  - examples/server.rb
131
131
  - lib/currency_cloud.rb
132
132
  - lib/currency_cloud/account.rb
133
+ - lib/currency_cloud/account_payment_charges_setting.rb
133
134
  - lib/currency_cloud/actions.rb
134
135
  - lib/currency_cloud/actions/create.rb
135
136
  - lib/currency_cloud/actions/current.rb
@@ -196,6 +197,7 @@ files:
196
197
  - spec/currency_cloud/request_handler_spec.rb
197
198
  - spec/currency_cloud/resource_spec.rb
198
199
  - spec/currency_cloud_spec.rb
200
+ - spec/integration/account_spec.rb
199
201
  - spec/integration/actions_spec.rb
200
202
  - spec/integration/authentication_spec.rb
201
203
  - spec/integration/conversions_spec.rb
@@ -212,6 +214,8 @@ files:
212
214
  - spec/integration/transfers_spec.rb
213
215
  - spec/integration/virtual_accounts_spec.rb
214
216
  - spec/spec_helper.rb
217
+ - spec/support/vcr_cassettes/Accounts/can_retrieve_account_payment_charges_settings.yml
218
+ - spec/support/vcr_cassettes/Accounts/can_update_account_payment_charges_settings.yml
215
219
  - spec/support/vcr_cassettes/Actions/can_create.yml
216
220
  - spec/support/vcr_cassettes/Actions/can_current.yml
217
221
  - spec/support/vcr_cassettes/Actions/can_delete.yml
@@ -303,6 +307,7 @@ test_files:
303
307
  - spec/currency_cloud/request_handler_spec.rb
304
308
  - spec/currency_cloud/resource_spec.rb
305
309
  - spec/currency_cloud_spec.rb
310
+ - spec/integration/account_spec.rb
306
311
  - spec/integration/actions_spec.rb
307
312
  - spec/integration/authentication_spec.rb
308
313
  - spec/integration/conversions_spec.rb
@@ -319,6 +324,8 @@ test_files:
319
324
  - spec/integration/transfers_spec.rb
320
325
  - spec/integration/virtual_accounts_spec.rb
321
326
  - spec/spec_helper.rb
327
+ - spec/support/vcr_cassettes/Accounts/can_retrieve_account_payment_charges_settings.yml
328
+ - spec/support/vcr_cassettes/Accounts/can_update_account_payment_charges_settings.yml
322
329
  - spec/support/vcr_cassettes/Actions/can_create.yml
323
330
  - spec/support/vcr_cassettes/Actions/can_current.yml
324
331
  - spec/support/vcr_cassettes/Actions/can_delete.yml