Class: Yoti::DocScan::Session::Create::Objective

Inherits:
Object
  • Object
show all
Defined in:
lib/yoti/doc_scan/session/create/objective/objective.rb

Direct Known Subclasses

ProofOfAddressObjective

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ Objective

Returns a new instance of Objective.

Parameters:

  • type (String)

Raises:

  • (TypeError)


11
12
13
14
15
16
# File 'lib/yoti/doc_scan/session/create/objective/objective.rb', line 11

def initialize(type)
  raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(Objective)

  Validation.assert_is_a(String, type, 'type')
  @type = type
end

Instance Method Details

#as_json(*_args) ⇒ Object



22
23
24
25
26
# File 'lib/yoti/doc_scan/session/create/objective/objective.rb', line 22

def as_json(*_args)
  {
    type: @type
  }
end

#to_json(*_args) ⇒ Object



18
19
20
# File 'lib/yoti/doc_scan/session/create/objective/objective.rb', line 18

def to_json(*_args)
  as_json.to_json
end