Class: Seam::Clients::ActionAttempts

Inherits:
Object
  • Object
show all
Defined in:
lib/seam/routes/action_attempts.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:, defaults:) ⇒ ActionAttempts

Returns a new instance of ActionAttempts.



8
9
10
11
# File 'lib/seam/routes/action_attempts.rb', line 8

def initialize(client:, defaults:)
  @client = client
  @defaults = defaults
end

Instance Method Details

#get(action_attempt_id:, wait_for_action_attempt: nil) ⇒ Seam::Resources::ActionAttempt

Returns a specified action attempt.

Parameters:

  • action_attempt_id

    ID of the action attempt that you want to get.

Returns:



16
17
18
19
20
21
22
# File 'lib/seam/routes/action_attempts.rb', line 16

def get(action_attempt_id:, wait_for_action_attempt: nil)
  res = @client.post("/action_attempts/get", {action_attempt_id: action_attempt_id}.compact)

  wait_for_action_attempt = wait_for_action_attempt.nil? ? @defaults.wait_for_action_attempt : wait_for_action_attempt

  Helpers::ActionAttempt.decide_and_wait(Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempt"]), @client, wait_for_action_attempt)
end

#list(action_attempt_ids: nil, device_id: nil, limit: nil, page_cursor: nil) ⇒ Seam::Resources::ActionAttempt

Returns a list of the action attempts that you specify as an array of action_attempt_ids.

Parameters:

  • action_attempt_ids (defaults to: nil)

    IDs of the action attempts that you want to retrieve.

  • device_id (defaults to: nil)

    ID of the device to filter action attempts by.

  • limit (defaults to: nil)

    Maximum number of records to return per page.

  • page_cursor (defaults to: nil)

    Identifies the specific page of results to return, obtained from the previous page's next_page_cursor.

Returns:



30
31
32
33
34
# File 'lib/seam/routes/action_attempts.rb', line 30

def list(action_attempt_ids: nil, device_id: nil, limit: nil, page_cursor: nil)
  res = @client.post("/action_attempts/list", {action_attempt_ids: action_attempt_ids, device_id: device_id, limit: limit, page_cursor: page_cursor}.compact)

  Seam::Resources::ActionAttempt.load_from_response(res.body["action_attempts"])
end