bloom_remit_client 0.12.0 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +5 -5
  2. data/.github/workflows/push.yml +27 -0
  3. data/.ruby-version +1 -1
  4. data/CHANGELOG.md +27 -0
  5. data/Gemfile +2 -1
  6. data/README.md +61 -0
  7. data/bloom_remit_client.gemspec +5 -5
  8. data/lib/bloom_remit_client.rb +40 -48
  9. data/lib/bloom_remit_client/client.rb +6 -126
  10. data/lib/bloom_remit_client/factories.rb +23 -0
  11. data/lib/bloom_remit_client/models/txn.rb +39 -0
  12. data/lib/bloom_remit_client/models/txn_preview.rb +15 -0
  13. data/lib/bloom_remit_client/requests/base_request.rb +18 -0
  14. data/lib/bloom_remit_client/requests/create_txn_preview_request.rb +24 -0
  15. data/lib/bloom_remit_client/requests/create_txn_request.rb +79 -0
  16. data/lib/bloom_remit_client/responses/base_response.rb +18 -0
  17. data/lib/bloom_remit_client/responses/create_txn_preview_response.rb +16 -0
  18. data/lib/bloom_remit_client/responses/create_txn_response.rb +11 -0
  19. data/lib/bloom_remit_client/version.rb +1 -1
  20. metadata +23 -48
  21. data/.travis.yml +0 -9
  22. data/lib/bloom_remit_client/coercers/path.rb +0 -11
  23. data/lib/bloom_remit_client/concerns/has_base_authentification.rb +0 -16
  24. data/lib/bloom_remit_client/models/biller.rb +0 -16
  25. data/lib/bloom_remit_client/models/credit.rb +0 -12
  26. data/lib/bloom_remit_client/models/deposit_strategy.rb +0 -11
  27. data/lib/bloom_remit_client/models/payment.rb +0 -23
  28. data/lib/bloom_remit_client/models/recipient.rb +0 -17
  29. data/lib/bloom_remit_client/models/remittance.rb +0 -22
  30. data/lib/bloom_remit_client/models/user.rb +0 -21
  31. data/lib/bloom_remit_client/requests/base.rb +0 -55
  32. data/lib/bloom_remit_client/requests/billers/list.rb +0 -23
  33. data/lib/bloom_remit_client/requests/credit/history.rb +0 -20
  34. data/lib/bloom_remit_client/requests/credit/list.rb +0 -20
  35. data/lib/bloom_remit_client/requests/deposit_strategies/list.rb +0 -21
  36. data/lib/bloom_remit_client/requests/payments/create.rb +0 -31
  37. data/lib/bloom_remit_client/requests/rate/show.rb +0 -29
  38. data/lib/bloom_remit_client/requests/recipients/create.rb +0 -32
  39. data/lib/bloom_remit_client/requests/remittances/calculate.rb +0 -33
  40. data/lib/bloom_remit_client/requests/remittances/create.rb +0 -30
  41. data/lib/bloom_remit_client/requests/requests_sender.rb +0 -35
  42. data/lib/bloom_remit_client/requests/senders/create.rb +0 -30
  43. data/lib/bloom_remit_client/requests/txns/create.rb +0 -30
  44. data/lib/bloom_remit_client/requests/url_builder.rb +0 -51
  45. data/lib/bloom_remit_client/responses/base.rb +0 -31
  46. data/lib/bloom_remit_client/responses/billers/list.rb +0 -17
  47. data/lib/bloom_remit_client/responses/deposit_strategies/list.rb +0 -20
  48. data/lib/bloom_remit_client/responses/payments/create.rb +0 -17
  49. data/lib/bloom_remit_client/responses/recipients/create.rb +0 -20
  50. data/lib/bloom_remit_client/responses/remittances/calculate.rb +0 -69
  51. data/lib/bloom_remit_client/responses/remittances/create.rb +0 -20
  52. data/lib/bloom_remit_client/responses/senders/create.rb +0 -21
  53. data/lib/bloom_remit_client/responses/txns/create.rb +0 -20
