Class: Alloy::KYC::Evaluation

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/alloy/kyc/evaluation.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Evaluation

Returns a new instance of Evaluation.



10
11
12
13
# File 'lib/alloy/kyc/evaluation.rb', line 10

def initialize(response)
  super(response)
  self.raw_response = response
end

Class Method Details

.create(params) ⇒ Object



5
6
7
8
# File 'lib/alloy/kyc/evaluation.rb', line 5

def self.create(params)
  response = Alloy::KYC.configuration.backend.create_evaluation(params)
  new(JSON.parse(response.body))
end

Instance Method Details

#denied?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/alloy/kyc/evaluation.rb', line 23

def denied?
  summary['result'] == "success" && status_code != 206 && summary['outcome'] == "denied"
end

#forkObject



48
49
50
51
# File 'lib/alloy/kyc/evaluation.rb', line 48

def fork
  response = Alloy::KYC.configuration.backend.fork_evaluation("evaluations/#{self.evaluation_token}")
  self.class.new(JSON.parse(response.body))
end

#manual_review?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/alloy/kyc/evaluation.rb', line 27

def manual_review?
  summary['result'] == "success" && status_code != 206 && summary['outcome'] == "manual review"
end

#partial_success?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/alloy/kyc/evaluation.rb', line 19

def partial_success?
  summary["result"] == "success" && status_code == 206
end

#requires_oow?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/alloy/kyc/evaluation.rb', line 31

def requires_oow?
  !!self.required
end

#submit_oow_responses(responses) ⇒ Object

responses should be in the format: [

{question_id: 1, answer_id: 2,
2, answer_id: 4,
....

], name_first: “Charles”, name_last: “Hearn”}



43
44
45
46
# File 'lib/alloy/kyc/evaluation.rb', line 43

def submit_oow_responses(responses)
  response = Alloy::KYC.configuration.backend.submit_oow_responses("evaluations/#{self.evaluation_token}", responses)
  self.class.new(JSON.parse(response.body))
end

#success?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/alloy/kyc/evaluation.rb', line 15

def success?
  summary["result"] == "success" && status_code != 206
end