Class: SilaRuby::Entities

Inherits:
Object
  • Object
show all
Includes:
ApiHelpers
Defined in:
lib/sila-ruby/entities.rb

Overview

==============================================

ENTITIES =====================================

Class Method Summary collapse

Methods included from ApiHelpers

included

Class Method Details

.add_registration(handle, params = {}, valid_path, user_key) ⇒ Object


ADD-REGISTRATION ---------------------------

Add a new email, phone number, street address, or identity to a registered entity.



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/sila-ruby/entities.rb', line 109

def self.add_registration(handle, params={}, valid_path, user_key)
  header = { user_handle: handle }
  message = 'header_msg'

  # Valid path options
  #
  # email
  # phone
  # identity
  # address
  #
  #
  # Example of params passed
  #
  # params = {
  #   email: "[email protected]"
  # }

  sila_post_signed('add/' + valid_path, header, message, params, user_key)
end

.check_handle(handle) ⇒ Object


CHECK-HANDLE -------------------------------

Check if a specific handle is taken



20
21
22
23
24
# File 'lib/sila-ruby/entities.rb', line 20

def self.check_handle(handle)
  header = { user_handle: handle }
  message = 'header_msg'
  sila_post_signed('check_handle', header, message, nil, nil)
end

.check_kyc(handle, user_key) ⇒ Object


CHECK-KYC ----------------------------------

Whether entity attached to user handle is verified, not valid, or pending



213
214
215
216
217
# File 'lib/sila-ruby/entities.rb', line 213

def self.check_kyc(handle, user_key)
  header = { user_handle: handle }
  message = 'header_msg'
  sila_post_signed('check_kyc', header, message, nil, user_key)
end

.check_partner_kyc(params = {}) ⇒ Object


CHECK-PARTNER-KYC --------------------------

Check KYC status of end-users across apps



277
278
279
280
281
282
283
284
285
286
287
288
# File 'lib/sila-ruby/entities.rb', line 277

def self.check_partner_kyc(params={})
  message = 'header_msg'

  # Example of params passed for partner
  #
  # params = {
  #   query_app_handle: "PARTNER_COMPANY_APP",
  #   query_user_handle: "PARTNER_USER_HANDLE"
  # }

  sila_post_signed('check_partner_kyc', {}, message, params, nil)
end

.delete_registration(handle, params = {}, valid_path, user_key) ⇒ Object


DELETE-REGISTRATION ------------------------

Delete an existing email, phone number, street address, or identity.



161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/sila-ruby/entities.rb', line 161

def self.delete_registration(handle, params={}, valid_path, user_key)
  header = { user_handle: handle }
  message = 'header_msg'

  # Valid path options
  #
  # email
  # phone
  # identity
  # address
  #
  #
  # Example of params passed
  #
  # params = {
  #   uuid: "7f83044b-63c8-4d56-b107-d52fa7ae2d7a"
  # }

  sila_post_signed('delete/' + valid_path, header, message, params, user_key)
end

.get_entities(params = {}) ⇒ Object


GET-ENTITIES -------------------------------

Return all end-user and legal entities (businesses) associated with a customer application. This endpoint allows the listing of all entities registered to an application.



234
235
236
237
238
239
240
241
242
# File 'lib/sila-ruby/entities.rb', line 234

def self.get_entities(params={})
  message = 'header_msg'

  # params = {
  #   entity_type: "individual"
  # }

  sila_post_signed('get_entities', {}, message, params, nil)
end

.get_entity(handle, user_key) ⇒ Object


GET-ENTITY ---------------------------------

Gets identifying information about a registered entity.



248
249
250
251
# File 'lib/sila-ruby/entities.rb', line 248

def self.get_entity(handle, user_key)
  header = { user_handle: handle }
  sila_post_signed('check_handle', header, nil, nil, user_key)
end

.register(handle, params = {}) ⇒ Object


REGISTER -----------------------------------

Attaches KYC and blockchain address to user handle



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/sila-ruby/entities.rb', line 30

def self.register(handle, params={})
  header = { user_handle: handle }
  message = 'entity_msg'

  # Example of params passed for USER
  #
  # params = {
  #   address: {
  #     address_alias: "home",
  #     street_address_1: "123 Main Street",
  #     city: "New City",
  #     state: "OR",
  #     country: "US",
  #     postal_code: "97204-1234"
  #   },
  #   identity: {
  #     identity_alias: "SSN",
  #     identity_value: "123452222"
  #   },
  #   contact: {
  #     phone: "503-123-4567",
  #     contact_alias: "",
  #     email: "[email protected]"
  #   },
  #   crypto_entry: {
  #     crypto_alias: "Address 1",
  #     crypto_address: "0x1234567890abcdef1234567890abcdef12345678",
  #     crypto_code: "ETH"
  #   },
  #   entity: {
  #     birthdate: "1900-01-31",
  #     entity_name: "Example User",
  #     first_name: "Example",
  #     last_name: "User",
  #     relationship: "user"
  #   }
  # }
  #
  #
  # Example of params passed for BUSINESS
  #
  # params = {
  #   identity: {
  #     identity_alias: "EIN",
  #     identity_value: "12-1234567"
  #   },
  #   address: {
  #     address_alias: "Office",
  #     street_address_1: "123 Candelabra Blvd.",
  #     city: "Portland",
  #     state: "OR",
  #     country: "US",
  #     postal_code: "97204"
  #   },
  #   contact: {
  #     phone: "1231231234",
  #     email: "[email protected]"
  #   },
  #   entity: {
  #     type: "business",
  #     entity_name: "Your Business Customer, Inc.",
  #     business_type: "corporation",
  #     business_website: "https://www.yourbusinesscustomer.com",
  #     doing_business_as: "Your Business Customer Alias Co.",
  #     naics_code: 721
  #   },
  #   crypto_entry: {
  #     crypto_code: "ETH",
  #     crypto_address: "0x67CB...E1FB"
  #   }
  # }

  sila_post_signed('register', header, message, params, nil)
end

.request_kyc(handle, params = {}, user_key) ⇒ Object


REQUEST-KYC --------------------------------

Start KYC verification process on a registered user handle



196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/sila-ruby/entities.rb', line 196

def self.request_kyc(handle, params={}, user_key)
  header = { user_handle: handle }
  message = 'header_msg'

  # Optional params for requesting KYC
  #
  # params = {
  #   kyc_level: "NONE"
  # }

  sila_post_signed('request_kyc', header, message, params, user_key)
end

.update_registration(handle, params = {}, valid_path, user_key) ⇒ Object


UPDATE-REGISTRATION ------------------------

Update an existing email, phone number, street address, identity, or entity (name, birthdate, or business data).



134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/sila-ruby/entities.rb', line 134

def self.update_registration(handle, params={}, valid_path, user_key)
  header = { user_handle: handle }
  message = 'header_msg'

  # Valid path options
  #
  # email
  # phone
  # identity
  # address
  # entity
  #
  #
  # Example of params passed
  #
  # params = {
  #   uuid: "7f83044b-63c8-4d56-b107-d52fa7ae2d7a",
  #   email: "[email protected]"
  # }

  sila_post_signed('update/' + valid_path, header, message, params, user_key)
end