Class: QPush::Base::Job

Inherits:
Object
  • Object
show all
Defined in:
lib/qpush/base/job.rb

Direct Known Subclasses

Client::Job, Server::Job

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Job

Returns a new instance of Job.



17
18
19
20
# File 'lib/qpush/base/job.rb', line 17

def initialize(options = {})
  options = defaults.merge(options)
  options.each { |key, value| send("#{key}=", value) }
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



15
16
17
# File 'lib/qpush/base/job.rb', line 15

def args
  @args
end

#created_atObject

Returns the value of attribute created_at.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def created_at
  @created_at
end

#cronObject

Returns the value of attribute cron.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def cron
  @cron
end

#failedObject

Returns the value of attribute failed.



15
16
17
# File 'lib/qpush/base/job.rb', line 15

def failed
  @failed
end

#idObject

Returns the value of attribute id.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def id
  @id
end

#klassObject

Returns the value of attribute klass.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def klass
  @klass
end

#namespaceObject

Returns the value of attribute namespace.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def namespace
  @namespace
end

#priorityObject

Returns the value of attribute priority.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def priority
  @priority
end

#retry_maxObject

Returns the value of attribute retry_max.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def retry_max
  @retry_max
end

#run_timeObject

Returns the value of attribute run_time.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def run_time
  @run_time
end

#start_atObject

Returns the value of attribute start_at.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def start_at
  @start_at
end

#total_failObject

Returns the value of attribute total_fail.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def total_fail
  @total_fail
end

#total_successObject

Returns the value of attribute total_success.



12
13
14
# File 'lib/qpush/base/job.rb', line 12

def total_success
  @total_success
end

Instance Method Details

#to_jsonObject



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/qpush/base/job.rb', line 35

def to_json
  { klass: @klass,
    id: @id,
    priority: @priority,
    created_at: @created_at,
    start_at: @start_at,
    cron: @cron,
    retry_max: @retry_max,
    total_fail: @total_fail,
    total_success: @total_success,
    failed: @failed,
    args: @args }.to_json
end