Sha256: f7aef7557b060db7775d84d1d2594b8437a52a22b98d6bf0b03c5a7dc25ccbf7

Contents?: true

Size: 587 Bytes

Versions: 26

Compression:

Stored size: 587 Bytes

Contents

# frozen_string_literal: true

module Seam
  class ActionAttempt < BaseResource
    attr_accessor :action_attempt_id, :action_type, :status, :result

    SLEEP_TIME = 0.2
    MAX_ATTEMPTS = 10

    def wait_until_finished
      while @status == "pending"
        update!

        sleep(SLEEP_TIME)
      end

      self
    end

    def update!
      response = @client.request_seam(
        :get,
        "/action_attempts/get",
        params: {
          action_attempt_id: action_attempt_id
        }
      )

      update_from_response(response["action_attempt"])
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
seamapi-1.0.0.pre.rc.1 lib/seam/resources/action_attempt.rb
seamapi-1.0.0.pre.rc.0 lib/seam/resources/action_attempt.rb
seamapi-0.1.0 lib/seam/resources/action_attempt.rb
seamapi-0.0.5 lib/seam/resources/action_attempt.rb
seamapi-0.0.4 lib/seam/resources/action_attempt.rb
seamapi-0.0.3 lib/seam/resources/action_attempt.rb