Class: Sequence::Account::ClientModule

Inherits:
ClientModule show all
Defined in:
lib/sequence/account.rb

Instance Attribute Summary

Attributes inherited from ClientModule

#client

Instance Method Summary collapse

Methods inherited from ClientModule

#initialize

Constructor Details

This class inherits a constructor from Sequence::ClientModule

Instance Method Details

#create(key_ids:, id: nil, quorum: nil, tags: nil) ⇒ Account

Create a new account in the ledger.

Parameters:

  • key_ids (Array<String>)

    The list of IDs for the keys that control the account.

  • id (String) (defaults to: nil)

    Unique identifier. Auto-generated if not specified.

  • quorum (Integer) (defaults to: nil)

    The number of keys required to sign transactions that transfer or retire tokens from the account. Defaults to the number of keys provided.

  • tags (Hash) (defaults to: nil)

    User-specified key-value data describing the account.

Returns:

Raises:

  • (ArgumentError)


49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/sequence/account.rb', line 49

def create(key_ids:, id: nil, quorum: nil, tags: nil)
  raise ArgumentError, ':key_ids cannot be empty' if key_ids == []
  Account.new(
    client.session.request(
      'create-account',
      id: id,
      key_ids: key_ids,
      quorum: quorum,
      tags: tags,
    ),
  )
end

#list(filter: nil, filter_params: nil) ⇒ Query

Filter accounts.

Parameters:

  • filter (String) (defaults to: nil)

    A filter expression.

  • filter_params (Array<String|Integer>) (defaults to: nil)

    A list of values that will be interpolated into the filter expression.

Returns:



79
80
81
# File 'lib/sequence/account.rb', line 79

def list(filter: nil, filter_params: nil)
  Query.new(client, filter: filter, filter_params: filter_params)
end

#update_tags(id:, tags: nil) ⇒ void

This method returns an undefined value.

Update an account’s tags.

Parameters:

  • id (String)

    The ID of the account.

  • tags (Hash) (defaults to: nil)

    A new set of tags, which will replace the existing tags.

Raises:

  • (ArgumentError)


68
69
70
71
# File 'lib/sequence/account.rb', line 68

def update_tags(id:, tags: nil)
  raise ArgumentError, ':id cannot be blank' if id == ''
  client.session.request('update-account-tags', id: id, tags: tags)
end