Class: TxghQueue::ErrorHandlers::ServerResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/txgh-queue/error_handlers/server_response.rb

Class Method Summary collapse

Class Method Details

.can_handle?(error_or_response) ⇒ Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/txgh-queue/error_handlers/server_response.rb', line 7

def can_handle?(error_or_response)
  error_or_response.is_a?(TxghServer::Response)
end

.status_for(response) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/txgh-queue/error_handlers/server_response.rb', line 11

def status_for(response)
  case response.status.to_i / 100
    when 2, 3
      Status.ok
    else
      Status.fail
  end
end