Class: Yoti::Sandbox::Profile::DataEntry
- Inherits:
-
Object
- Object
- Yoti::Sandbox::Profile::DataEntry
- Defined in:
- lib/yoti_sandbox/profile/extra_data.rb
Overview
Base DataEntry
Direct Known Subclasses
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(type, value) ⇒ DataEntry
constructor
A new instance of DataEntry.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(type, value) ⇒ DataEntry
Returns a new instance of DataEntry.
43 44 45 46 47 48 49 50 51 |
# File 'lib/yoti_sandbox/profile/extra_data.rb', line 43 def initialize(type, value) raise(TypeError, "#{self.class} cannot be instantiated") if instance_of?(DataEntry) Validation.assert_is_a(String, type, 'type') @type = type Validation.assert_respond_to(:as_json, value, 'value') @value = value end |
Instance Method Details
#as_json(*_args) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/yoti_sandbox/profile/extra_data.rb', line 57 def as_json(*_args) { type: @type, value: @value.as_json } end |
#to_json(*_args) ⇒ Object
53 54 55 |
# File 'lib/yoti_sandbox/profile/extra_data.rb', line 53 def to_json(*_args) as_json.to_json end |