Class: FlowClient::Block
- Inherits:
-
Object
- Object
- FlowClient::Block
- Defined in:
- lib/flow_client/block.rb
Overview
Represents a block
Instance Attribute Summary collapse
-
#block_seals ⇒ Object
Returns the value of attribute block_seals.
-
#collection_guarantees ⇒ Object
Returns the value of attribute collection_guarantees.
-
#height ⇒ Object
Returns the value of attribute height.
-
#id ⇒ Object
Returns the value of attribute id.
-
#parent_id ⇒ Object
Returns the value of attribute parent_id.
-
#signatures ⇒ Object
Returns the value of attribute signatures.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Block
constructor
A new instance of Block.
Constructor Details
#initialize ⇒ Block
Returns a new instance of Block.
14 15 16 17 18 19 20 21 22 |
# File 'lib/flow_client/block.rb', line 14 def initialize @id = nil @parent_id = nil @height = nil @timestamp = nil @collection_guarantees = [] @block_seals = [] @signatures = [] end |
Instance Attribute Details
#block_seals ⇒ Object
Returns the value of attribute block_seals.
6 7 8 |
# File 'lib/flow_client/block.rb', line 6 def block_seals @block_seals end |
#collection_guarantees ⇒ Object
Returns the value of attribute collection_guarantees.
6 7 8 |
# File 'lib/flow_client/block.rb', line 6 def collection_guarantees @collection_guarantees end |
#height ⇒ Object
Returns the value of attribute height.
6 7 8 |
# File 'lib/flow_client/block.rb', line 6 def height @height end |
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/flow_client/block.rb', line 6 def id @id end |
#parent_id ⇒ Object
Returns the value of attribute parent_id.
6 7 8 |
# File 'lib/flow_client/block.rb', line 6 def parent_id @parent_id end |
#signatures ⇒ Object
Returns the value of attribute signatures.
6 7 8 |
# File 'lib/flow_client/block.rb', line 6 def signatures @signatures end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/flow_client/block.rb', line 6 def @timestamp end |
Class Method Details
.parse_grpc_block_response(block_response) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/flow_client/block.rb', line 24 def self.parse_grpc_block_response(block_response) block = Block.new block.id = block_response.block.id.unpack1("H*") block.parent_id = block_response.block.parent_id.unpack1("H*") block.height = block_response.block.height block. = FlowClient::Utils.(block_response.block.) block.collection_guarantees = block_response.block.collection_guarantees.to_a.map do |cg| FlowClient::CollectionGuarantee.parse_grpc_type(cg) end block.block_seals = block_response.block.block_seals.to_a.map do |seal| FlowClient::BlockSeal.parse_grpc_type(seal) end block.signatures = block_response.block.signatures.to_a.map { |sig| sig.unpack1("H*") } block end |