class CloudPrint::PrintJob

Constants

STATUSES

Attributes

client[R]

Public Class Methods

new(client, data) click to toggle source
# File lib/cloudprint/print_job.rb, line 13
def initialize(client, data)
  @client = client
  @data = data
end
new_from_response(client, response_hash) click to toggle source
# File lib/cloudprint/print_job.rb, line 8
def new_from_response client, response_hash
  new client, Util.normalize_response_data(response_hash)
end

Public Instance Methods

delete!() click to toggle source
# File lib/cloudprint/print_job.rb, line 23
def delete!
  response = client.connection.get('/deletejob', { :jobid => id })
  response['success'] || raise(RequestError, response['message'])
end
method_missing(meth, *args, &block) click to toggle source
Calls superclass method
# File lib/cloudprint/print_job.rb, line 28
def method_missing(meth, *args, &block)
  if @data.has_key?(meth)
    @data[meth]
  elsif STATUSES.map{ |s| s.downcase + '?' }.include?(meth.to_s)
    @data[:status].downcase == meth.to_s.chop
  else
    super
  end
end
refresh!() click to toggle source
# File lib/cloudprint/print_job.rb, line 18
def refresh!
  @data = Util.normalize_response_data(client.print_jobs.find_by_id(id))
  self
end