Module: Unit::Application

Defined in:
lib/unit/models/application/application.rb,
lib/unit/models/application/list_application_params.rb,
lib/unit/models/application/upload_document_request.rb,
lib/unit/models/application/patch_application_request.rb,
lib/unit/models/application/create_business_application_request.rb,
lib/unit/models/application/create_individual_application_request.rb,
lib/unit/models/application/create_sole_proprietor_application_request.rb

Defined Under Namespace

Classes: CreateBusinessApplicationRequest, CreateIndividualApplicationRequest, CreateSoleProprietorApplicationRequest, ListApplicationParams, PatchApplicationRequest, UploadDocumentRequest

Constant Summary collapse

APPLICATION_LIST_OFFSET =
0
APPLICATION_LIST_LIMIT =
100

Class Method Summary collapse

Class Method Details

.create_business_application(name:, address:, phone:, state_of_incorporation:, ein:, contact:, officer:, beneficial_owners:, entity_type:, industry: nil, dba: nil, ip: nil, website: nil, tags: nil, idempotency_key: nil, device_fingerprints: nil, annual_revenue: nil, number_of_employees: nil, cash_flow: nil, year_of_incorporation: nil, countries_of_operation: nil, stock_symbol: nil, business_vertical: nil) ⇒ Object

Create a new business application by calling Unit’s API

Parameters:

  • name (String)
  • address (Address)
  • phone (Phone)
  • state_of_incorporation (String)
  • ein (String)
  • contact (BusinessContact)
  • officer (Officer)
  • beneficial_owners (Array)
  • entity_type (String)
  • industry (String) (defaults to: nil)
    • optional

  • dba (String) (defaults to: nil)
    • optional

  • ip (String) (defaults to: nil)
    • optional

  • website (String) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional

  • idempotency_key (String) (defaults to: nil)
    • optional

  • device_fingerprints (DeviceFingerprint) (defaults to: nil)
    • optional

  • annual_revenue (String) (defaults to: nil)
    • optional

  • number_of_employees (String) (defaults to: nil)
    • optional

  • cash_flow (String) (defaults to: nil)
    • optional

  • year_of_incorporation (String) (defaults to: nil)
    • optional

  • countries_of_operation (Array<String>) (defaults to: nil)
    • optional

  • stock_symbol (String) (defaults to: nil)
    • optional

  • business_vertical (String) (defaults to: nil)
    • optional

See Also:



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/unit/models/application/application.rb', line 40

def create_business_application(name:, address:, phone:, state_of_incorporation:, ein:, contact:,
                                officer:, beneficial_owners:, entity_type:, industry: nil, dba: nil, ip: nil, website: nil,
                                tags: nil, idempotency_key: nil, device_fingerprints: nil, annual_revenue: nil, number_of_employees: nil,
                                cash_flow: nil, year_of_incorporation: nil, countries_of_operation: nil, stock_symbol: nil, business_vertical: nil)

  request = CreateBusinessApplicationRequest.new(
    name, address, phone, state_of_incorporation, ein, contact, officer,
    beneficial_owners, entity_type, industry, dba, ip, website, tags, idempotency_key, device_fingerprints,
    annual_revenue, number_of_employees, cash_flow, year_of_incorporation, countries_of_operation, stock_symbol, business_vertical
  )

  Unit::Resource::ApplicationResource.create_application(request)
end

.create_individual_application(ssn:, full_name:, date_of_birth:, address:, email:, phone:, ip: nil, ein: nil, industry: nil, dba: nil, sole_proprietorship: nil, passport: nil, nationality: nil, device_fingerprints: nil, idempotency_key: nil, tags: nil, jwt_subject: nil, power_of_attorney_agent: nil, evaluation_params: nil, occupation: nil, annual_income: nil, source_of_income: nil) ⇒ UnitResponse, UnitError

Create a new individual application by calling Unit’s API

