Class: Librevox::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#contentObject

Returns the value of attribute content



10
11
12
# File 'lib/librevox/response.rb', line 10

def content
  @content
end

#headersObject

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

Returns:

  • (Boolean)


39
40
41
# File 'lib/librevox/response.rb', line 39

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

#command_reply?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/librevox/response.rb', line 43

def command_reply?
  @headers[:content_type] == "command/reply"
end

#eventObject



35
36
37
# File 'lib/librevox/response.rb', line 35

def event
  @content[:event_name] if event?
end

#event?Boolean

Returns:

  • (Boolean)


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

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