Class: EventMachine::Kannel::Response
- Inherits:
-
Object
- Object
- EventMachine::Kannel::Response
- Defined in:
- lib/em-kannel/response.rb
Instance Attribute Summary collapse
-
#duration ⇒ Object
readonly
Returns the value of attribute duration.
Instance Method Summary collapse
- #body ⇒ Object
- #error ⇒ Object
- #guid ⇒ Object
-
#initialize(http, start = nil) ⇒ Response
constructor
A new instance of Response.
- #status ⇒ Object
- #success? ⇒ Boolean
Constructor Details
#initialize(http, start = nil) ⇒ Response
Returns a new instance of Response.
6 7 8 9 |
# File 'lib/em-kannel/response.rb', line 6 def initialize(http, start=nil) @http = http @duration = compute_duration(start) end |
Instance Attribute Details
#duration ⇒ Object (readonly)
Returns the value of attribute duration.
4 5 6 |
# File 'lib/em-kannel/response.rb', line 4 def duration @duration end |
Instance Method Details
#body ⇒ Object
19 20 21 |
# File 'lib/em-kannel/response.rb', line 19 def body @http.response end |
#error ⇒ Object
23 24 25 |
# File 'lib/em-kannel/response.rb', line 23 def error @http.error end |
#guid ⇒ Object
27 28 29 |
# File 'lib/em-kannel/response.rb', line 27 def guid body.split(": ").last end |
#status ⇒ Object
11 12 13 |
# File 'lib/em-kannel/response.rb', line 11 def status @http.response_header.status.to_i end |
#success? ⇒ Boolean
15 16 17 |
# File 'lib/em-kannel/response.rb', line 15 def success? status == 202 end |