Parameters:

  • ssn (String)
  • full_name (FullName)
  • date_of_birth (Date)
  • address (Address)
  • email (String)
  • phone (Phone)
  • ip (String) (defaults to: nil)
    • optional

  • ein (String) (defaults to: nil)
    • optional

  • industry (String) (defaults to: nil)
    • optional

  • dba (String) (defaults to: nil)
    • optional

  • sole_proprietorship (Boolean) (defaults to: nil)
    • optional

  • passport (String) (defaults to: nil)
    • optional

  • nationality (String) (defaults to: nil)
    • optional

  • device_fingerprints (DeviceFingerprint) (defaults to: nil)
    • optional

  • idempotency_key (String) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional

  • jwt_subject (String) (defaults to: nil)
    • optional

  • power_of_attorney_agent (PowerOfAttorneyAgent) (defaults to: nil)
    • optional

  • evaluation_params (EvaluationParams) (defaults to: nil)
    • optional

  • occupation (String) (defaults to: nil)
    • optional

  • annual_income (String) (defaults to: nil)
    • optional

  • source_of_income (String) (defaults to: nil)
    • optional

Returns:

See Also:



79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/unit/models/application/application.rb', line 79

def create_individual_application(ssn:, full_name:, date_of_birth:, address:, email:, phone:, ip: nil, ein: nil,
                                  industry: nil, dba: nil, sole_proprietorship: nil, passport: nil, nationality: nil,
                                  device_fingerprints: nil, idempotency_key: nil, tags: nil, jwt_subject: nil,
                                  power_of_attorney_agent: nil, evaluation_params: nil, occupation: nil, annual_income: nil, source_of_income: nil)

  request = CreateIndividualApplicationRequest.new(
    ssn, full_name, date_of_birth, address, email, phone, ip, ein, industry, dba, sole_proprietorship, passport,
    nationality, device_fingerprints, idempotency_key, tags, jwt_subject, power_of_attorney_agent, evaluation_params,
    occupation, annual_income, source_of_income
  )
  Unit::Resource::ApplicationResource.create_application(request)
end

.create_sole_proprietor_application(nationality:, full_name:, date_of_birth:, address:, phone:, email:, ssn: nil, passport: nil, ein: nil, dba: nil, power_of_attorney_agent: nil, evaluation_params: nil, annual_revenue: nil, number_of_employees: nil, business_vertical: nil, website: nil, ip: nil, tags: nil, idempotency_key: nil, device_fingerprints: nil, jwt_subject: nil, sole_proprietorship: true) ⇒ UnitResponse, UnitError

Create a new sole proprietor application by calling Unit’s API

Parameters:

  • nationality (String)
  • full_name (FullName)
  • date_of_birth (Date)
  • address (Address)
  • phone (Phone)
  • email (String)
  • sole_proprietorship (Boolean) (defaults to: true)
  • ssn (String) (defaults to: nil)
    • optional

  • passport (String) (defaults to: nil)
    • optional

  • ein (String) (defaults to: nil)
    • optional

  • dba (String) (defaults to: nil)
    • optional

  • power_of_attorney_agent (PowerOfAttorneyAgent) (defaults to: nil)
    • optional

  • evaluation_params (EvaluationParams) (defaults to: nil)
    • optional

  • annual_revenue (String) (defaults to: nil)
    • optional

  • number_of_employees (String) (defaults to: nil)
    • optional

  • business_vertical (String) (defaults to: nil)
    • optional

  • website (String) (defaults to: nil)
    • optional

  • ip (String) (defaults to: nil)
    • optional

  • tags (Hash) (defaults to: nil)
    • optional

  • idempotency_key (String) (defaults to: nil)
    • optional

  • device_fingerprints (Array<DeviceFingerprint>) (defaults to: nil)
    • optional

  • jwt_subject (String) (defaults to: nil)
    • optional

Returns:

See Also:



117
118
119
120
121
122
123
124
125
126
127
# File 'lib/unit/models/application/application.rb', line 117

