Class: Igniter::LedgerClient::Results::LineageResult

Inherits:
Object
  • Object
show all
Includes:
HashAccess
Defined in:
lib/igniter/ledger_client/results.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from HashAccess

#[]

Constructor Details

#initialize(raw = {}) ⇒ LineageResult

Returns a new instance of LineageResult.



260
261
262
263
264
265
266
267
268
# File 'lib/igniter/ledger_client/results.rb', line 260

def initialize(raw = {})
  data = normalize_hash(raw)
  @subject = normalize_hash(data[:subject]).freeze
  @chain = Array(data[:chain]).map { |entry| normalize_hash(entry) }.freeze
  @depth = data.key?(:depth) ? data[:depth].to_i : chain.size
  @derived_by = Array(data[:derived_by]).map { |entry| normalize_hash(entry) }.freeze
  @proof_hash = data[:proof_hash]
  freeze
end

Instance Attribute Details

#chainObject (readonly)

Returns the value of attribute chain.



258
259
260
# File 'lib/igniter/ledger_client/results.rb', line 258

def chain
  @chain
end

#depthObject (readonly)

Returns the value of attribute depth.



258
259
260
# File 'lib/igniter/ledger_client/results.rb', line 258

def depth
  @depth
end

#derived_byObject (readonly)

Returns the value of attribute derived_by.



258
259
260
# File 'lib/igniter/ledger_client/results.rb', line 258

def derived_by
  @derived_by
end

#proof_hashObject (readonly)

Returns the value of attribute proof_hash.



258
259
260
# File 'lib/igniter/ledger_client/results.rb', line 258

def proof_hash
  @proof_hash
end

#subjectObject (readonly)

Returns the value of attribute subject.



258
259
260
# File 'lib/igniter/ledger_client/results.rb', line 258

def subject
  @subject
end

Instance Method Details

#to_hObject



270
271
272
273
274
275
276
277
278
# File 'lib/igniter/ledger_client/results.rb', line 270

def to_h
  {
    subject: subject,
    chain: chain,
    depth: depth,
    derived_by: derived_by,
    proof_hash: proof_hash
  }
end