Class: IOSTSdk::Http::GetBlockByHash

Inherits:
Object
  • Object
show all
Defined in:
lib/iost_sdk/http/get_block_by_hash.rb

Instance Method Summary collapse

Instance Method Details

#invoke(base_url:, hash_value:, complete:) ⇒ Object

Raises:



8
9
10
11
12
13
14
# File 'lib/iost_sdk/http/get_block_by_hash.rb', line 8

def invoke(base_url:, hash_value:, complete:)
  resp = HTTParty.get("#{base_url}/getBlockByHash/#{hash_value}/#{complete}")
  raise HttpRequestError.new(status_code: resp.code, body: resp.body) unless
    resp.code == 200

  IOSTSdk::Models::BlockInfo.new.populate(model_data: JSON.parse(resp.body))
end