Class: Nem::Endpoint::Local::Account

Inherits:
Base
  • Object
show all
Defined in:
lib/nem/endpoint/local/account.rb

Instance Method Summary collapse

Methods inherited from Base

#current_node, #initialize, #next_node!, #request, #request!

Constructor Details

This class inherits a constructor from Nem::Endpoint::Base

Instance Method Details

#transfers(value, hash: nil, id: nil, page_size: nil, dir: :all) ⇒ Object



47
48
49
50
51
52
53
# File 'lib/nem/endpoint/local/account.rb', line 47

def transfers(value, hash: nil, id: nil, page_size: nil, dir: :all)
  case dir.to_s
  when /\Ain/  then transfers_incoming(value, hash: hash, id: id, page_size: page_size)
  when /\Aout/ then transfers_outgoing(value, hash: hash, id: id, page_size: page_size)
  else transfers_all(value, hash: hash, id: id, page_size: page_size)
  end
end

#transfers_all(value, hash: nil, id: nil, page_size: nil) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/nem/endpoint/local/account.rb', line 34

def transfers_all(value, hash: nil, id: nil, page_size: nil)
  page = {
    value: value,
    hash: hash,
    id: id
  }
  request!(:post, '/local/account/transfers/all', page) do |res|
    res[:data].map do |tx|
      Nem::Model::Transaction.(tx)
    end
  end
end

#transfers_incoming(value, hash: nil, id: nil, page_size: nil) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/nem/endpoint/local/account.rb', line 6

def transfers_incoming(value, hash: nil, id: nil, page_size: nil)
  page = {
    value: value,
    hash: hash,
    id: id
  }
  request!(:post, '/local/account/transfers/incoming', page) do |res|
    res[:data].map do |tx|
      Nem::Model::Transaction.(tx)
    end
  end
end

#transfers_outgoing(value, hash: nil, id: nil, page_size: nil) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/nem/endpoint/local/account.rb', line 20

def transfers_outgoing(value, hash: nil, id: nil, page_size: nil)
  page = {
    value: value,
    hash: hash,
    id: id
  }
  request!(:post, '/local/account/transfers/outgoing', page) do |res|
    res[:data].map do |tx|
      Nem::Model::Transaction.(tx)
    end
  end
end