Class: Yoti::Sandbox::Profile::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/yoti_sandbox/profile/attribute.rb

Overview

Represents an attribute that can be used by the profile sandbox service

Instance Method Summary collapse

Constructor Details

#initialize(name: '', value: '', derivation: '', anchors: []) ⇒ Attribute

Returns a new instance of Attribute.

Parameters:

  • name (String) (defaults to: '')
  • value (String) (defaults to: '')
  • derivation (String) (defaults to: '')
  • anchors (Array<Anchor>) (defaults to: [])


16
17
18
19
20
21
22
23
24
25
26
# File 'lib/yoti_sandbox/profile/attribute.rb', line 16

def initialize(
  name: '',
  value: '',
  derivation: '',
  anchors: []
)
  @name = name
  @value = value
  @derivation = derivation
  @anchors = anchors
end

Instance Method Details

#as_json(*_args) ⇒ Hash

Returns:

  • (Hash)


31
32
33
34
35
36
37
38
# File 'lib/yoti_sandbox/profile/attribute.rb', line 31

def as_json(*_args)
  {
    name: @name,
    value: @value,
    derivation: @derivation,
    anchors: @anchors.map(&:as_json)
  }
end

#to_json(*args) ⇒ String

Returns:

  • (String)


43
44
45
# File 'lib/yoti_sandbox/profile/attribute.rb', line 43

def to_json(*args)
  as_json(*args).to_json
end