Class: Toshi::Block

Inherits:
ApiResource show all
Defined in:
lib/toshi/block.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiResource

client, #client, create_many, create_one, #from_hash, #initialize

Constructor Details

This class inherits a constructor from Toshi::ApiResource

Class Method Details

.allObject



4
5
6
7
# File 'lib/toshi/block.rb', line 4

def all
  response = client.get '/blocks'
  create_many(response)
end

.find(identifier) ⇒ Object



9
10
11
12
# File 'lib/toshi/block.rb', line 9

def find(identifier)
  response = client.get '/blocks/'+identifier.to_s
  create_one(response)
end

.latestObject



14
15
16
17
# File 'lib/toshi/block.rb', line 14

def latest
  response = client.get '/blocks/latest'
  create_one(response)
end

Instance Method Details

#transactionsObject



20
21
22
23
# File 'lib/toshi/block.rb', line 20

def transactions
  response = client.get '/blocks/'+hash+'/transactions'
  self.class.create_one(response)
end