Class: SVBClient::Onboarding
- Inherits:
-
Object
- Object
- SVBClient::Onboarding
- Defined in:
- lib/svbclient.rb
Defined Under Namespace
Classes: Address, Company, Document, File, GovIdent, Login, ParentCompany, Person, Resource
Instance Method Summary collapse
- #address(id: nil, street_line1: nil, street_line2: nil, street_line3: nil, city: nil, state: nil, postal_code: nil, country: nil) ⇒ Object
- #company(id: nil, description: nil, document_ids: [], email_address: nil, incorporation_address_id: -1,, mailing_address_id: -1,, metadata: nil, mcc: -1,, name: nil, options: nil, parent_company_id: -1,, person_ids: [], phone_number: nil, physical_address_id: -1,, product_description: nil, products: [], referral_source: nil, risk_commentary: nil, source_of_funds: nil, state: nil, website_url: nil, documents: nil, incorporation_address: nil, mailing_address: nil, parent_company: nil, persons: nil, physical_address: nil) ⇒ Object
- #document(id: nil, document_type: nil, file_id: -1,, metadata: nil, number: nil, file: nil) ⇒ Object
- #file(id: nil, file: nil, mimetype: nil) ⇒ Object
- #gov_ident(id: nil, country: nil, document_type: nil, expires_on: nil, file_id: -1,, first_name: nil, last_name: nil, middle_name: nil, number: nil, file: nil) ⇒ Object
-
#initialize(client) ⇒ Onboarding
constructor
A new instance of Onboarding.
- #login(id: nil, login_name: nil, reservation_expires: nil) ⇒ Object
- #parent_company(id: nil, address_id: -1,, address: nil, country: nil, description: nil, name: nil, metadata: nil, percent_ownership: -1,, source_of_funds: nil) ⇒ Object
- #person(id: nil, address_id: -1,, address: nil, date_of_birth: nil, email_address: nil, first_name: nil, gov_idents: [], gov_ident_ids: [], last_name: nil, login_id: -1,, login: nil, metadata: nil, middle_name: nil, percent_ownership: -1,, phone_number: nil, risk_commentary: nil, roles: [], title: nil) ⇒ Object
Constructor Details
#initialize(client) ⇒ Onboarding
Returns a new instance of Onboarding.
89 90 91 92 |
# File 'lib/svbclient.rb', line 89 def initialize(client) raise 'provide an API client' if client.nil? @client = client end |
Instance Method Details
#address(id: nil, street_line1: nil, street_line2: nil, street_line3: nil, city: nil, state: nil, postal_code: nil, country: nil) ⇒ Object
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/svbclient.rb', line 94 def address(id: nil, street_line1: nil, street_line2: nil, street_line3: nil, city: nil, state: nil, postal_code: nil, country: nil) if id.nil? # generate this address add = @client.post('/v1/addresses', { street_line1: street_line1, street_line2: street_line2, street_line3: street_line3, city: city, state: state, postal_code: postal_code, country: country }) body = JSON.parse(add.body) SVBClient::Onboarding::Address.new(@client, body["data"]["id"]) else # verify that the address exists @client.get("/v1/addresses/#{id}") SVBClient::Onboarding::Address.new(@client, id) end end |
#company(id: nil, description: nil, document_ids: [], email_address: nil, incorporation_address_id: -1,, mailing_address_id: -1,, metadata: nil, mcc: -1,, name: nil, options: nil, parent_company_id: -1,, person_ids: [], phone_number: nil, physical_address_id: -1,, product_description: nil, products: [], referral_source: nil, risk_commentary: nil, source_of_funds: nil, state: nil, website_url: nil, documents: nil, incorporation_address: nil, mailing_address: nil, parent_company: nil, persons: nil, physical_address: nil) ⇒ Object
115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/svbclient.rb', line 115 def company(id: nil, description: nil, document_ids: [], email_address: nil, incorporation_address_id: -1, mailing_address_id: -1, metadata: nil, mcc: -1, name: nil, options: nil, parent_company_id: -1, person_ids: [], phone_number: nil, physical_address_id: -1, product_description: nil, products: [], referral_source: nil, risk_commentary: nil, source_of_funds: nil, state: nil, website_url: nil, documents: nil, incorporation_address: nil, mailing_address: nil, parent_company: nil, persons: nil, physical_address: nil) if id.nil? # generate this address unless documents.nil? document_ids = documents.map do |document| document.id end end unless persons.nil? person_ids = persons.map do |person| person.id end end incorporation_address_id = incorporation_address.id unless incorporation_address.nil? mailing_address_id = mailing_address.id unless mailing_address.nil? physical_address_id = physical_address.id unless physical_address.nil? parent_company_id = parent_company.id unless parent_company.nil? resource = @client.post('/v1/companies', { description: description, document_ids: document_ids, email_address: email_address, incorporation_address_id: incorporation_address_id, mailing_address_id: mailing_address_id, metadata: , mcc: mcc, name: name, options: , parent_company_id: parent_company_id, person_ids: person_ids, phone_number: phone_number, physical_address_id: physical_address_id, product_description: product_description, products: products, referral_source: referral_source, risk_commentary: risk_commentary, source_of_funds: source_of_funds, state: state, website_url: website_url }) body = JSON.parse(resource.body) SVBClient::Onboarding::Company.new(@client, body["data"]["id"]) else # verify that the resource exists @client.get("/v1/companies/#{id}") SVBClient::Onboarding::Company.new(@client, id) end end |
#document(id: nil, document_type: nil, file_id: -1,, metadata: nil, number: nil, file: nil) ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/svbclient.rb', line 171 def document(id: nil, document_type: nil, file_id: -1, metadata: nil, number: nil, file: nil) if id.nil? # generate this address file_id = file.id unless file.nil? resource = @client.post('/v1/documents', { document_type: document_type, file_id: file_id, metadata: , number: number }) body = JSON.parse(resource.body) SVBClient::Onboarding::Document.new(@client, body["data"]["id"]) else # verify that the resource exists @client.get("/v1/documents/#{id}") SVBClient::Onboarding::Document.new(@client, id) end end |
#file(id: nil, file: nil, mimetype: nil) ⇒ Object
192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/svbclient.rb', line 192 def file(id: nil, file: nil, mimetype: nil) if id.nil? # upload this file resource = @client.upload("/v1/files", file, mimetype) body = JSON.parse(resource.body) SVBClient::Onboarding::File.new(@client, id) else # verify that the resource exists @client.get("/v1/files/#{id}") SVBClient::Onboarding::File.new(@client, id) end end |
#gov_ident(id: nil, country: nil, document_type: nil, expires_on: nil, file_id: -1,, first_name: nil, last_name: nil, middle_name: nil, number: nil, file: nil) ⇒ Object
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/svbclient.rb', line 205 def gov_ident(id: nil, country: nil, document_type: nil, expires_on: nil, file_id: -1, first_name: nil, last_name: nil, middle_name: nil, number: nil, file: nil) if id.nil? # generate this address file_id = file.id unless file.nil? resource = @client.post('/v1/gov_idents', { country: country, document_type: document_type, expires_on: expires_on, file_id: file_id, first_name: first_name, last_name: last_name, middle_name: middle_name, number: number }) body = JSON.parse(resource.body) SVBClient::Onboarding::GovIdent.new(@client, body["data"]["id"]) else # verify that the resource exists @client.get("/v1/gov_idents/#{id}") SVBClient::Onboarding::GovIdent.new(@client, id) end end |
#login(id: nil, login_name: nil, reservation_expires: nil) ⇒ Object
231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/svbclient.rb', line 231 def login(id: nil, login_name: nil, reservation_expires: nil) if id.nil? # generate this address resource = @client.post('/v1/logins', { login_name: login_name, reservation_expires: reservation_expires }) body = JSON.parse(resource.body) SVBClient::Onboarding::Login.new(@client, body["data"]["id"]) else # verify that the resource exists @client.get("/v1/logins/#{id}") SVBClient::Onboarding::Login.new(@client, id) end end |
#parent_company(id: nil, address_id: -1,, address: nil, country: nil, description: nil, name: nil, metadata: nil, percent_ownership: -1,, source_of_funds: nil) ⇒ Object
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 |
# File 'lib/svbclient.rb', line 247 def parent_company(id: nil, address_id: -1, address: nil, country: nil, description: nil, name: nil, metadata: nil, percent_ownership: -1, source_of_funds: nil) if id.nil? # generate this address address_id = address.id unless address.nil? resource = @client.post('/v1/parent_companies', { address_id: address_id, country: country, description: description, name: name, metadata: , percent_ownership: percent_ownership, source_of_funds: source_of_funds }) body = JSON.parse(resource.body) SVBClient::Onboarding::ParentCompany.new(@client, body["data"]["id"]) else # verify that the resource exists @client.get("/v1/parent_companies/#{id}") SVBClient::Onboarding::ParentCompany.new(@client, id) end end |
#person(id: nil, address_id: -1,, address: nil, date_of_birth: nil, email_address: nil, first_name: nil, gov_idents: [], gov_ident_ids: [], last_name: nil, login_id: -1,, login: nil, metadata: nil, middle_name: nil, percent_ownership: -1,, phone_number: nil, risk_commentary: nil, roles: [], title: nil) ⇒ Object
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
# File 'lib/svbclient.rb', line 272 def person(id: nil, address_id: -1, address: nil, date_of_birth: nil, email_address: nil, first_name: nil, gov_idents: [], gov_ident_ids: [], last_name: nil, login_id: -1, login: nil, metadata: nil, middle_name: nil, percent_ownership: -1, phone_number: nil, risk_commentary: nil, roles: [], title: nil) if id.nil? # generate this address unless gov_idents.nil? gov_ident_ids = gov_idents.map do |gov_ident| gov_ident.id end end address_id = address.id unless address.nil? login_id = login.id unless login.nil? resource = @client.post('/v1/persons', { address_id: address_id, date_of_birth: date_of_birth, email_address: email_address, first_name: first_name, gov_ident_ids: gov_ident_ids, last_name: last_name, login_id: login_id, metadata: , middle_name: middle_name, percent_ownership: percent_ownership, phone_number: phone_number, risk_commentary: risk_commentary, roles: roles, title: title }) body = JSON.parse(resource.body) SVBClient::Onboarding::Person.new(@client, body["data"]["id"]) else # verify that the resource exists @client.get("/v1/persons/#{id}") SVBClient::Onboarding::Person.new(@client, id) end end |