Class: Sequence::Feed::ClientModule

Inherits:
ClientModule show all
Defined in:
lib/sequence/feed.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 = {}) ⇒ Feed

Returns Newly created feed.

Parameters:

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

    Parameters for creating a Feed.

Options Hash (opts):

  • id (String)

    A unique id for the feed.

  • type (String)

    The type of the feed: “action” or “transaction”.

  • filter (String)

    A valid filter string. The feed will be composed of items that match the filter.

  • filter_params (Array<String|Integer>)

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

Returns:

  • (Feed)

    Newly created feed.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/sequence/feed.rb', line 94

def create(opts = {})
  validate_inclusion_of!(
    opts,
    :id,
    :type,
    :filter,
    :filter_params,
  )
  validate_required!(opts, :type)
  if opts[:type] != 'action' && opts[:type] != 'transaction'
    raise ArgumentError, ':type must equal action or transaction'
  end
  Feed.new(client.session.request('create-feed', opts), client.session)
end

#delete(opts = {}) ⇒ void

This method returns an undefined value.

Parameters:

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

Options Hash (opts):

  • id (String)

    The unique ID of a feed.



121
122
123
124
125
# File 'lib/sequence/feed.rb', line 121

def delete(opts = {})
  validate_required!(opts, :id)
  client.session.request('delete-feed', opts)
  nil
end

#get(opts = {}) ⇒ Feed

Get single feed given an id.

Parameters:

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

    Parameters to get single feed.

Options Hash (opts):

  • id (String)

    The unique ID of a feed.

Returns:

  • (Feed)

    Requested feed object.



113
114
115
116
# File 'lib/sequence/feed.rb', line 113

def get(opts = {})
  validate_required!(opts, :id)
  Feed.new(client.session.request('get-feed', opts), client.session)
end

#listQuery

Executes a query, returning an enumerable over individual feeds.

Returns:



129
130
131
# File 'lib/sequence/feed.rb', line 129

def list
  Query.new(client)
end