unit_ruby_sdk 1.0.5 → 1.2.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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +190 -19
  3. data/lib/unit/api_resources/application_form_resource.rb +40 -0
  4. data/lib/unit/api_resources/authorization_request_resource.rb +49 -0
  5. data/lib/unit/api_resources/authorization_resource.rb +31 -0
  6. data/lib/unit/api_resources/card_resource.rb +8 -0
  7. data/lib/unit/api_resources/event_resource.rb +40 -0
  8. data/lib/unit/api_resources/fee_resource.rb +32 -0
  9. data/lib/unit/api_resources/payment_resource.rb +17 -0
  10. data/lib/unit/api_resources/received_payment_resource.rb +47 -0
  11. data/lib/unit/api_resources/recurring_payment_resource.rb +55 -0
  12. data/lib/unit/api_resources/repayment_resource.rb +41 -0
  13. data/lib/unit/api_resources/reward_resource.rb +41 -0
  14. data/lib/unit/api_resources/webhook_resource.rb +65 -0
  15. data/lib/unit/models/application/application.rb +98 -10
  16. data/lib/unit/models/application/create_business_application_request.rb +34 -13
  17. data/lib/unit/models/application/create_individual_application_request.rb +12 -8
  18. data/lib/unit/models/application/create_sole_proprietor_application_request.rb +113 -0
  19. data/lib/unit/models/application/create_trust_application_request.rb +67 -0
  20. data/lib/unit/models/application/patch_trust_application_request.rb +31 -0
  21. data/lib/unit/models/application_form/application_form.rb +43 -0
  22. data/lib/unit/models/application_form/create_application_form_request.rb +48 -0
  23. data/lib/unit/models/application_form/list_application_form_params.rb +30 -0
  24. data/lib/unit/models/authorization/authorization.rb +42 -0
  25. data/lib/unit/models/authorization/get_request.rb +22 -0
  26. data/lib/unit/models/authorization/list_request.rb +67 -0
  27. data/lib/unit/models/authorization_request/approve_request.rb +37 -0
  28. data/lib/unit/models/authorization_request/authorization_request.rb +55 -0
  29. data/lib/unit/models/authorization_request/decline_request.rb +31 -0
  30. data/lib/unit/models/authorization_request/list_authorization_params.rb +44 -0
  31. data/lib/unit/models/card/card.rb +102 -4
  32. data/lib/unit/models/card/create_business_credit_card_request.rb +29 -0
  33. data/lib/unit/models/card/create_business_debit_card_request.rb +10 -6
  34. data/lib/unit/models/card/create_business_virtual_credit_card_request.rb +25 -0
  35. data/lib/unit/models/card/create_business_virtual_debit_card_request.rb +10 -6
  36. data/lib/unit/models/card/create_individual_debit_card_request.rb +7 -3
  37. data/lib/unit/models/card/create_individual_virtual_card_request.rb +6 -3
  38. data/lib/unit/models/card/patch_business_card_request.rb +50 -0
  39. data/lib/unit/models/card/patch_business_credit_card_request.rb +22 -0
  40. data/lib/unit/models/card/patch_business_virtual_card_request.rb +43 -0
  41. data/lib/unit/models/card/patch_business_virtual_credit_card_request.rb +20 -0
  42. data/lib/unit/models/customer/list_customer_params.rb +4 -2
  43. data/lib/unit/models/event/event.rb +37 -0
  44. data/lib/unit/models/event/list_event_params.rb +37 -0
  45. data/lib/unit/models/fee/create_fee_request.rb +43 -0
  46. data/lib/unit/models/fee/fee.rb +34 -0
  47. data/lib/unit/models/fee/reverse_fee_request.rb +43 -0
  48. data/lib/unit/models/payment/batch_release_request_builder.rb +21 -0
  49. data/lib/unit/models/payment/bulk_payment_request.rb +15 -0
  50. data/lib/unit/models/payment/create_ach_payment_inline_request.rb +29 -19
  51. data/lib/unit/models/payment/create_batch_release_request.rb +54 -0
  52. data/lib/unit/models/payment/create_book_payment_request.rb +24 -14
  53. data/lib/unit/models/payment/create_payment_linked_request.rb +31 -21
  54. data/lib/unit/models/payment/create_wire_payment_request.rb +22 -12
  55. data/lib/unit/models/payment/create_with_plaid_token_request.rb +32 -22
  56. data/lib/unit/models/payment/payment.rb +40 -12
  57. data/lib/unit/models/received_payment/list_payment_params.rb +51 -0
  58. data/lib/unit/models/received_payment/patch_payment_request.rb +31 -0
  59. data/lib/unit/models/received_payment/received_payment.rb +54 -0
  60. data/lib/unit/models/recurring_payment/create_recurring_credit_ach_payment_request.rb +52 -0
  61. data/lib/unit/models/recurring_payment/create_recurring_credit_book_payment_request.rb +54 -0
  62. data/lib/unit/models/recurring_payment/create_recurring_debit_ach_payment_request.rb +60 -0
  63. data/lib/unit/models/recurring_payment/list_recurring_payment_params.rb +60 -0
  64. data/lib/unit/models/recurring_payment/recurring_payment.rb +106 -0
  65. data/lib/unit/models/repayment/create_ach_repayment_request.rb +57 -0
  66. data/lib/unit/models/repayment/create_book_repayment_request.rb +53 -0
  67. data/lib/unit/models/repayment/list_repayment_params.rb +48 -0
  68. data/lib/unit/models/repayment/repayment.rb +67 -0
  69. data/lib/unit/models/reward/create_reward_request.rb +49 -0
  70. data/lib/unit/models/reward/get_request.rb +22 -0
  71. data/lib/unit/models/reward/list_reward_params.rb +65 -0
  72. data/lib/unit/models/reward/reward.rb +55 -0
  73. data/lib/unit/models/unit_response.rb +1 -1
  74. data/lib/unit/models/webhook/create_webhook_request.rb +49 -0
  75. data/lib/unit/models/webhook/list_webhook_params.rb +39 -0
  76. data/lib/unit/models/webhook/patch_webhook_request.rb +47 -0
  77. data/lib/unit/models/webhook/webhook.rb +80 -0
  78. data/lib/unit/types/application_form_prefill.rb +84 -0
  79. data/lib/unit/types/application_form_settings_override.rb +51 -0
  80. data/lib/unit/types/beneficial_owner.rb +15 -10
  81. data/lib/unit/types/beneficiary.rb +25 -0
  82. data/lib/unit/types/create_schedule.rb +38 -0
  83. data/lib/unit/types/evaluation_params.rb +4 -4
  84. data/lib/unit/types/grantor.rb +37 -0
  85. data/lib/unit/types/officer.rb +26 -13
  86. data/lib/unit/types/power_of_attorney_agent.rb +5 -12
  87. data/lib/unit/types/require_id_verification.rb +29 -0
  88. data/lib/unit/types/trust_contact.rb +34 -0
  89. data/lib/unit/types/trustee.rb +37 -0
  90. data/lib/unit/version.rb +1 -1
  91. data/lib/unit_ruby_sdk.rb +28 -0
  92. metadata +67 -2