@@ -0,0 +1,39 @@
1
+ module BloomRemitClient
2
+ class Txn
3
+
4
+ include Virtus.model
5
+
6
+ attribute :id, String
7
+ attribute :recipient_id, String
8
+ attribute :dest_currency, String
9
+ attribute :receivable_in_dest_currency, BigDecimal
10
+ attribute :payout_method, String
11
+ attribute :status, String
12
+ attribute :account_name, String
13
+ attribute :account_number, String
14
+ attribute :tracking_sender, String
15
+ attribute :tracking_number, String
16
+ attribute :client_external_id, String
17
+ attribute :purpose, String
18
+ attribute :sender_first_name, String
19
+ attribute :sender_last_name, String
20
+ attribute :sender_email, String
21
+ attribute :sender_address, String
22
+ attribute :sender_city, String
23
+ attribute :sender_state, String
24
+ attribute :sender_zip_code, String
25
+ attribute :sender_country, String
26
+ attribute :sender_occupation, String
27
+ attribute :recipient_first_name, String
28
+ attribute :recipient_last_name, String
29
+ attribute :recipient_mobile, String
30
+ attribute :recipient_address, String
31
+ attribute :recipient_city, String
32
+ attribute :recipient_state, String
33
+ attribute :recipient_zip_code, String
34
+ attribute :recipient_country, String
35
+ attribute :recipient_occupation, String
36
+ attribute :recipient_relationship_to_sender, String
37
+
38
+ end
39
+ end
@@ -0,0 +1,15 @@
1
+ module BloomRemitClient
2
+ class TxnPreview
3
+
4
+ include Virtus.model
5
+
6
+ attribute :total_fees, BigDecimal
7
+ attribute :maximum_amount, BigDecimal
8
+ attribute :amount, BigDecimal
9
+ attribute :payout_method, String
10
+ attribute :minimum_wait_time_in_minutes, Integer
11
+ attribute :maximum_wait_time_in_minutes, Integer
12
+ attribute :days_available, Array
13
+
14
+ end
15
+ end
@@ -0,0 +1,18 @@
1
+ module BloomRemitClient
2
+ class BaseRequest
3
+
4
+ include APIClientBase::Request.module
5
+
6
+ attribute :host, String
7
+ attribute :partner_id, String
8
+ attribute :api_secret, String
9
+
10
+ def headers
11
+ {
12
+ "X-API-PARTNER-ID" => partner_id,
13
+ "X-API-SECRET" => api_secret,
14
+ }
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,24 @@
1
+ module BloomRemitClient
2
+ class CreateTxnPreviewRequest < BaseRequest
3
+
4
+ attribute :amount, BigDecimal
5
+ attribute :payout_method, String
6
+
7
+ def default_action
8
+ :post
9
+ end
10
+
11
+ def path
12
+ "/api/v2/txn_previews"
13
+ end
14
+
15
+ def body
16
+ txn_preview_values = %i[amount payout_method].each_with_object({}) do |attr, hash|
17
+ hash[attr] = send(attr)
18
+ end
19
+
20
+ { txn_preview: txn_preview_values }
21
+ end
22
+
23
+ end
24
+ end
@@ -0,0 +1,79 @@
1
+ module BloomRemitClient
2
+ class CreateTxnRequest < BaseRequest
3
+
4
+ attribute :sender_first_name, String
5
+ attribute :sender_last_name, String
6
+ attribute :sender_email, String
7
+ attribute :sender_mobile, String
8
+ attribute :sender_address, String
9
+ attribute :sender_city, String
10
+ attribute :sender_state, String
11
+ attribute :sender_zip_code, String
12
+ attribute :sender_country, String
13
+ attribute :sender_occupation, String
14
+ attribute :recipient_first_name, String
15
+ attribute :recipient_last_name, String
16
+ attribute :recipient_mobile, String
17
+ attribute :recipient_address, String
18
+ attribute :recipient_city, String
19
+ attribute :recipient_state, String
20
+ attribute :recipient_zip_code, String
21
+ attribute :recipient_country, String
22
+ attribute :recipient_occupation, String
23
+ attribute :recipient_relationship_to_sender, String
24
+ attribute :dest_currency, String
25
+ attribute :receivable_in_dest_currency, String
26
+ attribute :payout_method, String
27
+ attribute :purpose, String
28
+ attribute :account_number, String
29
+ attribute :account_name, String
30
+ attribute :client_external_id, String
31
+
32
+ BODY_ATTRIBUTES = %i[
33
+ sender_first_name
34
+ sender_last_name
35
+ sender_email
36
+ sender_mobile
37
+ sender_address
38
+ sender_city
39
+ sender_state
40
+ sender_zip_code
41
+ sender_country
42
+ sender_occupation
43
+ recipient_first_name
44
+ recipient_last_name
45
+ recipient_mobile
46
+ recipient_address
47
+ recipient_city
48
+ recipient_state
49
+ recipient_zip_code
50
+ recipient_country
51
+ recipient_occupation
52
+ recipient_relationship_to_sender
53
+ dest_currency
54
+ receivable_in_dest_currency
55
+ payout_method
56
+ purpose
57
+ account_number
58
+ account_name
59
+ client_external_id
60
+ ].freeze
61
+
62
+ def default_action
63
+ :post
64
+ end
65
+
66
+ def path
67
+ "/api/v2/txns"
68
+ end
69
+
70
+ def body
71
+ txn_values = BODY_ATTRIBUTES.each_with_object({}) do |attr, hash|
72
+ hash[attr] = send(attr)
73
+ end
74
+
75
+ { txn: txn_values }
76
+ end
77
+
78
+ end
79
+ end
@@ -0,0 +1,18 @@
1
+ module BloomRemitClient
2
+ class BaseResponse
3
+
4
+ include APIClientBase::Response.module
5
+
6
+ attribute :body, String, lazy: true, default: :default_body
7
+ attribute :parsed_body, String, lazy: true, default: :default_parsed_body
8
+
9
+ def default_body
10
+ raw_response.body
11
+ end
12
+
13
+ def default_parsed_body
14
+ JSON.parse(body).with_indifferent_access
15
+ end
16
+
17
+ end
18
+ end
@@ -0,0 +1,16 @@
1
+ module BloomRemitClient
2
+ class CreateTxnPreviewResponse < BaseResponse
3
+
4
+ attribute :errors, Hash, lazy: true, default: :default_errors
5
+ attribute :txn_preview, TxnPreview, lazy: true, default: :default_txn_preview
6
+
7
+ def default_errors
8
+ Array(parsed_body[:errors])
9
+ end
10
+
11
+ def default_txn_preview
12
+ TxnPreview.new(parsed_body[:txn_preview])
13
+ end
14
+
15
+ end
16
+ end
@@ -0,0 +1,11 @@
1
+ module BloomRemitClient
2
+ class CreateTxnResponse < BaseResponse
3
+
4
+ attribute :txn, Txn, lazy: true, default: :default_txn
5
+
6
+ def default_txn
7
+ Txn.new(parsed_body[:txn])
8
+ end
9
+
10
+ end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module BloomRemitClient
2
- VERSION = "0.12.0"
2
+ VERSION = "0.16.1"
3
3
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bloom_remit_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-10-04 00:00:00.000000000 Z
11
+ date: 2021-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: activemodel
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: api_client_base
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
@@ -39,7 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: httparty
42
+ name: typhoeus
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - ">="
@@ -53,7 +53,7 @@ dependencies:
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: addressable
56
+ name: message_bus_client_worker
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - ">="
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.12'
75
+ version: '2.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.12'
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -165,7 +165,7 @@ dependencies:
165
165
  - !ruby/object:Gem::Version
