Class: EFax::OutboundResponse
- Inherits:
-
Object
- Object
- EFax::OutboundResponse
- Defined in:
- lib/efax/outbound.rb
Instance Attribute Summary collapse
-
#doc_id ⇒ Object
readonly
Returns the value of attribute doc_id.
-
#error_level ⇒ Object
readonly
Returns the value of attribute error_level.
-
#error_message ⇒ Object
readonly
Returns the value of attribute error_message.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
-
#initialize(response) ⇒ OutboundResponse
constructor
:nodoc:.
Constructor Details
#initialize(response) ⇒ OutboundResponse
:nodoc:
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
# File 'lib/efax/outbound.rb', line 119 def initialize(response) #:nodoc: if response.is_a? Net::HTTPOK doc = Hpricot(response.body) @status_code = doc.at(:statuscode).inner_text.to_i @error_message = doc.at(:errormessage) @error_message = @error_message.inner_text if @error_message @error_level = doc.at(:errorlevel) @error_level = @error_level.inner_text if @error_level @doc_id = doc.at(:docid).inner_text @doc_id = @doc_id.empty? ? nil : @doc_id else @status_code = RequestStatus::HTTP_FAILURE @error_message = "HTTP request failed (#{response.code})" end end |
Instance Attribute Details
#doc_id ⇒ Object (readonly)
Returns the value of attribute doc_id.
117 118 119 |
# File 'lib/efax/outbound.rb', line 117 def doc_id @doc_id end |
#error_level ⇒ Object (readonly)
Returns the value of attribute error_level.
116 117 118 |
# File 'lib/efax/outbound.rb', line 116 def error_level @error_level end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
115 116 117 |
# File 'lib/efax/outbound.rb', line 115 def @error_message end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
114 115 116 |
# File 'lib/efax/outbound.rb', line 114 def status_code @status_code end |