Class: KYCAID::Address

Inherits:
Response
  • Object
show all
Extended by:
Client
Defined in:
lib/kycaid/address.rb

Overview

Address is wrapper for KYCAID Address endpoints.

Class Method Summary collapse

Methods included from Client

conn, file_payload, file_post, file_put, get, multipart_conn, patch, post, sandbox?

Methods inherited from Response

#handle_error, #initialize, respond

Constructor Details

This class inherits a constructor from KYCAID::Response

Class Method Details

.create(params) ⇒ Object

Creates new address, params is a Hash.

  • :applicant_id - required The applicant’s unique identificator that received in response of create an applicant.

  • :type - required The address type. Valid values are: ‘REGISTERED’, ‘BUSINESS’, ‘ADDITIONAL’.

  • :country - The country of the applicants’s address. Example: GB (ISO 3166-2).

  • :city - The city or town of the applicant’s address.

  • :postal_code - The post or zip code of the applicant’s address.

  • :full_address - The applicant’s full address.

Returns Response object, conatining address_id.



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/kycaid/address.rb', line 15

def self.create(params)
  response = KYCAID::Document.create(
    {
      front_file: params[:front_file],
      applicant_id: params[:applicant_id],
      type: 'ADDRESS_DOCUMENT'
    }
  )
  return response unless response.errors.nil?

  protected_params = params.slice(:country, :city, :postal_code, :full_address, :applicant_id, :type)

  respond(post("/addresses", protected_params))
end