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.
240 241 242 243 |
# File 'lib/svbclient.rb', line 240 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
245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/svbclient.rb', line 245 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
266 267 268 269 270 271 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 311 312 313 314 315 316 317 318 319 320 |
# File 'lib/svbclient.rb', line 266 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
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
# File 'lib/svbclient.rb', line 322 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
343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/svbclient.rb', line 343 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
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 |
# File 'lib/svbclient.rb', line 356 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
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/svbclient.rb', line 382 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
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 |
# File 'lib/svbclient.rb', line 398 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
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 |
# File 'lib/svbclient.rb', line 423 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 |