Class: IOSTSdk::Http::GetTxByHash

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

Instance Method Summary collapse

Instance Method Details

#invoke(base_url:, hash_value:) ⇒ Object

Raises:



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

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

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