Class: Seam::ActionAttempt

Inherits:
BaseResource show all
Defined in:
lib/seam/resources/action_attempt.rb

Constant Summary collapse

SLEEP_TIME =
0.2
MAX_ATTEMPTS =
10

Instance Attribute Summary collapse

Attributes inherited from BaseResource

#client, #data

Instance Method Summary collapse

Methods inherited from BaseResource

date_accessor, #initialize, #inspect, load_from_response, #update_from_response

Constructor Details

This class inherits a constructor from Seam::BaseResource

Instance Attribute Details

#action_attempt_idObject

Returns the value of attribute action_attempt_id.



5
6
7
# File 'lib/seam/resources/action_attempt.rb', line 5

def action_attempt_id
  @action_attempt_id
end

#action_typeObject

Returns the value of attribute action_type.



5
6
7
# File 'lib/seam/resources/action_attempt.rb', line 5

def action_type
  @action_type
end

#resultObject

Returns the value of attribute result.



5
6
7
# File 'lib/seam/resources/action_attempt.rb', line 5

def result
  @result
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'lib/seam/resources/action_attempt.rb', line 5

def status
  @status
end

Instance Method Details

#update!Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/seam/resources/action_attempt.rb', line 20

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

  update_from_response(response["action_attempt"])
end

#wait_until_finishedObject



10
11
12
13
14
15
16
17
18
# File 'lib/seam/resources/action_attempt.rb', line 10

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

    sleep(SLEEP_TIME)
  end

  self
end