Class: Alephant::Broker::ErrorComponent

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(meta, status, exception) ⇒ ErrorComponent

Returns a new instance of ErrorComponent.



6
7
8
9
10
11
12
# File 'lib/alephant/broker/error_component.rb', line 6

def initialize(meta, status, exception)
  @batch_id = meta.batch_id
  @status   = status
  @content  = content_for exception
  @id       = meta.id
  @options  = {}
end

Instance Attribute Details

#batch_idObject (readonly)

Returns the value of attribute batch_id.



4
5
6
# File 'lib/alephant/broker/error_component.rb', line 4

def batch_id
  @batch_id
end

#contentObject (readonly)

Returns the value of attribute content.



4
5
6
# File 'lib/alephant/broker/error_component.rb', line 4

def content
  @content
end

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/alephant/broker/error_component.rb', line 4

def id
  @id
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/alephant/broker/error_component.rb', line 4

def options
  @options
end

#statusObject (readonly)

Returns the value of attribute status.



4
5
6
# File 'lib/alephant/broker/error_component.rb', line 4

def status
  @status
end

Instance Method Details

#content_typeObject



14
15
16
# File 'lib/alephant/broker/error_component.rb', line 14

def content_type
  headers["Content-Type"]
end

#headersObject



18
19
20
21
22
# File 'lib/alephant/broker/error_component.rb', line 18

def headers
  {
    "Content-Type" => "text/plain"
  }
end