Class: Onfido::API

Inherits:
Object
  • Object
show all
Defined in:
lib/onfido/api.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



3
4
5
6
7
8
# File 'lib/onfido/api.rb', line 3

def method_missing(method, *args)
  klass = method.to_s.capitalize
  Object.const_get("Onfido::#{klass}").new
rescue NameError
  super
end

Instance Method Details

#respond_to_missing?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
# File 'lib/onfido/api.rb', line 10

def respond_to_missing?(method, include_private = false)
  klass = method.to_s.capitalize
  Object.const_get("Onfido::#{klass}")
  true
rescue NameError
  super
end