Class: FSR::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/fsr/response.rb

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

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?

Returns:

  • (Boolean)


31
32
33
# File 'lib/fsr/response.rb', line 31

def api_response?
  @headers[:content_type] == "api/response"
end

- (Boolean) command_reply?

Returns:

  • (Boolean)


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?

Returns:

  • (Boolean)


23
24
25
# File 'lib/fsr/response.rb', line 23

def event?
  @content.is_a?(Hash) && @content.include?(:event_name)
end