Class: Webhooks::Response

Inherits:
ApplicationRecord show all
Defined in:
app/models/webhooks/response.rb

Instance Method Summary collapse

Instance Method Details

#response=(response) ⇒ Object



23
24
25
26
27
# File 'app/models/webhooks/response.rb', line 23

def response=(response)
  self.status_code = response.status
  self.headers = response.headers
  self.body = response.body
end

#update_attempt_stateObject



14
15
16
17
18
19
20
21
# File 'app/models/webhooks/response.rb', line 14

def update_attempt_state
  case status_code
  when 200..299
    attempt.update!(state: :success)
  else
    attempt.update!(state: :error)
  end
end