Class: Flixit::Notification

Inherits:
Record
  • Object
show all
Defined in:
lib/flixit/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.



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

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/flixit/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/flixit/notification.rb', line 2

def finished_job_at
  @finished_job_at
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#initialized_job_atObject

Returns the value of attribute initialized_job_at.



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

def initialized_job_at
  @initialized_job_at
end

#pass_throughObject

Returns the value of attribute pass_through.



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

def pass_through
  @pass_through
end

#recipe_idObject

Returns the value of attribute recipe_id.



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

def recipe_id
  @recipe_id
end

#recipe_nameObject

Returns the value of attribute recipe_name.



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

def recipe_name
  @recipe_name
end

#stateObject

Returns the value of attribute state.



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

def state
  @state
end

#xmlObject

Returns the value of attribute xml.



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

def xml
  @xml
end

Instance Method Details

#cancelled?Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/flixit/notification.rb', line 29

def cancelled?
  state == 'cancelled_job'
end

#failed?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/flixit/notification.rb', line 25

def failed?
  state == 'failed_job'
end

#successful?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/flixit/notification.rb', line 21

def successful?
  state == 'successful_job'
end