@@ -0,0 +1,49 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Request to create webhook
4
+ # @see https://docs.unit.co/webhooks#create-webhook
5
+ module Unit
6
+ module Webhook
7
+ class CreateWebhookRequest
8
+ attr_accessor :label, :url, :token, :content_type, :delivery_mode,
9
+ :include_resources, :subscription_type
10
+
11
+ # @param label [String]
12
+ # @param url [String]
13
+ # @param token [String]
14
+ # @param content_type [String]
15
+ # @param delivery_mode [String]
16
+ # @param include_resources [Boolean] - optional
17
+ # @param subscription_type [String] - optional
18
+ def initialize(label, url, token, content_type, delivery_mode,
19
+ include_resources = nil, subscription_type = nil)
20
+ @label = label
21
+ @url = url
22
+ @token = token
23
+ @content_type = content_type
24
+ @delivery_mode = delivery_mode
25
+ @include_resources = include_resources
26
+ @subscription_type = subscription_type
27
+ end
28
+
29
+ def to_json_api
30
+ payload = {
31
+ data: {
32
+ type: "webhook",
33
+ attributes: {
34
+ label: label,
35
+ url: url,
36
+ token: token,
37
+ contentType: content_type,
38
+ deliveryMode: delivery_mode,
39
+ includeResources: include_resources,
40
+ subscriptionType: subscription_type
41
+ }
42
+ }
43
+ }
44
+ payload[:data][:attributes].compact!
45
+ payload.to_json
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Request to list webhooks
4
+ # @see https://docs.unit.co/webhooks#list-webhooks
5
+ module Unit
6
+ module Webhook
7
+ class ListWebhookParams
8
+ attr_accessor :limit, :offset, :since, :until_, :from_id, :told
9
+
10
+ # @param limit [Integer]
11
+ # @param offset [Integer]
12
+ # @param since [String] - optional
13
+ # @param until_ [String] - optional
14
+ # @param from_id [Integer] - optional
15
+ # @param told [Integer] - optional
16
+ def initialize(limit = WEBHOOK_LIMIT, offset = WEBHOOK_OFFSET, since = nil,
17
+ until_ = nil, from_id = nil, told = nil)
18
+ @limit = limit
19
+ @offset = offset
20
+ @since = since
21
+ @until_ = until_
22
+ @from_id = from_id
23
+ @told = told
24
+ end
25
+
26
+ def to_hash
27
+ payload = {
28
+ "page[limit]": limit,
29
+ "page[offset]": offset,
30
+ "filter[since]": since,
31
+ "filter[until]": until_,
32
+ "filter[fromId]": from_id,
33
+ "filter[told]": told
34
+ }
35
+ payload.compact!
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,47 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Request to patch webhook
4
+ # @see https://docs.unit.co/webhooks#update-webhook
5
+ module Unit
6
+ module Webhook
7
+ class PatchWebhookRequest
8
+ attr_reader :webhook_id, :label, :url, :token, :content_type, :token, :include_resources, :subscription_type
9
+
10
+ # @param webhook_id [String]
11
+ # @param label [String]
12
+ # @param url [String]
13
+ # @param content_type [String]
14
+ # @param token [String]
15
+ # @param include_resources [Boolean] - optional
16
+ # @param subscription_type [String] - optional
17
+ def initialize(webhook_id, label, url, content_type, token,
18
+ include_resources = nil, subscription_type = nil)
19
+ @webhook_id = webhook_id
20
+ @label = label
21
+ @url = url
22
+ @token = token
23
+ @content_type = content_type
24
+ @include_resources = include_resources
25
+ @subscription_type = subscription_type
26
+ end
27
+
28
+ def to_json_api
29
+ payload = {
30
+ data: {
31
+ type: "webhook",
32
+ attributes: {
33
+ label: label,
34
+ url: url,
35
+ content_type: content_type,
36
+ token: token,
37
+ include_resources: include_resources,
38
+ subscription_type: subscription_type
39
+ }
40
+ }
41
+ }
42
+ payload[:data][:attributes].compact!
43
+ payload.to_json
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,80 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Unit
4
+ module Webhook
5
+ class << self
6
+ WEBHOOK_LIMIT = 100
7
+ WEBHOOK_OFFSET = 0
8
+ autoload :CreateWebhookRequest, "unit/models/webhook/create_webhook_request"
9
+ autoload :ListWebhookParams, "unit/models/webhook/list_webhook_params"
10
+ autoload :PatchWebhookRequest, "unit/models/webhook/patch_webhook_request"
11
+
12
+ # Create a webhook
13
+ # @see https://docs.unit.co/webhooks#create-webhook
14
+ # @param label [String]
15
+ # @param url [String]
16
+ # @param token [String]
17
+ # @param content_type [String]
18
+ # @param delivery_mode [String]
19
+ # @param include_resources [Boolean] - optional
20
+ # @param subscription_type [String] - optional
21
+ def create_webhook(label:, url:, token:, content_type:, delivery_mode:,
22
+ include_resources: nil, subscription_type: nil)
23
+ request = CreateWebhookRequest.new(label, url, token, content_type, delivery_mode,
24
+ include_resources, subscription_type)
25
+ Unit::Resource::WebhookResource.create_webhook(request)
26
+ end
27
+
28
+ # Request to list webhooks
29
+ # @see https://docs.unit.co/webhooks#list-webhooks
30
+ # @param limit [Integer]
31
+ # @param offset [Integer]
32
+ # @param since [String] - optional
33
+ # @param until_ [String] - optional
34
+ # @param from_id [Integer] - optional
35
+ # @param told [Integer] - optional
36
+ def list_webhooks(limit: WEBHOOK_LIMIT, offset: WEBHOOK_OFFSET, since: nil,
37
+ until_: nil, from_id: nil, told: nil)
38
+ request = ListWebhookParams.new(limit, offset, since, until_, from_id, told)
39
+ Unit::Resource::WebhookResource.list_webhooks(request)
40
+ end
41
+
42
+ # Request to patch webhook
43
+ # @see https://docs.unit.co/webhooks#update-webhook
44
+ # @param webhook_id [String]
45
+ # @param label [String]
46
+ # @param url [String]
47
+ # @param content_type [String]
48
+ # @param token [String]
49
+ # @param include_resources [Boolean] - optional
50
+ # @param subscription_type [String] - optional
51
+ def update_webhook(webhook_id:, label:, url:, content_type:, token:,
52
+ include_resources: nil, subscription_type: nil)
53
+ request = PatchWebhookRequest.new(webhook_id, label, url, content_type, token,
54
+ include_resources, subscription_type)
55
+ Unit::Resource::WebhookResource.update_webhook(request)
56
+ end
57
+
58
+ # Request to get a webhook
59
+ # @see https://docs.unit.co/webhooks#get-webhook
60
+ # @param webhook_id [String]
61
+ def get_webhook(webhook_id:)
62
+ Unit::Resource::WebhookResource.get_webhook(webhook_id)
63
+ end
64
+
65
+ # Request to enable a webhook
66
+ # @see https://docs.unit.co/webhooks#enable
67
+ # @param webhook_id [String]
68
+ def enable_webhook(webhook_id:)
69
+ Unit::Resource::WebhookResource.enable_webhook(webhook_id)
70
+ end
71
+
72
+ # Request to disable a webhook
73
+ # @see https://docs.unit.co/webhooks#disable
74
+ # @param webhook_id [String]
75
+ def disable_webhook(webhook_id:)
76
+ Unit::Resource::WebhookResource.disable_webhook(webhook_id)
77
+ end
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,84 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Type representing application form prefill
4
+ # @see https://docs.unit.co/types#applicationformprefill
5
+ module Unit
6
+ module Types
7
+ class ApplicationFormPrefill
8
+ attr_reader :application_type, :full_name, :ssn, :passport, :nationality, :date_of_birth, :email,
9
+ :name, :state_of_incorporation, :entity_type, :contact, :officer, :beneficial_owners,
10
+ :website, :dba, :ein, :industry, :address, :phone, :jwt_subject
11
+
12
+ # @param application_type [Array<String>] - optional
13
+ # @param full_name [FullName] - optional
14
+ # @param ssn [String] - optional
15
+ # @param passport [String] - optional
16
+ # @param nationality [String] - optional
17
+ # @param date_of_birth [Date] - optional
18
+ # @param email [String] - optional
19
+ # @param name [String] - optional
20
+ # @param state_of_incorporation [String] - optional
21
+ # @param entity_type [String] - optional
22
+ # @param contact [BusinessContact] - optional
23
+ # @param officer [Officer] - optional
24
+ # @param beneficial_owners [Array<BeneficialOwner>] - optional
25
+ # @param website [String] - optional
26
+ # @param dba [String] - optional
27
+ # @param ein [String] - optional
28
+ # @param industry [String] - optional
29
+ # @param address [Address] - optional
30
+ # @param phone [Phone] - optional
31
+ def initialize(application_type = nil, full_name = nil, ssn = nil, passport = nil, nationality = nil,
32
+ date_of_birth = nil, email = nil, name = nil, state_of_incorporation = nil, entity_type = nil,
33
+ contact = nil, officer = nil, beneficial_owners = nil, website = nil, dba = nil, ein = nil,
34
+ industry = nil, address = nil, phone = nil, jwt_subject = nil)
35
+ @application_type = application_type
36
+ @full_name = full_name
37
+ @ssn = ssn
38
+ @passport = passport
39
+ @nationality = nationality
40
+ @date_of_birth = date_of_birth
41
+ @email = email
42
+ @name = name
43
+ @state_of_incorporation = state_of_incorporation
44
+ @entity_type = entity_type
45
+ @contact = contact
46
+ @officer = officer
47
+ @beneficial_owners = beneficial_owners
48
+ @website = website
49
+ @dba = dba
50
+ @ein = ein
51
+ @industry = industry
52
+ @address = address
53
+ @phone = phone
54
+ @jwt_subject = jwt_subject
55
+ end
56
+
57
+ def represent
58
+ payload = {
59
+ applicationType: application_type,
60
+ fullName: full_name&.represent,
61
+ ssn: ssn,
62
+ passport: passport,
63
+ nationality: nationality,
64
+ dateOfBirth: date_of_birth,
65
+ email: email,
66
+ name: name,
67
+ stateOfIncorporation: state_of_incorporation,
68
+ entityType: entity_type,
69
+ contact: contact&.represent,
70
+ officer: officer&.represent,
71
+ beneficialOwners: beneficial_owners,
72
+ website: website,
73
+ dba: dba,
74
+ ein: ein,
75
+ industry: industry,
76
+ address: address&.represent,
77
+ phone: phone&.represent,
78
+ jwtSubject: jwt_subject
79
+ }
80
+ payload.compact
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Type representing application form settings override
4
+ # @see https://docs.unit.co/types#applicationformsettingsoverride
5
+ module Unit
6
+ module Types
7
+ class ApplicationFormSettingsOverride
8
+ attr_reader :redirect_url, :privacy_policy_url, :electronic_disclosures_url, :deposit_terms_url,
9
+ :client_terms_url, :cardholder_terms_url, :cash_advanced_terms_url, :debit_card_disclosure_url,
10
+ :additional_disclosures
11
+
12
+ # @param redirect_url [String] - optional
13
+ # @param privacy_policy_url [String] - optional
14
+ # @param electronic_disclosures_url [String] - optional
15
+ # @param deposit_terms_url [String] - optional
16
+ # @param client_terms_url [String] - optional
17
+ # @param cardholder_terms_url [String] - optional
18
+ # @param cash_advanced_terms_url [String] - optional
19
+ # @param debit_card_disclosure_url [String] - optional
20
+ # @param additional_disclosures [Array] - optional
21
+ def initialize(redirect_url = nil, privacy_policy_url = nil, electronic_disclosures_url = nil, deposit_terms_url = nil,
22
+ client_terms_url = nil, cardholder_terms_url = nil, cash_advanced_terms_url = nil, debit_card_disclosure_url = nil,
23
+ additional_disclosures = nil)
24
+ @redirect_url = redirect_url
25
+ @privacy_policy_url = privacy_policy_url
26
+ @electronic_disclosures_url = electronic_disclosures_url
27
+ @deposit_terms_url = deposit_terms_url
28
+ @client_terms_url = client_terms_url
29
+ @cardholder_terms_url = cardholder_terms_url
30
+ @cash_advanced_terms_url = cash_advanced_terms_url
31
+ @debit_card_disclosure_url = debit_card_disclosure_url
32
+ @additional_disclosures = additional_disclosures
33
+ end
34
+
35
+ def represent
36
+ payload = {
37
+ redirectUrl: redirect_url,
38
+ privacyPolicyUrl: privacy_policy_url,
39
+ electronicDisclosuresUrl: electronic_disclosures_url,
40
+ depositTermsUrl: deposit_terms_url,
41
+ clientTermsUrl: client_terms_url,
42
+ cardholderTermsUrl: cardholder_terms_url,
43
+ cashAdvancedTermsUrl: cash_advanced_terms_url,
44
+ debitCardDisclosureUrl: debit_card_disclosure_url,
45
+ additionalDisclosures: additional_disclosures&.join(",")
46
+ }
47
+ payload.compact
48
+ end
49
+ end
50
+ end
51
+ end
@@ -6,16 +6,21 @@ module Unit
6
6
  attr_reader :full_name, :date_of_birth, :address, :phone, :email,
