Class: Chain::Account::ClientModule
- Inherits:
-
ClientModule
- Object
- ClientModule
- Chain::Account::ClientModule
- Defined in:
- lib/chain/account.rb
Instance Attribute Summary
Attributes inherited from ClientModule
Instance Method Summary collapse
- #create(opts) ⇒ Account
- #create_batch(opts) ⇒ BatchResponse<Account>
-
#create_receiver(opts) ⇒ Receiver
Creates a new receiver under the specified account.
-
#create_receiver_batch(opts_list) ⇒ BatchResponse<Receiver>
Creates new receivers under the specified accounts.
- #query(opts = {}) ⇒ Query
-
#update_tags(opts) ⇒ Hash
A success message.
- #update_tags_batch(opts) ⇒ BatchResponse<Hash>
Methods inherited from ClientModule
Constructor Details
This class inherits a constructor from Chain::ClientModule
Instance Method Details
#create(opts) ⇒ Account
43 44 45 46 |
# File 'lib/chain/account.rb', line 43 def create(opts) opts = {client_token: SecureRandom.uuid}.merge(opts) client.conn.singleton_batch_request('create-account', [opts]) { |item| Account.new(item) } end |
#create_batch(opts) ⇒ BatchResponse<Account>
50 51 52 53 |
# File 'lib/chain/account.rb', line 50 def create_batch(opts) opts = opts.map { |i| {client_token: SecureRandom.uuid}.merge(i) } client.conn.batch_request('create-account', opts) { |item| Account.new(item) } end |
#create_receiver(opts) ⇒ Receiver
Creates a new receiver under the specified account.
77 78 79 |
# File 'lib/chain/account.rb', line 77 def create_receiver(opts) client.conn.singleton_batch_request('create-account-receiver', [opts]) { |item| Receiver.new(item) } end |
#create_receiver_batch(opts_list) ⇒ BatchResponse<Receiver>
Creates new receivers under the specified accounts.
85 86 87 |
# File 'lib/chain/account.rb', line 85 def create_receiver_batch(opts_list) client.conn.batch_request('create-account-receiver', opts_list) { |item| Receiver.new(item) } end |
#query(opts = {}) ⇒ Query
93 94 95 |
# File 'lib/chain/account.rb', line 93 def query(opts = {}) Query.new(client, opts) end |
#update_tags(opts) ⇒ Hash
Returns a success message.
60 61 62 |
# File 'lib/chain/account.rb', line 60 def (opts) client.conn.singleton_batch_request('update-account-tags', [opts]) end |
#update_tags_batch(opts) ⇒ BatchResponse<Hash>
66 67 68 |
# File 'lib/chain/account.rb', line 66 def (opts) client.conn.batch_request('update-account-tags', opts) end |