Class: FlixCloud::Notification

Inherits:
Record
  • Object
show all
Defined in:
lib/flix_cloud/notification.rb

Instance Attribute Summary collapse

Attributes inherited from Record

#errors

Instance Method Summary collapse

Methods inherited from Record

#attributes=, record_column

Constructor Details

#initialize(attrs = {}) ⇒ Notification

Returns a new instance of Notification.



9
10
11
12
13
14
15
16
17
18
# File 'lib/flix_cloud/notification.rb', line 9

def initialize(attrs={})
  if attrs.is_a?(String)
    self.xml = attrs
    attrs = Crack::XML.parse(attrs)
  end

  attrs = attrs['job'] if attrs['job']

  super(attrs)
end

Instance Attribute Details

#error_messageObject

Returns the value of attribute error_message.



2
3
4
# File 'lib/flix_cloud/notification.rb', line 2

def error_message
  @error_message
end

#finished_job_atObject

Returns the value of attribute finished_job_at.



2
3
4
# File 'lib/flix_cloud/notification.rb', line 2

def finished_job_at
  @finished_job_at
end

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/flix_cloud/notification.rb', line 2

def id
  @id
end

#initialized_job_atObject

Returns the value of attribute initialized_job_at.



2
3
4
# File 'lib/flix_cloud/notification.rb', line 2

def initialized_job_at
  @initialized_job_at
end

#recipe_idObject

Returns the value of attribute recipe_id.



2
3
4
# File 'lib/flix_cloud/notification.rb', line 2

def recipe_id
  @recipe_id
end

#recipe_nameObject

Returns the value of attribute recipe_name.



2
3
4
# File 'lib/flix_cloud/notification.rb', line 2

def recipe_name
  @recipe_name
end

#stateObject

Returns the value of attribute state.



2
3
4
# File 'lib/flix_cloud/notification.rb', line 2

def state
  @state
end

#xmlObject

Returns the value of attribute xml.



2
3
4
# File 'lib/flix_cloud/notification.rb', line 2

def xml
  @xml
end

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/flix_cloud/notification.rb', line 28

def cancelled?
  state == 'cancelled_job'
end

#failed?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/flix_cloud/notification.rb', line 24

def failed?
  state == 'failed_job'
end

#successful?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/flix_cloud/notification.rb', line 20

def successful?
  state == 'successful_job'
end