7
7
  :status, :ssn, :passport, :nationality, :percentage
8
8
 
9
- # @param [FullName] full_name
10
- # @param [Date] date_of_birth
11
- # @param [Address] address
12
- # @param [Phone] phone
13
- # @param [String] email
14
- # @param [String] ssn
15
- # @param optional [String] status
16
- # @param optional [String] passport
17
- # @param optional [String] nationality
18
- # @param optional [Integer] percentage
9
+ # @param full_name [FullName]
10
+ # @param date_of_birth [Date]
11
+ # @param address [Address]
12
+ # @param phone [Phone]
13
+ # @param email [String]
14
+ # @param ssn [String]
15
+ # @param status [String] - optional
16
+ # @param passport [String] - optional
17
+ # @param nationality [String] - optional
18
+ # @param percentage [Integer] - optional
19
+ # @param evaluation_params [EvaluationParams] - optional
20
+ # @param id_theft_score [Integer] - optional
21
+ # @param occupation [String] - optional
22
+ # @param annual_income [String] - optional
23
+ # @param source_of_income [String] - optional
19
24
  # @return [BeneficialOwner]
20
25
  def initialize(full_name, date_of_birth, address, phone, email, ssn, status = nil, passport = nil,
21
26
  nationality = nil, percentage = nil)
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://docs.unit.co/types#beneficiary
4
+ module Unit
5
+ module Types
6
+ class Beneficiary
7
+ attr_reader :full_name, :date_of_birth
8
+
9
+ # @param full_name [FullName]
10
+ # @param date_of_birth [Date]
11
+ def initialize(full_name, date_of_birth = nil)
12
+ @full_name = full_name
13
+ @date_of_birth = date_of_birth
14
+ end
15
+
16
+ def represent
17
+ payload = {
18
+ fullName: full_name.represent,
19
+ dateOfBirth: date_of_birth
20
+ }
21
+ payload.compact
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Type for creating a schedule for recurring payments
4
+ # @see https://docs.unit.co/types#create-schedule
5
+ module Unit
6
+ module Types
7
+ class CreateSchedule
8
+ attr_reader :interval, :day_of_month, :day_of_week, :start_time, :end_time, :total_number_of_payments
9
+
10
+ # @param interval [String]
11
+ # @param day_of_month [Integer]
12
+ # @param day_of_week [String] - optional
13
+ # @param start_time [String] - optional
14
+ # @param end_time [String] - optional
15
+ # @param total_number_of_payments [Integer] - optional
16
+ def initialize(interval, day_of_month, day_of_week = nil, start_time = nil, end_time = nil, total_number_of_payments = nil)
17
+ @interval = interval
18
+ @day_of_month = day_of_month
19
+ @day_of_week = day_of_week
20
+ @start_time = start_time
21
+ @end_time = end_time
22
+ @total_number_of_payments = total_number_of_payments
23
+ end
24
+
25
+ def represent
26
+ payload = {
27
+ interval: interval,
28
+ dayOfMonth: day_of_month,
29
+ dayOfWeek: day_of_week,
30
+ startTime: start_time,
31
+ endTime: end_time,
32
+ totalNumberOfPayments: total_number_of_payments
33
+ }
34
+ payload.compact!
35
+ end
36
+ end
37
+ end
38
+ end
@@ -8,14 +8,14 @@ module Unit
8
8
 
