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.14.0 lib/seam/resources/action_attempt.rb
seamapi-1.13.0 lib/seam/resources/action_attempt.rb
seamapi-1.12.1 lib/seam/resources/action_attempt.rb
seamapi-1.12.0 lib/seam/resources/action_attempt.rb
seamapi-1.11.2 lib/seam/resources/action_attempt.rb
seamapi-1.11.1 lib/seam/resources/action_attempt.rb
seamapi-1.11.0 lib/seam/resources/action_attempt.rb
seamapi-1.10.0 lib/seam/resources/action_attempt.rb
seamapi-1.9.0 lib/seam/resources/action_attempt.rb
seamapi-1.8.0 lib/seam/resources/action_attempt.rb
seamapi-1.7.0 lib/seam/resources/action_attempt.rb
seamapi-1.6.0 lib/seam/resources/action_attempt.rb
seamapi-1.5.0 lib/seam/resources/action_attempt.rb
seamapi-1.4.0 lib/seam/resources/action_attempt.rb
seamapi-1.3.2 lib/seam/resources/action_attempt.rb
seamapi-1.3.1 lib/seam/resources/action_attempt.rb
seamapi-1.3.0 lib/seam/resources/action_attempt.rb
seamapi-1.2.0 lib/seam/resources/action_attempt.rb
seamapi-1.1.1 lib/seam/resources/action_attempt.rb
seamapi-1.0.0 lib/seam/resources/action_attempt.rb