Method: PrintNode::Client#create_printjob

Defined in:
lib/printnode/client.rb

#create_printjob(printjob, options = {}) ⇒ Object

Sends a POST request to /printjobs/.

Returns:

The id of the printjob that was created.

Parameters:

  • printjob (PrintNode::PrintJob)

    printjob object to be submitted.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :options (Hash)

    a hash of any of the options available on the API docs.

  • :expireAfter (int)

    Number of seconds until printjob expires.

  • :qty (int)

    how many times this printjob will be sent to the server.

  • :authentication (Hash)

    A hash of an authentication object found on the API docs.

See Also:



440
441
442
443
444
445
446
447
448
# File 'lib/printnode/client.rb', line 440

def create_printjob(printjob, options = {})
  hash = printjob.to_hash
  if options
    options.each do |(k, v)|
      hash[k] = v
    end
  end
  JSON.parse('[' + post('/printjobs/', hash).body + ']')[0]
end