166
166
  version: '0'
167
167
  - !ruby/object:Gem::Dependency
168
- name: shoulda-matchers
168
+ name: virtus-matchers
169
169
  requirement: !ruby/object:Gem::Requirement
170
170
  requirements:
171
171
  - - ">="
@@ -178,7 +178,7 @@ dependencies:
178
178
  - - ">="
179
179
  - !ruby/object:Gem::Version
180
180
  version: '0'
181
- description:
181
+ description:
182
182
  email:
183
183
  - ramon.tayag@gmail.com
184
184
  executables: []
@@ -186,10 +186,10 @@ extensions: []
186
186
  extra_rdoc_files: []
187
187
  files:
188
188
  - ".envrc"
189
+ - ".github/workflows/push.yml"
189
190
  - ".gitignore"
190
191
  - ".rspec"
191
192
  - ".ruby-version"
192
- - ".travis.yml"
193
193
  - CHANGELOG.md
194
194
  - CODE_OF_CONDUCT.md
195
195
  - Gemfile
@@ -203,47 +203,23 @@ files:
203
203
  - lib/bloom_remit_client.rb
204
204
  - lib/bloom_remit_client/client.rb
205
205
  - lib/bloom_remit_client/coercers/indifferent_hash.rb
206
- - lib/bloom_remit_client/coercers/path.rb
207
- - lib/bloom_remit_client/concerns/has_base_authentification.rb
208
206
  - lib/bloom_remit_client/factories.rb
209
- - lib/bloom_remit_client/models/biller.rb
210
- - lib/bloom_remit_client/models/credit.rb
211
- - lib/bloom_remit_client/models/deposit_strategy.rb
212
- - lib/bloom_remit_client/models/payment.rb
213
- - lib/bloom_remit_client/models/recipient.rb
214
- - lib/bloom_remit_client/models/remittance.rb
215
- - lib/bloom_remit_client/models/user.rb
207
+ - lib/bloom_remit_client/models/txn.rb
208
+ - lib/bloom_remit_client/models/txn_preview.rb
216
209
  - lib/bloom_remit_client/requests.rb
