Class: Alloy::KYC::Backends::Mock

Inherits:
Object
  • Object
show all
Defined in:
lib/alloy/kyc/backends/mock.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMock

Returns a new instance of Mock.



11
12
13
14
# File 'lib/alloy/kyc/backends/mock.rb', line 11

def initialize
  @database = generate_fake_data
  nil
end

Instance Attribute Details

#bearer_tokenObject

Returns the value of attribute bearer_token.



9
10
11
# File 'lib/alloy/kyc/backends/mock.rb', line 9

def bearer_token
  @bearer_token
end

#databaseObject

Returns the value of attribute database.



9
10
11
# File 'lib/alloy/kyc/backends/mock.rb', line 9

def database
  @database
end

Instance Method Details

#create_evaluation(params) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/alloy/kyc/backends/mock.rb', line 24

def create_evaluation(params)
  if !params[:document_ssn].nil? && params[:document_ssn] == "111223333"
    wrap_in_struct(database[:create_evaluations][:requires_oow])
  else
    wrap_in_struct(database[:create_evaluations][:success])
  end
end

#fork_evaluation(path) ⇒ Object



40
41
42
# File 'lib/alloy/kyc/backends/mock.rb', line 40

def fork_evaluation(path)
  wrap_in_struct(database[:fork_evaluation][:success])
end

#get_bearer_tokenObject



16
17
18
# File 'lib/alloy/kyc/backends/mock.rb', line 16

def get_bearer_token
  @bearer_token = BearerToken.new("access_token", Time.now + (60*60*24*365))
end

#requires_bearer_token?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/alloy/kyc/backends/mock.rb', line 20

def requires_bearer_token?
  bearer_token.nil? || bearer_token.expired?
end

#submit_oow_responses(path, responses) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/alloy/kyc/backends/mock.rb', line 32

def submit_oow_responses(path, responses)
  if responses[:document_ssn] == "111223333"
    wrap_in_struct(database[:submit_oow_responses][:requires_oow])
  else
    wrap_in_struct(database[:submit_oow_responses][:success])
  end
end