9
9
  def initialize(use_selfie_verification = nil, required_verification = nil)
10
10
  @use_selfie_verification = use_selfie_verification
11
- @required_verificaion = required_verification
11
+ @required_verification = required_verification
12
12
  end
13
13
 
14
14
  def represent
15
15
  {
16
- use_selfie_verification: use_selfie_verification,
17
- required_verification: required_verification
18
- }
16
+ useSelfieVerification: use_selfie_verification,
17
+ requiredVerification: required_verification
18
+ }.compact!
19
19
  end
20
20
  end
21
21
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @see https://docs.unit.co/types#grantor
4
+ module Unit
5
+ module Types
6
+ class Grantor
7
+ attr_reader :full_name, :date_of_birth, :ssn, :email, :phone, :address
8
+
9
+ # @param full_name [FullName]
10
+ # @param ssn [String]
11
+ # @param email [String]
12
+ # @param phone [Phone]
13
+ # @param address [Address]
14
+ # @param date_of_birth [Date] - optional
15
+ def initialize(full_name, ssn, email, phone, address, date_of_birth = nil)
16
+ @full_name = full_name
17
+ @date_of_birth = date_of_birth
18
+ @ssn = ssn
19
+ @email = email
20
+ @phone = phone
21
+ @address = address
22
+ end
23
+
24
+ def represent
25
+ payload = {
26
+ fullName: full_name.represent,
27
+ dateOfBirth: date_of_birth,
28
+ ssn: ssn,
29
+ email: email,
30
+ phone: phone.represent,
31
+ address: address.represent
32
+ }
33
+ payload.compact
34
+ end
35
+ end
36
+ end
37
+ end
@@ -4,21 +4,24 @@ module Unit
4
4
  module Types
