class GcpDirectory::Printer
Maps to developers.google.com/cloud-print/docs/appInterfaces
Public Class Methods
new(auth = GcpDirectory.token_client)
click to toggle source
# File lib/gcp_directory/printer.rb, line 9 def initialize(auth = GcpDirectory.token_client) auth.access_token || raise(ArgumentError, "`access_token` not set in #{auth}") @auth = auth end
Public Instance Methods
jobs(**options)
click to toggle source
# File lib/gcp_directory/printer.rb, line 14 def jobs(**options) self.class.post('/jobs', with_default_options(options)) end
submit(printerid:, title:, content:, ticket:)
click to toggle source
# File lib/gcp_directory/printer.rb, line 18 def submit(printerid:, title:, content:, ticket:) self.class.post('/submit', with_default_options(body: { printerid: printerid, title: title, ticket: ticket.to_json, content: content })) end
with_default_options(**options)
click to toggle source
# File lib/gcp_directory/printer.rb, line 27 def with_default_options(**options) { headers: { 'Authorization' => "OAuth #{@auth.access_token}" } }.merge(options) end