Class: EFax::OutboundStatusResponse
- Inherits:
-
Object
- Object
- EFax::OutboundStatusResponse
- Defined in:
- lib/efax/outbound.rb
Instance Attribute Summary collapse
-
#classification ⇒ Object
readonly
Returns the value of attribute classification.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#outcome ⇒ Object
readonly
Returns the value of attribute outcome.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #busy_signal?(classification) ⇒ Boolean
-
#initialize(response) ⇒ OutboundStatusResponse
constructor
:nodoc:.
- #sent_yet?(classification, outcome) ⇒ Boolean
Constructor Details
#initialize(response) ⇒ OutboundStatusResponse
:nodoc:
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/efax/outbound.rb', line 179 def initialize(response) #:nodoc: if response.is_a? Net::HTTPOK doc = Hpricot(response.body) @message = doc.at(:message).innerText @classification = doc.at(:classification).innerText.delete('"') @outcome = doc.at(:outcome).innerText.delete('"') if !sent_yet?(classification, outcome) || busy_signal?(classification) @status_code = QueryStatus::PENDING elsif @classification == "Success" && @outcome == "Success" @status_code = QueryStatus::SENT else @status_code = QueryStatus::FAILURE end else @status_code = QueryStatus::HTTP_FAILURE @message = "HTTP request failed (#{response.code})" end end |
Instance Attribute Details
#classification ⇒ Object (readonly)
Returns the value of attribute classification.
176 177 178 |
# File 'lib/efax/outbound.rb', line 176 def classification @classification end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
175 176 177 |
# File 'lib/efax/outbound.rb', line 175 def @message end |
#outcome ⇒ Object (readonly)
Returns the value of attribute outcome.
177 178 179 |
# File 'lib/efax/outbound.rb', line 177 def outcome @outcome end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
174 175 176 |
# File 'lib/efax/outbound.rb', line 174 def status_code @status_code end |
Instance Method Details
#busy_signal?(classification) ⇒ Boolean
198 199 200 |
# File 'lib/efax/outbound.rb', line 198 def busy_signal?(classification) classification == "Busy" end |
#sent_yet?(classification, outcome) ⇒ Boolean
202 203 204 |
# File 'lib/efax/outbound.rb', line 202 def sent_yet?(classification, outcome) !classification.empty? || !outcome.empty? end |