def create_sole_proprietor_application(nationality:, full_name:, date_of_birth:, address:, phone:,
                                       email:, ssn: nil, passport: nil, ein: nil, dba: nil, power_of_attorney_agent: nil, evaluation_params: nil,
                                       annual_revenue: nil, number_of_employees: nil, business_vertical: nil, website: nil, ip: nil, tags: nil,
                                       idempotency_key: nil, device_fingerprints: nil, jwt_subject: nil, sole_proprietorship: true)
  request = CreateSoleProprietorApplicationRequest.new(nationality, full_name, date_of_birth, address, phone,
                                                       email, ssn, passport, ein, dba, power_of_attorney_agent, evaluation_params,
                                                       annual_revenue, number_of_employees,
                                                       business_vertical, website, ip, tags, idempotency_key,
                                                       device_fingerprints, jwt_subject, sole_proprietorship: sole_proprietorship)
  Unit::Resource::ApplicationResource.create_application(request)
end

.get_application(application_id) ⇒ UnitResponse, UnitError

Get an application by calling Unit’s API

Parameters:

  • application_id (String)

Returns:

See Also:



161
162
163
# File 'lib/unit/models/application/application.rb', line 161

def get_application(application_id)
  Unit::Resource::ApplicationResource.get_application(application_id)
end

.list_applications(offset: APPLICATION_LIST_OFFSET, limit: APPLICATION_LIST_LIMIT, email: nil, tags: nil, query: nil, status: nil, sort: nil) ⇒ UnitResponse, UnitError

List applications by calling Unit’s API

Parameters:

  • offset (Integer) (defaults to: APPLICATION_LIST_OFFSET)

    Number of resources to skip.

  • limit (Integer) (defaults to: APPLICATION_LIST_LIMIT)

    The limit Maximum number of resources that will be returned.

  • email (String) (defaults to: nil)

    Filter applications by email address (case sensitive).

  • tags (String) (defaults to: nil)

    Filter applications by tags. More information regarding tags: docs.unit.co/#tags

  • query (String) (defaults to: nil)

    Search term according to the: docs.unit.co/#full-text-search

  • status (String) (defaults to: nil)

    Filter applications by status: docs.unit.co/applications/#application-statuses

  • sort (String) (defaults to: nil)

    Sorts the resources by the specified field.

  • sort=createdAt (Hash)

    a customizable set of options

  • sort=-createdAt (Hash)

    a customizable set of options

Returns:

See Also:



152
153
154
155
# File 'lib/unit/models/application/application.rb', line 152

def list_applications(offset: APPLICATION_LIST_OFFSET, limit: APPLICATION_LIST_LIMIT, email: nil, tags: nil, query: nil, status: nil, sort: nil)
  request = Unit::Application::ListApplicationParams.new(offset, limit, email, tags, query, status, sort)
  Unit::Resource::ApplicationResource.list_applications(request)
end

.update_application(application_id:, type:, tags: nil) ⇒ UnitResponse, UnitError

Update an application by calling Unit’s API

Parameters:

  • application_id (String)

    The application id

  • type (String)

    The type

  • tags (Hash) (defaults to: nil)

    The tags

Returns:

See Also:



135
136
137
138
# File 'lib/unit/models/application/application.rb', line 135

def update_application(application_id:, type:, tags: nil)
  request = PatchApplicationRequest.new(application_id, type, tags)
  Unit::Resource::ApplicationResource.update(request)
end

.upload_document(application_id:, document_id:, file:, file_type:, is_back_side: false) ⇒ UnitResponse, UnitError

Upload an application document by calling Unit’s API

Parameters:

  • application_id (String)

    The application ID

  • document_id (String)

    The document ID

  • file (String)

    The file content

  • file_type (String)

    The file type. One of the Unit::Types::DocumentFileType constants.

  • is_back_side (Boolean) (defaults to: false)

    The file is back side

Returns:

See Also:



173
174
175
176
# File 'lib/unit/models/application/application.rb', line 173

def upload_document(application_id:, document_id:, file:, file_type:, is_back_side: false)
  request = UploadDocumentRequest.new(application_id, document_id, file, file_type, is_back_side: is_back_side)
  Unit::Resource::ApplicationResource.upload(request)
end