Class: EFax::OutboundResponse
- Inherits:
-
Object
- Object
- EFax::OutboundResponse
- Defined in:
- lib/efax.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:
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/efax.rb', line 144 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.
142 143 144 |
# File 'lib/efax.rb', line 142 def doc_id @doc_id end |
#error_level ⇒ Object (readonly)
Returns the value of attribute error_level.
141 142 143 |
# File 'lib/efax.rb', line 141 def error_level @error_level end |
#error_message ⇒ Object (readonly)
Returns the value of attribute error_message.
140 141 142 |
# File 'lib/efax.rb', line 140 def @error_message end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
139 140 141 |
# File 'lib/efax.rb', line 139 def status_code @status_code end |