Class: Jamf::Printer
- Includes:
- Categorizable, Creatable, Updatable
- Defined in:
- lib/jamf/api/classic/api_objects/printer.rb
Overview
Printer object inside JSS
Constant Summary collapse
- RSRC_BASE =
The base for REST resources of this class
'printers'.freeze
- RSRC_LIST_KEY =
the hash key used for the JSON list output of all objects in the JSS
:printers
- RSRC_OBJECT_KEY =
The hash key used for the JSON object output It’s also used in various error messages
:printer
- CATEGORY_SUBSET =
Where is the Category in the API JSON?
:top
- CATEGORY_DATA_TYPE =
How is the category stored in the API data?
String
Instance Attribute Summary collapse
-
#CUPS_name ⇒ String
The CUPs name to be used.
-
#info ⇒ String
Information for this specific printer.
-
#location ⇒ String
The physical location of the printer.
-
#make_default ⇒ Boolean
Make this printer as the default printer upon installation.
-
#model ⇒ String
The specific model of printer.
-
#need_to_update ⇒ Boolean
included
from Updatable
readonly
Do we have unsaved changes?.
-
#notes ⇒ String
Notes for this specific printer.
-
#os_requirements ⇒ String
The OS version requirements seperated by commas.
-
#ppd ⇒ String
The PPD file name.
-
#ppd_contents ⇒ String
The contents of the PPD file.
-
#ppd_path ⇒ String
The path the PPD file will be installed.
-
#shared ⇒ Boolean
Is this printer to be shared?.
-
#uri ⇒ String
The URI path for the specific printer.
-
#use_generic ⇒ Boolean
Use a generic PPD.
Instance Method Summary collapse
-
#category=(new_cat) ⇒ void
included
from Categorizable
Change the category of this object.
-
#category_assigned? ⇒ Boolean
(also: #categorized?)
included
from Categorizable
Does this object have a category assigned?.
-
#category_id ⇒ Integer
included
from Categorizable
The id of the category for this object.
-
#category_name ⇒ String
(also: #category)
included
from Categorizable
The name of the category for this object.
-
#category_object ⇒ Jamf::Category
included
from Categorizable
The Jamf::Category instance for this object’s category.
-
#clone(new_name, api: nil, cnx: nil) ⇒ APIObject
included
from Creatable
make a clone of this API object, with a new name.
-
#evaluate_new_category(new_cat) ⇒ Array<String, Integer>
included
from Categorizable
Given a category name or id, return the name and id TODO: use APIObject.exist? and/or APIObject.valid_id.
-
#initialize(**args) ⇒ Printer
constructor
A new instance of Printer.
-
#name=(newname) ⇒ void
included
from Updatable
Change the name of this item Remember to #update to push changes to the server.
-
#pretty_print_instance_variables ⇒ Array
Remove the various large data from the instance_variables used to create pretty-print (pp) output.
-
#unset_category ⇒ void
included
from Categorizable
Set the category to nothing.
Constructor Details
#initialize(**args) ⇒ Printer
Returns a new instance of Printer.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 89 def initialize(**args) super if self.in_jss? @uri = @init_data[:uri] @CUPS_name = @init_data[:CUPS_name] @location = @init_data[:location] @model = @init_data[:model] @shared = @init_data[:shared] @info = @init_data[:info] @notes = @init_data[:notes] @make_default = @init_data[:make_default] @use_generic = @init_data[:use_generic] @ppd = @init_data[:ppd] @ppd_contents = @init_data[:ppd_contents] @ppd_path = @init_data[:ppd_path] @os_requirements = @init_data[:os_requirements] else raise Jamf::MissingDataError, "CUPS_name must be provided." unless !@init_data[:CUPS_name].nil? raise Jamf::MissingDataError, "uri must be provided." unless !@init_data[:uri].nil? raise Jamf::InvalidDataError, "uri must be a String." unless @init_data[:uri].is_a?(String) || @init_data[:uri].nil? raise Jamf::InvalidDataError, "CUPS_name must be a String." unless @init_data[:CUPS_name].is_a?(String) raise Jamf::InvalidDataError, "location must be a String." unless @init_data[:location].is_a?(String) || @init_data[:location].nil? raise Jamf::InvalidDataError, "model must be a String." unless @init_data[:model].is_a?(String) || @init_data[:model].nil? raise Jamf::InvalidDataError, "info must be a String." unless @init_data[:info].is_a?(String) || @init_data[:info].nil? raise Jamf::InvalidDataError, "notes must be a String." unless @init_data[:notes].is_a?(String) || @init_data[:notes].nil? raise Jamf::InvalidDataError, "ppd must be a String." unless @init_data[:ppd].is_a?(String) || @init_data[:ppd].nil? raise Jamf::InvalidDataError, "ppd_contents must be a String." unless @init_data[:ppd_contents].is_a?(String) || @init_data[:ppd_contents].nil? raise Jamf::InvalidDataError, "ppd_path must be a String." unless @init_data[:ppd_path].is_a?(String) || @init_data[:ppd_path].nil? raise Jamf::InvalidDataError, "os_requirements must be a String." unless @init_data[:os_requirements].is_a?(String) || @init_data[:os_requirements].nil? raise Jamf::InvalidDataError, "shared must be a String." unless (@init_data[:shared].is_a?(TrueClass) || @init_data[:shared].is_a?(FalseClass)) || @init_data[:shared].nil? raise Jamf::InvalidDataError, "make_default must be a String." unless (@init_data[:make_default].is_a?(TrueClass) || @init_data[:make_default].is_a?(FalseClass)) || @init_data[:make_default].nil? raise Jamf::InvalidDataError, "use_generic must be a String." unless (@init_data[:use_generic].is_a?(TrueClass) || @init_data[:use_generic].is_a?(FalseClass)) || @init_data[:use_generic].nil? @uri = @init_data[:uri] @CUPS_name = @init_data[:CUPS_name] @location = @init_data[:location] @model = @init_data[:model] @shared = @init_data[:shared] @info = @init_data[:info] @notes = @init_data[:notes] @make_default = @init_data[:make_default] @use_generic = @init_data[:use_generic] @ppd = @init_data[:ppd] @ppd_contents = @init_data[:ppd_contents] @ppd_path = @init_data[:ppd_path] @os_requirements = @init_data[:os_requirements] end end |
Instance Attribute Details
#CUPS_name ⇒ String
Returns The CUPs name to be used.
50 51 52 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 50 def CUPS_name @CUPS_name end |
#info ⇒ String
Returns Information for this specific printer.
62 63 64 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 62 def info @info end |
#location ⇒ String
Returns The physical location of the printer.
53 54 55 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 53 def location @location end |
#make_default ⇒ Boolean
Returns Make this printer as the default printer upon installation.
68 69 70 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 68 def make_default @make_default end |
#model ⇒ String
Returns The specific model of printer.
56 57 58 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 56 def model @model end |
#need_to_update ⇒ Boolean (readonly) Originally defined in module Updatable
Returns do we have unsaved changes?.
#notes ⇒ String
Returns Notes for this specific printer.
65 66 67 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 65 def notes @notes end |
#os_requirements ⇒ String
Returns The OS version requirements seperated by commas.
83 84 85 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 83 def os_requirements @os_requirements end |
#ppd ⇒ String
Returns The PPD file name.
74 75 76 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 74 def ppd @ppd end |
#ppd_contents ⇒ String
Returns The contents of the PPD file.
77 78 79 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 77 def ppd_contents @ppd_contents end |
#ppd_path ⇒ String
Returns The path the PPD file will be installed.
80 81 82 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 80 def ppd_path @ppd_path end |
#shared ⇒ Boolean
Returns Is this printer to be shared?.
59 60 61 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 59 def shared @shared end |
#uri ⇒ String
Returns The URI path for the specific printer.
47 48 49 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 47 def uri @uri end |
#use_generic ⇒ Boolean
Returns Use a generic PPD.
71 72 73 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 71 def use_generic @use_generic end |
Instance Method Details
#category=(new_cat) ⇒ void Originally defined in module Categorizable
This method returns an undefined value.
Change the category of this object. Any of the NON_CATEGORIES values will unset the category
#category_assigned? ⇒ Boolean Also known as: categorized? Originally defined in module Categorizable
Does this object have a category assigned?
#category_id ⇒ Integer Originally defined in module Categorizable
The id of the category for this object.
#category_name ⇒ String Also known as: category Originally defined in module Categorizable
The name of the category for this object. For backward compatibility, this is aliased to just ‘category’
#category_object ⇒ Jamf::Category Originally defined in module Categorizable
The Jamf::Category instance for this object’s category
#clone(new_name, api: nil, cnx: nil) ⇒ APIObject Originally defined in module Creatable
make a clone of this API object, with a new name. The class must be creatable
#evaluate_new_category(new_cat) ⇒ Array<String, Integer> Originally defined in module Categorizable
Given a category name or id, return the name and id TODO: use APIObject.exist? and/or APIObject.valid_id
#name=(newname) ⇒ void Originally defined in module Updatable
This method returns an undefined value.
Change the name of this item Remember to #update to push changes to the server.
#pretty_print_instance_variables ⇒ Array
Remove the various large data from the instance_variables used to create pretty-print (pp) output.
408 409 410 411 412 |
# File 'lib/jamf/api/classic/api_objects/printer.rb', line 408 def pretty_print_instance_variables vars = super vars.delete :@ppd_contents vars end |
#unset_category ⇒ void Originally defined in module Categorizable
This method returns an undefined value.
Set the category to nothing