Class: Blix::Rest::Response
- Inherits:
-
Object
- Object
- Blix::Rest::Response
- Defined in:
- lib/blix/rest/response.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize ⇒ Response
constructor
A new instance of Response.
- #set(status, content = nil, headers = nil) ⇒ Object
- #set_options(options = {}) ⇒ Object
Constructor Details
#initialize ⇒ Response
Returns a new instance of Response.
17 18 19 20 21 |
# File 'lib/blix/rest/response.rb', line 17 def initialize @status = 200 @headers = Rack::Headers.new @content = nil end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
15 16 17 |
# File 'lib/blix/rest/response.rb', line 15 def content @content end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
14 15 16 |
# File 'lib/blix/rest/response.rb', line 14 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
13 14 15 |
# File 'lib/blix/rest/response.rb', line 13 def status @status end |
Instance Method Details
#set(status, content = nil, headers = nil) ⇒ Object
23 24 25 26 27 |
# File 'lib/blix/rest/response.rb', line 23 def set(status,content=nil,headers=nil) @status = status if status @content = [String.new(content)] if content @headers.merge!(headers) if headers end |
#set_options(options = {}) ⇒ Object
29 30 31 32 33 |
# File 'lib/blix/rest/response.rb', line 29 def (={}) @status = [:status].to_i if [:status] @headers.merge!([:headers]) if [:headers] @headers['content-type'] = [:content_type] if [:content_type] end |