Class: Chainpoint::ProofHandle

Inherits:
Object
  • Object
show all
Defined in:
lib/chainpoint/proof_handle.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(uri, node_hash_id) ⇒ ProofHandle

Returns a new instance of ProofHandle

Raises:

  • (ArgumentError)


7
8
9
10
11
12
13
# File 'lib/chainpoint/proof_handle.rb', line 7

def initialize(uri, node_hash_id)
  raise ArgumentError, 'Proof Handle uri not specified' unless uri
  raise ArgumentError, 'Proof Handle node_hash_id not specified' unless node_hash_id

  @uri = uri
  @node_hash_id = node_hash_id
end

Instance Attribute Details

#node_hash_idObject (readonly)

Returns the value of attribute node_hash_id



5
6
7
# File 'lib/chainpoint/proof_handle.rb', line 5

def node_hash_id
  @node_hash_id
end

#uriObject (readonly)

Returns the value of attribute uri



5
6
7
# File 'lib/chainpoint/proof_handle.rb', line 5

def uri
  @uri
end

Instance Method Details

#proofObject



15
16
17
18
19
20
# File 'lib/chainpoint/proof_handle.rb', line 15

def proof
  data = request_proof
  return unless data['proof']

  Chainpoint::Proof.new(data['proof'], data['hash_id_node'], data['anchors_complete'])
end

#to_hObject



22
23
24
# File 'lib/chainpoint/proof_handle.rb', line 22

def to_h
  { uri: @uri, node_hash_id: @node_hash_id }
end