unit_ruby_sdk 1.2.0 → 1.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: 6886c703f37b77fbd4ccc6e174cf0c79b83c588c53f0cfaaa6a1503598fc1fbd
4
- data.tar.gz: 0371acc6dc064fb9bf8969d10839cbe915e23772bb088493bf889abfeee50244
3
+ metadata.gz: 19b63ebda9542149ccda54951cd38604a8c3175879f3377893f3cd9e2d0acb02
4
+ data.tar.gz: ce345af67e8bd02d4f7970096600d5b694a052366a65ebf067afe4e343bd6818
5
5
  SHA512:
6
- metadata.gz: 11d43e7bdaa9d8af5b2f3ac73823576773a784e9bf098d6fb232c08cbb5d76ac7de441da062ed33645c7804c2f19a897a4f0e8cdc1309f6b2b146c249c8edd0c
7
- data.tar.gz: b8077c7600d42b3396a2f0b5437edde30b1e3d09899df5e0d5ebec0761822a3a8bbcd3b83cc9706245f3a02c26d3b4e0c0481ef19410874eed952292584464c7
6
+ metadata.gz: 14689b03dd416d25d6f97767429188301240645ea51dfda65e203051aa357c01f3c7181fe3436cea9fef4fc231c8fca71944f94b51726b581bb1d967152755a3
7
+ data.tar.gz: f93ecf9f33ece644fe9343ed583f34366db4437b1c2e1866718f4be7526c5546b85561915960352c803f33f170270a5ab08aa2df844f33647ac474039b3f5f0f
data/README.md CHANGED
@@ -313,7 +313,14 @@ response = Unit::Repayment.create_book_repayment(
313
313
  tags: { purpose: "test" },
314
314
  idempotency_key: "3a1a33be-4e12-4603-9ed0-820922389fb8")
315
315
  book_repayment = response.data
