Class: ServiceStatusResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/src/ServiceStatusResponse.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, state) ⇒ ServiceStatusResponse

Returns a new instance of ServiceStatusResponse.



7
8
9
10
# File 'lib/src/ServiceStatusResponse.rb', line 7

def initialize(message, state)
	@message = message
	@state = state
end

Instance Attribute Details

#messageObject (readonly)

Returns the value of attribute message.



5
6
7
# File 'lib/src/ServiceStatusResponse.rb', line 5

def message
  @message
end

#stateObject (readonly)

Returns the value of attribute state.



5
6
7
# File 'lib/src/ServiceStatusResponse.rb', line 5

def state
  @state
end

Class Method Details

.create(feedHtml) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/src/ServiceStatusResponse.rb', line 12

def self.create(feedHtml)
	return NoServiceStatusResponse.new if feedHtml.nil?
	rssFeed = SimpleRSS.parse(feedHtml)
	if OperatingNormallySpecification.is_satisified_by? rssFeed.items
		ServiceOkayResponse.new
	else 
		ServiceErrorResponse.new(rssFeed.items.first[:title])
	end
end