class Bitex::KycProfile

Documentation here!

Attributes

accepted_usage_tier[RW]

@!attribute accepted_usage_tier

@return [Symbol] Current usage tier as accepted by our compliance officers.
birth_date[RW]

@!attribute birth_date

@return [Time] Birth date.
first_name[RW]

@!attribute first_name

@return [String] Name.
gender[RW]

@!attribute gender

@return [Symbol] Gender.
home_address[RW]

@!attribute home_address

@return [String] Home address.
id[RW]

@!attribute id

@return [Integer] This KycProfile's unique ID.
last_name[RW]

@!attribute last_name

@return [String] Last Name.
nationality[RW]

@!attribute nationality

@return [String] Nationality.
occupation[RW]

@!attribute occupation

@return [String]
personal_id_issuer[RW]

@!attribute personal_id_issuer

@return [String] ISO country code for the issuer of this ID.
personal_id_number[RW]

@!attribute personal_id_number

@return [String] Personal ID Number.
personal_id_type[RW]

@!attribute personal_id_type

@return [symbol] Type of ID. [:passport]
phone_numbers[RW]

@!attribute phone_numbers

@return [String] Phone numbers.
politically_exposed_person[RW]

@!attribute politically_exposed_person

@return [Boolean] Is politically exposed.
tax_id[RW]

@!attribute tax_id

@return [Intger] Tax ID.
usage_tier[RW]

@!attribute usage_tier

@return [Symbol] Requested usage tier.
work_address[RW]

@!attribute work_address

@return [String] Work address.

Public Class Methods

all() click to toggle source
# File lib/bitex/kyc_profile.rb, line 112
def self.all
  Api.private(:get, '/private/kyc_profiles').map { |kyc| from_json(kyc) }
end
create!(params) click to toggle source

rubocop:enable Metrics/AbcSize

# File lib/bitex/kyc_profile.rb, line 104
def self.create!(params)
  from_json(Api.private(:post, '/private/kyc_profiles', sanitize(params)))
end
find(id) click to toggle source
# File lib/bitex/kyc_profile.rb, line 108
def self.find(id)
  from_json(Api.private(:get, "/private/kyc_profiles/#{id}"))
end
from_json(json) click to toggle source

@visibility private rubocop:disable Metrics/AbcSize

# File lib/bitex/kyc_profile.rb, line 80
def self.from_json(json)
  new.tap do |profile|
    profile.id = json[0]
    profile.first_name = json[1]
    profile.last_name = json[2]
    profile.personal_id_number = json[3]
    profile.personal_id_issuer = json[4]
    profile.personal_id_type = json[5].to_sym
    profile.tax_id = json[6]
    profile.birth_date = json[7] ? Time.at(json[7]) : nil
    profile.nationality = json[8]
    profile.gender = json[9].to_sym
    profile.occupation = json[10]
    profile.home_address = json[11]
    profile.work_address = json[12]
    profile.phone_numbers = json[13]
    profile.legal_entity = json[14]
    profile.politically_exposed_person = json[15]
    profile.usage_tier = json[16].to_sym
    profile.accepted_usage_tier = json[17].to_sym
  end
end
sanitize(params) click to toggle source
# File lib/bitex/kyc_profile.rb, line 116
def self.sanitize(params)
  params.merge(birth_date: params[:birth_date].strftime('%Y/%m/%d'))
end

Public Instance Methods

add_kyc_file!(path, content_type = nil) click to toggle source
# File lib/bitex/kyc_profile.rb, line 124
def add_kyc_file!(path, content_type = nil)
  response = Api.private(
    :post,
    "/private/kyc_profiles/#{id}/kyc_files",
    { document_content_type: content_type },
    document: path
  )

  KycFile.from_json(response)
end
kyc_files() click to toggle source
# File lib/bitex/kyc_profile.rb, line 135
def kyc_files
  Api.private(:get, "/private/kyc_profiles/#{id}/kyc_files").map { |kyc| KycFile.from_json(kyc) }
end
update!(params) click to toggle source
# File lib/bitex/kyc_profile.rb, line 120
def update!(params)
  self.class.from_json(Api.private(:put, "/private/kyc_profiles/#{id}", self.class.sanitize(params)))
end