5
5
  class Officer
6
6
  attr_reader :full_name, :date_of_birth, :address, :phone, :email,
7
- :status, :title, :ssn, :passport, :nationality
7
+ :status, :title, :ssn, :passport, :nationality,
8
+ :evaluation_params, :id_theft_score, :occupation,
9
+ :annual_income, :source_of_income
8
10
 
9
- # @param [FullName] full_name
10
- # @param [Date] date_of_birth
11
- # @param [Address] address
12
- # @param [Phone] phone
13
- # @param [String] email
14
- # @param [String] ssn
15
- # @param optional [String] status
16
- # @param optional [String] title
17
- # @param optional [String] passport
18
- # @param optional [String] nationality
11
+ # @param full_name [FullName]
12
+ # @param date_of_birth [Date]
13
+ # @param address [Address]
14
+ # @param phone [Phone]
15
+ # @param email [String]
16
+ # @param ssn [String]
17
+ # @param status [String] - optional
18
+ # @param title [String] - optional
19
+ # @param passport [String] - optional
20
+ # @param nationality [String] - optional
19
21
  def initialize(full_name, date_of_birth, address, phone, email, ssn,
20
22
  status = nil, title = nil, passport = nil,
21
- nationality = nil)
23
+ nationality = nil, evaluation_params = nil, id_theft_score = nil, occupation = nil,
24
+ annual_income = nil, source_of_income = nil)
22
25
  @full_name = full_name
