Class: Librevox::Response
- Inherits:
-
Object
- Object
- Librevox::Response
- Defined in:
- lib/librevox/response.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#headers ⇒ Object
Returns the value of attribute headers.
Instance Method Summary collapse
- #api_response? ⇒ Boolean
- #command_reply? ⇒ Boolean
- #event ⇒ Object
- #event? ⇒ Boolean
-
#initialize(headers = "", content = "") ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(headers = "", content = "") ⇒ Response
Returns a new instance of Response.
12 13 14 15 |
# File 'lib/librevox/response.rb', line 12 def initialize headers="", content="" self.headers = headers self.content = content end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
10 11 12 |
# File 'lib/librevox/response.rb', line 10 def content @content end |
#headers ⇒ Object
Returns the value of attribute headers.
10 11 12 |
# File 'lib/librevox/response.rb', line 10 def headers @headers end |
Instance Method Details
#api_response? ⇒ Boolean
39 40 41 |
# File 'lib/librevox/response.rb', line 39 def api_response? @headers[:content_type] == "api/response" end |
#command_reply? ⇒ Boolean
43 44 45 |
# File 'lib/librevox/response.rb', line 43 def command_reply? @headers[:content_type] == "command/reply" end |
#event ⇒ Object
35 36 37 |
# File 'lib/librevox/response.rb', line 35 def event @content[:event_name] if event? end |
#event? ⇒ Boolean
31 32 33 |
# File 'lib/librevox/response.rb', line 31 def event? @content.is_a?(Hash) && @content.include?(:event_name) end |