unit_ruby_sdk 0.1.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 +7 -0
- data/.rspec +2 -0
- data/.rubocop.yml +28 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +16 -0
- data/Gemfile.lock +131 -0
- data/LICENSE.txt +373 -0
- data/README.md +1 -0
- data/Rakefile +8 -0
- data/lib/unit/api_resources/application_resource.rb +75 -0
- data/lib/unit/api_resources/base_resource.rb +36 -0
- data/lib/unit/api_resources/customer_resource.rb +69 -0
- data/lib/unit/errors/unit_error.rb +27 -0
- data/lib/unit/errors/unit_error_payload.rb +24 -0
- data/lib/unit/models/applications/create_business_application_request.rb +78 -0
- data/lib/unit/models/applications/create_individual_application_request.rb +88 -0
- data/lib/unit/models/applications/list_application_params.rb +38 -0
- data/lib/unit/models/applications/patch_application_request.rb +29 -0
- data/lib/unit/models/applications/upload_document_request.rb +24 -0
- data/lib/unit/models/customers/add_authorized_users_request.rb +27 -0
- data/lib/unit/models/customers/archive_customer_request.rb +26 -0
- data/lib/unit/models/customers/list_customer_params.rb +38 -0
- data/lib/unit/models/customers/patch_business_customer_request.rb +44 -0
- data/lib/unit/models/customers/patch_individual_customer_request.rb +45 -0
- data/lib/unit/models/customers/remove_authorized_users_request.rb +27 -0
- data/lib/unit/models/unit_resource.rb +18 -0
- data/lib/unit/models/unit_response.rb +15 -0
- data/lib/unit/types/address.rb +31 -0
- data/lib/unit/types/authorized_user.rb +28 -0
- data/lib/unit/types/beneficial_owner.rb +48 -0
- data/lib/unit/types/business_contact.rb +25 -0
- data/lib/unit/types/device_fingerprint.rb +19 -0
- data/lib/unit/types/evaluation_params.rb +18 -0
- data/lib/unit/types/full_name.rb +19 -0
- data/lib/unit/types/officer.rb +48 -0
- data/lib/unit/types/phone.rb +19 -0
- data/lib/unit/types/power_of_attorney_agent.rb +48 -0
- data/lib/unit/types/relationship.rb +18 -0
- data/lib/unit/types/relationship_array.rb +23 -0
- data/lib/unit/version.rb +5 -0
- data/lib/unit_ruby_sdk.rb +8 -0
- metadata +97 -0
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Type representing authorized user
|
4
|
+
# See: https://docs.unit.co/customers/#authorized-users
|
5
|
+
class AuthorizedUser
|
6
|
+
attr_reader :full_name, :email, :phone, :jwt_subject
|
7
|
+
|
8
|
+
# @param full_name [FullName] The full name of the authorized user
|
9
|
+
# @param email [String] The email of the authorized user
|
10
|
+
# @param phone [Phone] The phone of the authorized user
|
11
|
+
# @param optional jwt_subject [String] The JWT subject of the authorized user. See https://docs.unit.co/customer-api-tokens/#customers-create-customer-bearer-token-jwt
|
12
|
+
def initialize(full_name, email, phone, jwt_subject = nil)
|
13
|
+
@full_name = full_name
|
14
|
+
@email = email
|
15
|
+
@phone = phone
|
16
|
+
@jwt_subject = jwt_subject
|
17
|
+
end
|
18
|
+
|
19
|
+
def represent
|
20
|
+
payload = {
|
21
|
+
fullName: full_name.represent,
|
22
|
+
email: email,
|
23
|
+
phone: phone.represent,
|
24
|
+
jwtSubject: jwt_subject
|
25
|
+
}
|
26
|
+
payload.compact
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class BeneficialOwner
|
4
|
+
attr_reader :full_name, :date_of_birth, :address, :phone, :email,
|
5
|
+
:status, :ssn, :passport, :nationality, :percentage
|
6
|
+
|
7
|
+
# @param [FullName] full_name
|
8
|
+
# @param [Date] date_of_birth
|
9
|
+
# @param [Address] address
|
10
|
+
# @param [Phone] phone
|
11
|
+
# @param [String] email
|
12
|
+
# @param [String] ssn
|
13
|
+
# @param optional [String] status
|
14
|
+
# @param optional [String] passport
|
15
|
+
# @param optional [String] nationality
|
16
|
+
# @param optional [Integer] percentage
|
17
|
+
# @return [BeneficialOwner]
|
18
|
+
def initialize(full_name, date_of_birth, address, phone, email, ssn, status = nil, passport = nil,
|
19
|
+
nationality = nil, percentage = nil)
|
20
|
+
@full_name = full_name
|
21
|
+
@date_of_birth = date_of_birth
|
22
|
+
@address = address
|
23
|
+
@phone = phone
|
24
|
+
@email = email
|
25
|
+
@status = status
|
26
|
+
@ssn = ssn
|
27
|
+
@passport = passport
|
28
|
+
@nationality = nationality
|
29
|
+
@percentage = percentage
|
30
|
+
end
|
31
|
+
|
32
|
+
def represent
|
33
|
+
payload =
|
34
|
+
{
|
35
|
+
fullName: full_name.represent,
|
36
|
+
dateOfBirth: date_of_birth,
|
37
|
+
address: address.represent,
|
38
|
+
phone: phone.represent,
|
39
|
+
email: email,
|
40
|
+
ssn: ssn,
|
41
|
+
status: status,
|
42
|
+
passport: passport,
|
43
|
+
nationality: nationality,
|
44
|
+
percentage: percentage
|
45
|
+
}
|
46
|
+
payload.compact
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "full_name"
|
4
|
+
require_relative "phone"
|
5
|
+
|
6
|
+
class BusinessContact
|
7
|
+
attr_reader :full_name, :email, :phone
|
8
|
+
|
9
|
+
# @param [FullName] full_name
|
10
|
+
# @param [String] email
|
11
|
+
# @param [Phone] phone
|
12
|
+
def initialize(full_name, email, phone)
|
13
|
+
@full_name = full_name
|
14
|
+
@email = email
|
15
|
+
@phone = phone
|
16
|
+
end
|
17
|
+
|
18
|
+
def represent
|
19
|
+
{
|
20
|
+
fullName: full_name.represent,
|
21
|
+
email: email,
|
22
|
+
phone: phone.represent
|
23
|
+
}
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class DeviceFingerprint
|
4
|
+
attr_reader :value, :provider
|
5
|
+
|
6
|
+
# @param value [String] The value
|
7
|
+
# @param provider [String] The provider
|
8
|
+
def initialize(value, provider = "iovation")
|
9
|
+
@value = value
|
10
|
+
@provider = provider
|
11
|
+
end
|
12
|
+
|
13
|
+
def represent
|
14
|
+
{
|
15
|
+
value: value,
|
16
|
+
provider: provider
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Evaluation parameters for a particular entity.
|
4
|
+
class EvaluationParams
|
5
|
+
attr_reader :use_selfie_verification, :required_verification
|
6
|
+
|
7
|
+
def initialize(use_selfie_verification = nil, required_verification = nil)
|
8
|
+
@use_selfie_verification = use_selfie_verification
|
9
|
+
@required_verificaion = required_verification
|
10
|
+
end
|
11
|
+
|
12
|
+
def represent
|
13
|
+
{
|
14
|
+
use_selfie_verification: use_selfie_verification,
|
15
|
+
required_verification: required_verification
|
16
|
+
}
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class FullName
|
4
|
+
attr_reader :first, :last
|
5
|
+
|
6
|
+
# @param first [String] The first name
|
7
|
+
# @param last [String] The last name
|
8
|
+
def initialize(first, last)
|
9
|
+
@first = first
|
10
|
+
@last = last
|
11
|
+
end
|
12
|
+
|
13
|
+
def represent
|
14
|
+
{
|
15
|
+
first: first,
|
16
|
+
last: last
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Officer
|
4
|
+
attr_reader :full_name, :date_of_birth, :address, :phone, :email,
|
5
|
+
:status, :title, :ssn, :passport, :nationality
|
6
|
+
|
7
|
+
# @param [FullName] full_name
|
8
|
+
# @param [Date] date_of_birth
|
9
|
+
# @param [Address] address
|
10
|
+
# @param [Phone] phone
|
11
|
+
# @param [String] email
|
12
|
+
# @param [String] ssn
|
13
|
+
# @param optional [String] status
|
14
|
+
# @param optional [String] title
|
15
|
+
# @param optional [String] passport
|
16
|
+
# @param optional [String] nationality
|
17
|
+
def initialize(full_name, date_of_birth, address, phone, email, ssn,
|
18
|
+
status = nil, title = nil, passport = nil,
|
19
|
+
nationality = nil)
|
20
|
+
@full_name = full_name
|
21
|
+
@date_of_birth = date_of_birth
|
22
|
+
@address = address
|
23
|
+
@phone = phone
|
24
|
+
@email = email
|
25
|
+
@status = status
|
26
|
+
@title = title
|
27
|
+
@ssn = ssn
|
28
|
+
@passport = passport
|
29
|
+
@nationality = nationality
|
30
|
+
end
|
31
|
+
|
32
|
+
def represent
|
33
|
+
payload =
|
34
|
+
{
|
35
|
+
fullName: full_name.represent,
|
36
|
+
dateOfBirth: date_of_birth,
|
37
|
+
address: address.represent,
|
38
|
+
phone: phone.represent,
|
39
|
+
email: email,
|
40
|
+
ssn: ssn,
|
41
|
+
status: status,
|
42
|
+
title: title,
|
43
|
+
passport: passport,
|
44
|
+
nationality: nationality
|
45
|
+
}
|
46
|
+
payload.compact
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class Phone
|
4
|
+
attr_reader :country_code, :number
|
5
|
+
|
6
|
+
# @param country_code [String] The country code
|
7
|
+
# @param number [String] The number
|
8
|
+
def initialize(country_code, number)
|
9
|
+
@country_code = country_code
|
10
|
+
@number = number
|
11
|
+
end
|
12
|
+
|
13
|
+
def represent
|
14
|
+
{
|
15
|
+
countryCode: country_code,
|
16
|
+
number: number
|
17
|
+
}
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "full_name"
|
4
|
+
require_relative "address"
|
5
|
+
require_relative "phone"
|
6
|
+
|
7
|
+
class PowerOfAttorneyAgent
|
8
|
+
attr_reader :status, :full_name, :ssn, :passport, :nationality,
|
9
|
+
:date_of_birth, :address, :phone, :email, :jwt_subject
|
10
|
+
|
11
|
+
# @param [String] status
|
12
|
+
# @param [FullName] full_name
|
13
|
+
# @param [String] ssn
|
14
|
+
# @param [String] passport
|
15
|
+
# @param [String] nationality
|
16
|
+
# @param [Date] date_of_birth
|
17
|
+
# @param [Address] address
|
18
|
+
# @param [Phone] phone
|
19
|
+
# @param [String] email
|
20
|
+
# @param [String] jwt_subject
|
21
|
+
def initialize(status, full_name, ssn, passport, nationality, date_of_birth, address, phone, email, jwt_subject)
|
22
|
+
@status = status
|
23
|
+
@full_name = full_name
|
24
|
+
@ssn = ssn
|
25
|
+
@passport = passport
|
26
|
+
@nationality = nationality
|
27
|
+
@date_of_birth = date_of_birth
|
28
|
+
@address = address
|
29
|
+
@phone = phone
|
30
|
+
@email = email
|
31
|
+
@jwt_subject = jwt_subject
|
32
|
+
end
|
33
|
+
|
34
|
+
def represent
|
35
|
+
{
|
36
|
+
status: status,
|
37
|
+
fullName: full_name.represent,
|
38
|
+
ssn: ssn,
|
39
|
+
passport: passport,
|
40
|
+
nationality: nationality,
|
41
|
+
dateOfBirth: date_of_birth,
|
42
|
+
address: address.represent,
|
43
|
+
phone: phone.represent,
|
44
|
+
email: email,
|
45
|
+
jwtSubject: jwt_subject
|
46
|
+
}
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# represents relationships in the JSON API payload
|
4
|
+
class Relationship
|
5
|
+
attr_accessor :id, :type
|
6
|
+
|
7
|
+
# @param id [String] The id of the relationship
|
8
|
+
# @param type [String] The type
|
9
|
+
def initialize(id, type)
|
10
|
+
@id = id
|
11
|
+
@type = type
|
12
|
+
end
|
13
|
+
|
14
|
+
# @param nested [Boolean] Whether or not the relationship is nested
|
15
|
+
def represent(nested: true)
|
16
|
+
nested ? { "data": { "id": id, "type": type } } : { "id": id, "type": type }
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# represents relationship Array in the JSON API payload
|
4
|
+
class RelationshipArray
|
5
|
+
attr_reader :data
|
6
|
+
|
7
|
+
# @param array [Array] The array of relationships
|
8
|
+
def initialize(array)
|
9
|
+
relationships = []
|
10
|
+
array.map do |item|
|
11
|
+
relationships << if item.is_a?(Relationship)
|
12
|
+
item
|
13
|
+
else
|
14
|
+
Relationship.new(item[:data][:id], item[:data][:type]).represent end
|
15
|
+
p item
|
16
|
+
end
|
17
|
+
@data = relationships
|
18
|
+
end
|
19
|
+
|
20
|
+
def represent
|
21
|
+
{ "data": data }
|
22
|
+
end
|
23
|
+
end
|
data/lib/unit/version.rb
ADDED
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: unit_ruby_sdk
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Unit
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2022-12-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rspec
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: This library provides a Ruby wrapper to http://unit.co API. See https://docs.unit.co/
|
28
|
+
email:
|
29
|
+
- engineering@unit.co
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".rspec"
|
35
|
+
- ".rubocop.yml"
|
36
|
+
- CHANGELOG.md
|
37
|
+
- Gemfile
|
38
|
+
- Gemfile.lock
|
39
|
+
- LICENSE.txt
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- lib/unit/api_resources/application_resource.rb
|
43
|
+
- lib/unit/api_resources/base_resource.rb
|
44
|
+
- lib/unit/api_resources/customer_resource.rb
|
45
|
+
- lib/unit/errors/unit_error.rb
|
46
|
+
- lib/unit/errors/unit_error_payload.rb
|
47
|
+
- lib/unit/models/applications/create_business_application_request.rb
|
48
|
+
- lib/unit/models/applications/create_individual_application_request.rb
|
49
|
+
- lib/unit/models/applications/list_application_params.rb
|
50
|
+
- lib/unit/models/applications/patch_application_request.rb
|
51
|
+
- lib/unit/models/applications/upload_document_request.rb
|
52
|
+
- lib/unit/models/customers/add_authorized_users_request.rb
|
53
|
+
- lib/unit/models/customers/archive_customer_request.rb
|
54
|
+
- lib/unit/models/customers/list_customer_params.rb
|
55
|
+
- lib/unit/models/customers/patch_business_customer_request.rb
|
56
|
+
- lib/unit/models/customers/patch_individual_customer_request.rb
|
57
|
+
- lib/unit/models/customers/remove_authorized_users_request.rb
|
58
|
+
- lib/unit/models/unit_resource.rb
|
59
|
+
- lib/unit/models/unit_response.rb
|
60
|
+
- lib/unit/types/address.rb
|
61
|
+
- lib/unit/types/authorized_user.rb
|
62
|
+
- lib/unit/types/beneficial_owner.rb
|
63
|
+
- lib/unit/types/business_contact.rb
|
64
|
+
- lib/unit/types/device_fingerprint.rb
|
65
|
+
- lib/unit/types/evaluation_params.rb
|
66
|
+
- lib/unit/types/full_name.rb
|
67
|
+
- lib/unit/types/officer.rb
|
68
|
+
- lib/unit/types/phone.rb
|
69
|
+
- lib/unit/types/power_of_attorney_agent.rb
|
70
|
+
- lib/unit/types/relationship.rb
|
71
|
+
- lib/unit/types/relationship_array.rb
|
72
|
+
- lib/unit/version.rb
|
73
|
+
- lib/unit_ruby_sdk.rb
|
74
|
+
homepage: https://github.com/unit-finance/unit-ruby-sdk
|
75
|
+
licenses:
|
76
|
+
- Mozilla Public License 2.0
|
77
|
+
metadata: {}
|
78
|
+
post_install_message:
|
79
|
+
rdoc_options: []
|
80
|
+
require_paths:
|
81
|
+
- lib
|
82
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
83
|
+
requirements:
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: 2.6.0
|
87
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - ">="
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: '0'
|
92
|
+
requirements: []
|
93
|
+
rubygems_version: 3.3.26
|
94
|
+
signing_key:
|
95
|
+
specification_version: 4
|
96
|
+
summary: This library provides a Ruby wrapper to http://unit.co API. See https://docs.unit.co/
|
97
|
+
test_files: []
|