Class: Cloudsponge::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/cloudsponge/event.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event_data) ⇒ Event

Returns a new instance of Event.



16
17
18
19
20
21
22
23
24
25
# File 'lib/cloudsponge/event.rb', line 16

def initialize(event_data)
  # is it an error?
  
  # get the basic data
  self.event_type = event_data['event_type']
  self.status = event_data['status']
  self.value = event_data['value']
  self.description = event_data['description']
  self
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/cloudsponge/event.rb', line 6

def description
  @description
end

#event_typeObject

Returns the value of attribute event_type.



6
7
8
# File 'lib/cloudsponge/event.rb', line 6

def event_type
  @event_type
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/cloudsponge/event.rb', line 6

def status
  @status
end

#valueObject

Returns the value of attribute value.



6
7
8
# File 'lib/cloudsponge/event.rb', line 6

def value
  @value
end

Class Method Details

.from_array(list) ⇒ Object



8
9
10
# File 'lib/cloudsponge/event.rb', line 8

def self.from_array(list)
  list.map { |event_data| Event.new(event_data) }.compact
end

Instance Method Details

#inspectObject



12
13
14
# File 'lib/cloudsponge/event.rb', line 12

def inspect
    "\#<#{self.class} #{event_type} #{status} #{value}>"
end

#is_complete?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/cloudsponge/event.rb', line 31

def is_complete?
  self.event_type == 'COMPLETE' && self.status == 'COMPLETED'
end

#is_error?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/cloudsponge/event.rb', line 27

def is_error?
  self.status == 'ERROR'
end