316
- puts book_repayment.id
316
+ puts book_repayment["id"]
317
+ ```
318
+
319
+ ### Creating a control agreement
320
+ ```ruby
321
+ response = Unit::Account::DACA.activate_control_agreement(account_id: "1234")
322
+ control_agreement = response.data
323
+ puts control_agreement["id"]
317
324
  ```
318
325
 
319
326
  ### Logging Errors
@@ -10,6 +10,30 @@ module Unit
10
10
  module Resource
11
11
  class AccountResource < Unit::Resource::BaseResource
12
12
  class << self
13
+ # Enter a control agreement by calling Unit's API
14
+ # @param account_id [String]
15
+ # @return [UnitResponse, UnitError]
16
+ def enter_control_agreement(account_id)
17
+ response = HttpHelper.post("#{api_url}/accounts/#{account_id}/enter-daca", headers: headers)
18
+ response_handler(response)
19
+ end
20
+
21
+ # Activate a control agreement by calling Unit's API
22
+ # @param account_id [String]
23
+ # @return [UnitResponse, UnitError]
24
+ def activate_control_agreement(account_id)
25
+ response = HttpHelper.post("#{api_url}/accounts/#{account_id}/activate-daca", headers: headers)
26
+ response_handler(response)
27
+ end
28
+
29
+ # Deactivate a control agreement by calling Unit's API
30
+ # @param account_id [String]
31
+ # @return [UnitResponse, UnitError]
32
+ def deactivate_control_agreement(account_id)
33
+ response = HttpHelper.post("#{api_url}/accounts/#{account_id}/deactivate-daca", headers: headers)
34
+ response_handler(response)
35
+ end
36
+
13
37
  # Create a new account by calling Unit's API
14
38
  # @param request [CreateDepositAccountRequest] request
15
39
  # @return [UnitResponse, UnitError]
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "./base_resource"
4
+ require_relative "../utils/http_helper"
5
+ require "json"
6
+
7
+ # class for creating request for institutions to Unit API and parsing responses
8
+ # @see https://docs.unit.co/institutions/
9
+ module Unit
10
+ module Resource
11
+ class InstitutionResource < Unit::Resource::BaseResource
12
+ class << self
13
+ # Get an institution by routing number by calling Unit's API
14
+ # @param routing_number [String]
15
+ # @return [UnitResponse, UnitError]
16
+ def get_institution(routing_number)
17
+ response = HttpHelper.get("#{api_url}/institutions/#{routing_number}", headers: headers)
18
+ response_handler(response)
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -261,5 +261,30 @@ module Unit
261
261
  end
262
262
  end
263
263
  end
264
+
265
+ module DACA
266
+ class << self
267
+ # Enter DACA
268
+ # @see https://docs.unit.co/deposit-account-control-agreement/#enter-daca
269
+ # @param account_id [String]
270
+ def enter_control_agreement(account_id:)
271
+ Unit::Resource::AccountResource.enter_control_agreement(account_id)
272
+ end
273
+
274
+ # Activate DACA
275
+ # @see https://docs.unit.co/deposit-account-control-agreement/#activate-daca
276
+ # @param account_id [String]
277
+ def activate_control_agreement(account_id:)
278
+ Unit::Resource::AccountResource.activate_control_agreement(account_id)
279
+ end
280
+
281
+ # Deactivate DACA
282
+ # @see https://docs.unit.co/deposit-account-control-agreement/#deactivate-daca
283
+ # @param account_id [String]
284
+ def deactivate_control_agreement(account_id:)
285
+ Unit::Resource::AccountResource.deactivate_control_agreement(account_id)
286
+ end
287
+ end
288
+ end
264
289
  end
265
290
  end
@@ -25,7 +25,8 @@ module Unit
25
25
  type: "depositAccount",
26
26
  attributes: {
27
27
  depositProduct: deposit_product,
28
- tags: tags
28
+ tags: tags,
29
+ idempotencyKey: idempotency_key
29
30
  },
30
31
  relationships: relationships
31
32
  }
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unit
4
+ module Institution
5
+ class << self
6
+ # Get institution by routing number
7
+ # @see https://docs.unit.co/institutions/#get-institution-by-routingNumber
8
+ # @param routing_number [String]
9
+ def get_institution(routing_number:)
10
+ Unit::Resource::InstitutionResource.get_institution(routing_number)
11
+ end
12
+ end
13
+ end
14
+ end
data/lib/unit/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Unit
4
- VERSION = "1.2.0"
4
+ VERSION = "1.3.0"
5
5
  end
data/lib/unit_ruby_sdk.rb CHANGED
@@ -16,6 +16,8 @@ module Unit
16
16
  autoload :AtmLocation, "unit/models/atm_location/atm_location"
17
17
  autoload :CheckDeposit, "unit/models/check_deposit/check_deposit"
18
18
  autoload :Counterparty, "unit/models/counterparty/counterparty"
19
+ autoload :RecurringPayment, "unit/models/recurring_payment/recurring_payment"
20
+ autoload :Institution, "unit/models/institution/institution"
19
21
  autoload :Repayment, "unit/models/repayment/repayment"
20
22
  autoload :Event, "unit/models/event/event"
21
23
  autoload :Webhook, "unit/models/webhook/webhook"
@@ -39,6 +41,8 @@ module Unit
39
41
  autoload :AtmLocationResource, "unit/api_resources/atm_location_resource"
40
42
  autoload :CheckDepositResource, "unit/api_resources/check_deposit_resource"
41
43
  autoload :CounterpartyResource, "unit/api_resources/counterparty_resource"
44
+ autoload :RecurringPaymentResource, "unit/api_resources/recurring_payment_resource"
45
+ autoload :InstitutionResource, "unit/api_resources/institution_resource"
42
46
  autoload :RepaymentResource, "unit/api_resources/repayment_resource"
43
47
  autoload :EventResource, "unit/api_resources/event_resource"
44
48
  autoload :WebhookResource, "unit/api_resources/webhook_resource"
@@ -67,6 +71,7 @@ module Unit
67
71
  autoload :RestrictedResource, "unit/types/restricted_resource"
68
72
  autoload :DocumentFileType, "unit/types/document_file_type"
69
73
  autoload :Coordinates, "unit/types/coordinates"
74
+ autoload :CreateSchedule, "unit/types/create_schedule"
70
75
  autoload :TrustContact, "unit/types/trust_contact"
71
76
  autoload :Trustee, "unit/types/trustee"
72
77
  autoload :Grantor, "unit/types/grantor"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unit_ruby_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Unit
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-05-31 00:00:00.000000000 Z
11
+ date: 2023-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: factory_bot_rails
@@ -108,6 +108,7 @@ files:
108
108
  - lib/unit/api_resources/customer_resource.rb
109
109
  - lib/unit/api_resources/event_resource.rb
110
110
  - lib/unit/api_resources/fee_resource.rb
111
+ - lib/unit/api_resources/institution_resource.rb
111
112
  - lib/unit/api_resources/payment_resource.rb
112
113
  - lib/unit/api_resources/received_payment_resource.rb
113
114
  - lib/unit/api_resources/recurring_payment_resource.rb
@@ -197,6 +198,7 @@ files:
197
198
  - lib/unit/models/fee/create_fee_request.rb
198
199
  - lib/unit/models/fee/fee.rb
199
200
  - lib/unit/models/fee/reverse_fee_request.rb
201
+ - lib/unit/models/institution/institution.rb
200
202
  - lib/unit/models/payment/batch_release_request_builder.rb
201
203
  - lib/unit/models/payment/bulk_payment_request.rb
202
204
  - lib/unit/models/payment/create_ach_payment_inline_request.rb