Class: JSS::ComputerInvitation
- Defined in:
- lib/jss/api_object/computer_invitation.rb
Overview
This class represents a Computer Invitation in the JSS.
Adding Computer Invitations to the JSS
This class is meant only to generate and hold the response of creating an invitation.
Constant Summary collapse
- RSRC_BASE =
The base for REST resources of this class
'computerinvitations'.freeze
- RSRC_LIST_KEY =
the hash key used for the JSON list output of all objects in the JSS
:computer_invitations
- RSRC_OBJECT_KEY =
The hash key used for the JSON object output. It's also used in various error messages
:computer_invitation
- OTHER_LOOKUP_KEYS =
See JSS::APIObject
{ invitation: { fetch_rsrc_key: :invitation } }.freeze
- OBJECT_HISTORY_OBJECT_TYPE =
the object type for this object in the object history table. See APIObject#add_object_history_entry
84
- SITE_SUBSET =
Where is site data located in the API JSON?
:top
Instance Attribute Summary collapse
-
#create_account_if_does_not_exist ⇒ String
“true” or “false” are valid values.
-
#expiration_date_epoch ⇒ String
Time since epoch that the invitation will expire at.
-
#hide_account ⇒ String
The whether or not to hide the ssh user.
-
#invitation_status ⇒ String
The invitation_status.
-
#invitation_type ⇒ String
Valid values are: URL and EMAIL.
-
#multiple_uses_allowed ⇒ String
Whether the invitation can be used multiple times (boolean).
-
#name ⇒ String
readonly
The invitation name.
-
#ssh_username ⇒ String
The username of the ssh user to be created.
Instance Method Summary collapse
-
#clone(new_name, api: nil) ⇒ APIObject
included
from Creatable
make a clone of this API object, with a new name.
-
#create ⇒ JSS::ComputerInvitation
Needed to support creation of new Computer Invitations to set their name.
-
#initialize(args = { id: :new, name: 'some_new_name', ssh_username: 'casper_remote', hide_account: 'true' }) ⇒ ComputerInvitation
constructor
A new instance of ComputerInvitation.
-
#site=(new_site) ⇒ void
included
from Sitable
Change the site of this object.
-
#site_assigned? ⇒ Boolean
included
from Sitable
Does this object have a site assigned?.
-
#site_id ⇒ Integer
included
from Sitable
The id of the site for this object.
-
#site_name ⇒ String
(also: #site)
included
from Sitable
The name of the site for this object.
-
#site_object ⇒ JSS::Site
included
from Sitable
The JSS::Site instance for this object's site.
-
#unset_site ⇒ void
included
from Sitable
Set the site to nothing.
Constructor Details
#initialize(args = { id: :new, name: 'some_new_name', ssh_username: 'casper_remote', hide_account: 'true' }) ⇒ ComputerInvitation
Returns a new instance of ComputerInvitation.
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/jss/api_object/computer_invitation.rb', line 136 def initialize(args = { id: :new, name: 'some_new_name', ssh_username: 'casper_remote', hide_account: 'true' }) super args @name = @init_data[:invitation] @invitation_type = @init_data[:invitation_type] @create_account_if_does_not_exist = @init_data[:create_account_if_does_not_exist] @expiration_date_epoch = @init_data[:expiration_date_epoch] || args[:expiration_date_epoch] @ssh_username = @init_data[:ssh_username] || args[:ssh_username] @hide_account = @init_data[:hide_account] || args[:hide_account] @invitation_status = @init_data[:invitation_status] || args[:invitation_status] @multiple_uses_allowed = @init_data[:multiple_uses_allowed] || args[:multiple_uses_allowed] end |
Instance Attribute Details
#create_account_if_does_not_exist ⇒ String
“true” or “false” are valid values.
100 101 102 |
# File 'lib/jss/api_object/computer_invitation.rb', line 100 def create_account_if_does_not_exist @create_account_if_does_not_exist end |
#expiration_date_epoch ⇒ String
Time since epoch that the invitation will expire at.
Note: defaults to “Unlimited”, so only set if it should expire.
107 108 109 |
# File 'lib/jss/api_object/computer_invitation.rb', line 107 def expiration_date_epoch @expiration_date_epoch end |
#hide_account ⇒ String
The whether or not to hide the ssh user.
119 120 121 |
# File 'lib/jss/api_object/computer_invitation.rb', line 119 def hide_account @hide_account end |
#invitation_status ⇒ String
The invitation_status.
124 125 126 |
# File 'lib/jss/api_object/computer_invitation.rb', line 124 def invitation_status @invitation_status end |
#invitation_type ⇒ String
Valid values are: URL and EMAIL. Will default to DEFAULT.
95 96 97 |
# File 'lib/jss/api_object/computer_invitation.rb', line 95 def invitation_type @invitation_type end |
#multiple_uses_allowed ⇒ String
Whether the invitation can be used multiple times (boolean).
129 130 131 |
# File 'lib/jss/api_object/computer_invitation.rb', line 129 def multiple_uses_allowed @multiple_uses_allowed end |
#name ⇒ String (readonly)
Returns the invitation name.
90 91 92 |
# File 'lib/jss/api_object/computer_invitation.rb', line 90 def name @name end |
#ssh_username ⇒ String
The username of the ssh user to be created.
REQUIRED for valid setup.
114 115 116 |
# File 'lib/jss/api_object/computer_invitation.rb', line 114 def ssh_username @ssh_username end |
Instance Method Details
#clone(new_name, api: nil) ⇒ APIObject Originally defined in module Creatable
make a clone of this API object, with a new name. The class must be creatable
#create ⇒ JSS::ComputerInvitation
Needed to support creation of new Computer Invitations to set their name.
162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/jss/api_object/computer_invitation.rb', line 162 def create new_invitation_id = super jss_me = ComputerInvitation.fetch(id: new_invitation_id, name: 'set_by_request') @name = jss_me.name @invitation_type = jss_me.invitation_type @create_account_if_does_not_exist = jss_me.create_account_if_does_not_exist @expiration_date_epoch = jss_me.expiration_date_epoch @ssh_username = jss_me.ssh_username @hide_account = jss_me.hide_account @invitation_status = jss_me.invitation_status @multiple_uses_allowed = jss_me.multiple_uses_allowed end |
#site=(new_site) ⇒ void Originally defined in module Sitable
This method returns an undefined value.
Change the site of this object. Any of the NON_SITES values will unset the site
#site_assigned? ⇒ Boolean Originally defined in module Sitable
Does this object have a site assigned?
#site_id ⇒ Integer Originally defined in module Sitable
The id of the site for this object.
#site_name ⇒ String Also known as: site Originally defined in module Sitable
The name of the site for this object. For backward compatibility, this is aliased to just 'site'
#site_object ⇒ JSS::Site Originally defined in module Sitable
The JSS::Site instance for this object's site
#unset_site ⇒ void Originally defined in module Sitable
This method returns an undefined value.
Set the site to nothing