Class: Sipgate::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/response.rb

Constant Summary collapse

CODE_SUCCESS =
200

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Response

Returns a new instance of Response.



5
6
7
# File 'lib/response.rb', line 5

def initialize(response)
  @response = response
end

Instance Method Details

#sending_statusObject

gibt den Status eines Fax-Versandes zurück. Mögliche Antworten: :pending, :sent, :failed



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/response.rb', line 31

def sending_status
  case session_status
    when "sending", "queued"
      :pending
    when "sent"
      :sent
    when "error during submit", "failed"
      :failed
    else
      raise "Konnte keinen Status aus Antwort ermitteln: #{inspect}"
  end
end

#session_idObject



13
14
15
# File 'lib/response.rb', line 13

def session_id
  @response[:session_id]
end

#session_statusObject



17
18
19
# File 'lib/response.rb', line 17

def session_status
  @response[:session_status]
end

#status_codeObject



21
22
23
# File 'lib/response.rb', line 21

def status_code
  @response[:status_code]
end

#status_stringObject



25
26
27
# File 'lib/response.rb', line 25

def status_string
  @response[:status_string]
end

#success?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/response.rb', line 9

def success?
  status_code == CODE_SUCCESS
end