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(type:, id: nil, filter: nil, filter_params: nil) ⇒ Feed

Create a feed.

Parameters:

  • type (String)

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

  • id (String) (defaults to: nil)

    A unique id for the feed.

  • filter (String) (defaults to: nil)

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

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

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

Returns:

  • (Feed)

    Newly created feed.



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

def create(type:, id: nil, filter: nil, filter_params: nil)
  if type != 'action' && type != 'transaction'
    raise ArgumentError, ':type must equal action or transaction'
  end
  Feed.new(
    client.session.request(
      'create-feed',
      id: id,
      type: type,
      filter: filter,
      filter_params: filter_params,
    ),
    client.session,
  )
end

#delete(id:) ⇒ void

This method returns an undefined value.

Delete feed by id.

Parameters:

  • id (Hash)

    a customizable set of options

Options Hash (id:):

  • The (String)

    unique ID of a feed.



119
120
121
122
# File 'lib/sequence/feed.rb', line 119

def delete(id:)
  client.session.request('delete-feed', id: id)
  nil
end

#get(id:) ⇒ Feed

Get feed by id.

Parameters:

  • id (String)

    The unique ID of a feed.

Returns:

  • (Feed)

    Requested feed object.



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

def get(id:)
  Feed.new(client.session.request('get-feed', id: id), client.session)
end

#listQuery

Execute a query, returning an enumerable over individual feeds.

Returns:



126
127
128
# File 'lib/sequence/feed.rb', line 126

def list
  Query.new(client)
end