Class: Sequence::Flavor::ClientModule

Inherits:
ClientModule show all
Defined in:
lib/sequence/flavor.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) ⇒ Flavor

Create a new flavor in the ledger.

Parameters:

  • key_ids (Array<String>)

    The set of key IDs used for signing transactions that issue tokens of the flavor.

  • 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 issue tokens of the flavor. Defaults to the number of keys provided.

  • tags (Hash) (defaults to: nil)

    User-specified key-value data describing the flavor.

Returns:

Raises:

  • (ArgumentError)


51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/sequence/flavor.rb', line 51

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

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

Execute a query, returning an enumerable over individual flavors.

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:



81
82
83
# File 'lib/sequence/flavor.rb', line 81

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 a flavor’s tags.

Parameters:

  • id (String)

    The ID of the flavor.

  • tags (Hash) (defaults to: nil)

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

Raises:

  • (ArgumentError)


70
71
72
73
# File 'lib/sequence/flavor.rb', line 70

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