217
- - lib/bloom_remit_client/requests/base.rb
218
- - lib/bloom_remit_client/requests/billers/list.rb
219
- - lib/bloom_remit_client/requests/credit/history.rb
220
- - lib/bloom_remit_client/requests/credit/list.rb
221
- - lib/bloom_remit_client/requests/deposit_strategies/list.rb
222
- - lib/bloom_remit_client/requests/payments/create.rb
223
- - lib/bloom_remit_client/requests/rate/show.rb
224
- - lib/bloom_remit_client/requests/recipients/create.rb
225
- - lib/bloom_remit_client/requests/remittances/calculate.rb
226
- - lib/bloom_remit_client/requests/remittances/create.rb
227
- - lib/bloom_remit_client/requests/requests_sender.rb
228
- - lib/bloom_remit_client/requests/senders/create.rb
229
- - lib/bloom_remit_client/requests/txns/create.rb
230
- - lib/bloom_remit_client/requests/url_builder.rb
231
- - lib/bloom_remit_client/responses/base.rb
232
- - lib/bloom_remit_client/responses/billers/list.rb
233
- - lib/bloom_remit_client/responses/deposit_strategies/list.rb
234
- - lib/bloom_remit_client/responses/payments/create.rb
235
- - lib/bloom_remit_client/responses/recipients/create.rb
236
- - lib/bloom_remit_client/responses/remittances/calculate.rb
237
- - lib/bloom_remit_client/responses/remittances/create.rb
238
- - lib/bloom_remit_client/responses/senders/create.rb
239
- - lib/bloom_remit_client/responses/txns/create.rb
210
+ - lib/bloom_remit_client/requests/base_request.rb
211
+ - lib/bloom_remit_client/requests/create_txn_preview_request.rb
212
+ - lib/bloom_remit_client/requests/create_txn_request.rb
213
+ - lib/bloom_remit_client/responses/base_response.rb
214
+ - lib/bloom_remit_client/responses/create_txn_preview_response.rb
215
+ - lib/bloom_remit_client/responses/create_txn_response.rb
240
216
  - lib/bloom_remit_client/version.rb
241
217
  homepage: https://github.com/imacchiato/bloom_remit_client-ruby
242
218
  licenses:
243
219
  - MIT
244
220
  metadata:
245
221
  allowed_push_host: https://rubygems.org
246
- post_install_message:
222
+ post_install_message:
247
223
  rdoc_options: []
248
224
  require_paths:
249
225
  - lib
@@ -258,9 +234,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
258
234
  - !ruby/object:Gem::Version
259
235
  version: '0'
260
236
  requirements: []
261
- rubyforge_project:
262
- rubygems_version: 2.5.1
263
- signing_key:
237
+ rubygems_version: 3.1.4
238
+ signing_key:
264
239
  specification_version: 4
265
240
  summary: Ruby wrapper around Bloom Remit's API
266
241
  test_files: []
@@ -1,9 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.3.1
5
- before_install:
6
- - gem install bundler -v 1.12.5
7
- before_script:
8
- - cp spec/config.yml{.sample,}
9
- script: bundle exec rspec spec
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
- module BloomRemitClient
3
- module Coercers
4
- class Path < Virtus::Attribute
5
- def coerce(value)
6
- return value if !value.is_a?(String) || value[0] == '/'
7
- "/#{value}"
8
- end
9
- end
10
- end
11
- end
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
- module BloomRemitClient
3
- module Concerns
4
- module HasBaseAuthentification
5
- def self.included(base)
6
- base.class_eval do
7
- attribute :api_token, String
8
- attribute :api_secret, String
9
- attribute :host, String
10
-
11
- validates :api_token, :api_secret, :host, presence: true
12
- end
13
- end
14
- end
15
- end
16
- end
@@ -1,16 +0,0 @@
1
- module BloomRemitClient
2
- class Biller
3
-
4
- include Virtus.model
5
- attribute :slug, String
6
- attribute :description, String
7
- attribute :first_field, String
8
- attribute :first_field_format, String
9
- attribute :first_field_width, Integer
10
- attribute :second_field, String
11
- attribute :second_field_format, String
12
- attribute :second_field_width, Integer
13
- attribute :service_charge, Float
14
-
15
- end
16
- end