Class: FSR::Response
- Inherits:
-
Object
- Object
- FSR::Response
- Defined in:
- lib/fsr/response.rb
Instance Attribute Summary (collapse)
-
- (Object) content
Returns the value of attribute content.
-
- (Object) headers
Returns the value of attribute headers.
Instance Method Summary (collapse)
- - (Boolean) api_response?
- - (Boolean) command_reply?
- - (Object) event
- - (Boolean) event?
-
- (Response) initialize(headers = "", content = "")
constructor
A new instance of Response.
Constructor Details
- (Response) initialize(headers = "", content = "")
A new instance of Response
8 9 10 11 |
# File 'lib/fsr/response.rb', line 8 def initialize(headers="", content="") self.headers = headers self.content = content end |
Instance Attribute Details
- (Object) content
Returns the value of attribute content
6 7 8 |
# File 'lib/fsr/response.rb', line 6 def content @content end |
- (Object) headers
Returns the value of attribute headers
6 7 8 |
# File 'lib/fsr/response.rb', line 6 def headers @headers end |
Instance Method Details
- (Boolean) api_response?
31 32 33 |
# File 'lib/fsr/response.rb', line 31 def api_response? @headers[:content_type] == "api/response" end |
- (Boolean) command_reply?
35 36 37 |
# File 'lib/fsr/response.rb', line 35 def command_reply? @headers[:content_type] == "command/reply" end |
- (Object) event
27 28 29 |
# File 'lib/fsr/response.rb', line 27 def event @content[:event_name] if event? end |
- (Boolean) event?
23 24 25 |
# File 'lib/fsr/response.rb', line 23 def event? @content.is_a?(Hash) && @content.include?(:event_name) end |