23
26
  @date_of_birth = date_of_birth
24
27
  @address = address
@@ -29,6 +32,11 @@ module Unit
29
32
  @ssn = ssn
30
33
  @passport = passport
31
34
  @nationality = nationality
35
+ @evaluation_params = evaluation_params
36
+ @id_theft_score = id_theft_score
37
+ @occupation = occupation
38
+ @annual_income = annual_income
39
+ @source_of_income = source_of_income
32
40
  end
33
41
 
34
42
  def represent
@@ -43,7 +51,12 @@ module Unit
43
51
  status: status,
44
52
  title: title,
45
53
  passport: passport,
46
- nationality: nationality
54
+ nationality: nationality,
55
+ evaluation_params: evaluation_params,
56
+ id_theft_score: id_theft_score,
57
+ occupation: occupation,
58
+ annual_income: annual_income,
59
+ source_of_income: source_of_income
47
60
  }
48
61
  payload.compact
49
62
  end
@@ -1,27 +1,21 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require_relative "full_name"
4
- require_relative "address"
5
- require_relative "phone"
6
-
7
3
  module Unit
8
4
  module Types
9
5
  class PowerOfAttorneyAgent
10
- attr_reader :status, :full_name, :ssn, :passport, :nationality,
6
+ attr_reader :full_name, :ssn, :passport, :nationality,
11
7
  :date_of_birth, :address, :phone, :email, :jwt_subject
