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(opts = {}) ⇒ Flavor

Creates a new flavor in the ledger.

Parameters:

  • opts (Hash) (defaults to: {})

    Options hash

Options Hash (opts):

  • id (String)

    Unique, user-specified identifier.

  • key_ids (Array<String>)

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

  • keys (Array<Hash>, Array<Sequence::Key>)

    Deprecated. Use :key_ids instead. The set of keys used for signing transactions that issue tokens of the flavor. A key can be either a key object, or a hash containing an id field.

  • quorum (Integer)

    The number of keys required to sign transactions that issue tokens of the flavor. Defaults to the number of keys provided.

  • tags (Hash)

    User-specified key-value data describing the flavor.

Returns:



67
68
69
70
71
72
73
74
75
76
77
# File 'lib/sequence/flavor.rb', line 67

def create(opts = {})
  validate_inclusion_of!(opts, :id, :key_ids, :keys, :quorum, :tags)
  if (opts[:key_ids].nil? || opts[:key_ids].empty?) &&
     (opts[:keys].nil? || opts[:keys].empty?)
    raise(
      ArgumentError,
      ':key_ids or :keys (but not both) must be provided',
    )
  end
  Flavor.new(client.session.request('create-flavor', opts))
end

#list(opts = {}) ⇒ Query

Executes a query, returning an enumerable over individual flavors.

Parameters:

  • opts (Hash) (defaults to: {})

    Options hash

Options Hash (opts):

  • filter (String)

    A filter expression.

  • filter_params (Array<String|Integer>)

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

Returns:



103
104
105
106
107
108
109
110
# File 'lib/sequence/flavor.rb', line 103

def list(opts = {})
  validate_inclusion_of!(
    opts,
    :filter,
    :filter_params,
  )
  Query.new(client, opts)
end

#update_tags(opts = {}) ⇒ void

This method returns an undefined value.

Updates a flavor’s tags.

Parameters:

  • opts (Hash) (defaults to: {})

    Options hash

Options Hash (opts):

  • id (String)

    The ID of the flavor.

  • tags (Hash)

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



87
88
89
90
91
92
93
# File 'lib/sequence/flavor.rb', line 87

def update_tags(opts = {})
  validate_inclusion_of!(opts, :id, :tags)
  if opts[:id].nil? || opts[:id].empty?
    raise ArgumentError, ':id must be provided'
  end
  client.session.request('update-flavor-tags', opts)
end