Class: Alephant::Broker::Response::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/alephant/broker/response/base.rb

Direct Known Subclasses

Asset, Batch, NotFound, ServerError, Status

Constant Summary collapse

STATUS_CODE_MAPPING =
{
  200 => 'ok',
  404 => 'Not found',
  500 => 'Error retrieving content'
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status = 200, content_type = "text/html") ⇒ Base

Returns a new instance of Base.



15
16
17
18
19
20
21
# File 'lib/alephant/broker/response/base.rb', line 15

def initialize(status = 200, content_type = "text/html")
  @content_type = content_type
  @status  = status
  @content = STATUS_CODE_MAPPING[status]

  setup
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



7
8
9
# File 'lib/alephant/broker/response/base.rb', line 7

def content
  @content
end

#content_typeObject

Returns the value of attribute content_type.



7
8
9
# File 'lib/alephant/broker/response/base.rb', line 7

def content_type
  @content_type
end

#statusObject

Returns the value of attribute status.



7
8
9
# File 'lib/alephant/broker/response/base.rb', line 7

def status
  @status
end