12
8
 
13
- # @param [String] status
14
9
  # @param [FullName] full_name
15
10
  # @param [String] ssn
16
- # @param [String] passport
17
11
  # @param [String] nationality
18
12
  # @param [Date] date_of_birth
19
13
  # @param [Address] address
20
14
  # @param [Phone] phone
21
15
  # @param [String] email
22
- # @param [String] jwt_subject
23
- def initialize(status, full_name, ssn, passport, nationality, date_of_birth, address, phone, email, jwt_subject)
24
- @status = status
16
+ # @param [String] passport - optional
17
+ # @param [String] jwt_subject - optional
18
+ def initialize(full_name, ssn, nationality, date_of_birth, address, phone, email, passport = nil, jwt_subject = nil)
25
19
  @full_name = full_name
26
20
  @ssn = ssn
27
21
  @passport = passport
@@ -35,7 +29,6 @@ module Unit
35
29
 
36
30
  def represent
37
31
  {
38
- status: status,
39
32
  fullName: full_name.represent,
40
33
  ssn: ssn,
41
34
  passport: passport,
@@ -45,7 +38,7 @@ module Unit
45
38
  phone: phone.represent,
46
39
  email: email,
47
40
  jwtSubject: jwt_subject
48
- }
41
+ }.compact!
49
42
  end
50
43
  end
51
44
  end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ # Type representing require id verification
4
+ # @see https://docs.unit.co/types#require-id-verification
5
+ module Unit
6
+ module Types
7
+ class RequireIdVerification
8
+ attr_reader :individual, :officer, :beneficial_owners
9
+
10
+ # @param individual [Boolean] - optional
11
+ # @param officer [Boolean] - optional
12
+ # @param beneficial_owners [Boolean] - optional
13
+ def initialize(individual = nil, officer = nil, beneficial_owners = nil)
14
+ @individual = individual
15
+ @officer = officer
16
+ @beneficial_owners = beneficial_owners
17
+ end
18
+
19
+ def represent
20
+ payload = {
21
+ individual: individual,
22
+ officer: officer,
23
+ beneficialOwners: beneficial_owners
24
+ }
25
+ payload.compact
26
+ end
27
+ end
28
+ end
29
+ end