repo stringlengths 5 58 | path stringlengths 9 168 | func_name stringlengths 9 130 | original_string stringlengths 66 10.5k | language stringclasses 1
value | code stringlengths 66 10.5k | code_tokens list | docstring stringlengths 8 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 94 266 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
cryptape/ruby-ethereum | lib/ethereum/trie.rb | Ethereum.Trie.[]= | def []=(key, value)
raise ArgumentError, "key must be string" unless key.instance_of?(String)
raise ArgumentError, "value must be string" unless value.instance_of?(String)
@root_node = update_and_delete_storage(
@root_node,
NibbleKey.from_string(key),
value
)
upda... | ruby | def []=(key, value)
raise ArgumentError, "key must be string" unless key.instance_of?(String)
raise ArgumentError, "value must be string" unless value.instance_of?(String)
@root_node = update_and_delete_storage(
@root_node,
NibbleKey.from_string(key),
value
)
upda... | [
"def",
"[]=",
"(",
"key",
",",
"value",
")",
"raise",
"ArgumentError",
",",
"\"key must be string\"",
"unless",
"key",
".",
"instance_of?",
"(",
"String",
")",
"raise",
"ArgumentError",
",",
"\"value must be string\"",
"unless",
"value",
".",
"instance_of?",
"(",
... | Set value of key.
@param key [String]
@param value [String] | [
"Set",
"value",
"of",
"key",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/trie.rb#L96-L107 | train |
cryptape/ruby-ethereum | lib/ethereum/trie.rb | Ethereum.Trie.delete | def delete(key)
raise ArgumentError, "key must be string" unless key.instance_of?(String)
raise ArgumentError, "max key size is 32" if key.size > 32
@root_node = delete_and_delete_storage(
@root_node,
NibbleKey.from_string(key)
)
update_root_hash
end | ruby | def delete(key)
raise ArgumentError, "key must be string" unless key.instance_of?(String)
raise ArgumentError, "max key size is 32" if key.size > 32
@root_node = delete_and_delete_storage(
@root_node,
NibbleKey.from_string(key)
)
update_root_hash
end | [
"def",
"delete",
"(",
"key",
")",
"raise",
"ArgumentError",
",",
"\"key must be string\"",
"unless",
"key",
".",
"instance_of?",
"(",
"String",
")",
"raise",
"ArgumentError",
",",
"\"max key size is 32\"",
"if",
"key",
".",
"size",
">",
"32",
"@root_node",
"=",
... | Delete value at key.
@param key [String] a string with length of [0,32] | [
"Delete",
"value",
"at",
"key",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/trie.rb#L115-L125 | train |
cryptape/ruby-ethereum | lib/ethereum/trie.rb | Ethereum.Trie.to_h | def to_h
h = {}
to_hash(@root_node).each do |k, v|
key = k.terminate(false).to_string
h[key] = v
end
h
end | ruby | def to_h
h = {}
to_hash(@root_node).each do |k, v|
key = k.terminate(false).to_string
h[key] = v
end
h
end | [
"def",
"to_h",
"h",
"=",
"{",
"}",
"to_hash",
"(",
"@root_node",
")",
".",
"each",
"do",
"|",
"k",
",",
"v",
"|",
"key",
"=",
"k",
".",
"terminate",
"(",
"false",
")",
".",
"to_string",
"h",
"[",
"key",
"]",
"=",
"v",
"end",
"h",
"end"
] | Convert to hash. | [
"Convert",
"to",
"hash",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/trie.rb#L130-L137 | train |
cryptape/ruby-ethereum | lib/ethereum/trie.rb | Ethereum.Trie.find | def find(node, nbk)
node_type = get_node_type node
case node_type
when :blank
BLANK_NODE
when :branch
return node.last if nbk.empty?
sub_node = decode_to_node node[nbk[0]]
find sub_node, nbk[1..-1]
when :leaf
node_key = NibbleKey.decode(node[0]).te... | ruby | def find(node, nbk)
node_type = get_node_type node
case node_type
when :blank
BLANK_NODE
when :branch
return node.last if nbk.empty?
sub_node = decode_to_node node[nbk[0]]
find sub_node, nbk[1..-1]
when :leaf
node_key = NibbleKey.decode(node[0]).te... | [
"def",
"find",
"(",
"node",
",",
"nbk",
")",
"node_type",
"=",
"get_node_type",
"node",
"case",
"node_type",
"when",
":blank",
"BLANK_NODE",
"when",
":branch",
"return",
"node",
".",
"last",
"if",
"nbk",
".",
"empty?",
"sub_node",
"=",
"decode_to_node",
"nod... | Get value inside a node.
@param node [Array, BLANK_NODE] node in form of array, or BLANK_NODE
@param nbk [Array] nibble array without terminator
@return [String] BLANK_NODE if does not exist, otherwise node value | [
"Get",
"value",
"inside",
"a",
"node",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/trie.rb#L172-L197 | train |
cryptape/ruby-ethereum | lib/ethereum/trie.rb | Ethereum.Trie.update_node | def update_node(node, key, value)
node_type = get_node_type node
case node_type
when :blank
[key.terminate(true).encode, value]
when :branch
if key.empty?
node.last = value
else
new_node = update_and_delete_storage(
decode_to_node(node[key... | ruby | def update_node(node, key, value)
node_type = get_node_type node
case node_type
when :blank
[key.terminate(true).encode, value]
when :branch
if key.empty?
node.last = value
else
new_node = update_and_delete_storage(
decode_to_node(node[key... | [
"def",
"update_node",
"(",
"node",
",",
"key",
",",
"value",
")",
"node_type",
"=",
"get_node_type",
"node",
"case",
"node_type",
"when",
":blank",
"[",
"key",
".",
"terminate",
"(",
"true",
")",
".",
"encode",
",",
"value",
"]",
"when",
":branch",
"if",... | Update item inside a node.
If this node is changed to a new node, it's parent will take the
responsibility to **store** the new node storage, and delete the old node
storage.
@param node [Array, BLANK_NODE] node in form of array, or BLANK_NODE
@param key [Array] nibble key without terminator
@param value [Strin... | [
"Update",
"item",
"inside",
"a",
"node",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/trie.rb#L275-L299 | train |
cryptape/ruby-ethereum | lib/ethereum/trie.rb | Ethereum.Trie.delete_node | def delete_node(node, key)
case get_node_type(node)
when :blank
BLANK_NODE
when :branch
delete_branch_node(node, key)
else # kv type
delete_kv_node(node, key)
end
end | ruby | def delete_node(node, key)
case get_node_type(node)
when :blank
BLANK_NODE
when :branch
delete_branch_node(node, key)
else # kv type
delete_kv_node(node, key)
end
end | [
"def",
"delete_node",
"(",
"node",
",",
"key",
")",
"case",
"get_node_type",
"(",
"node",
")",
"when",
":blank",
"BLANK_NODE",
"when",
":branch",
"delete_branch_node",
"(",
"node",
",",
"key",
")",
"else",
"# kv type",
"delete_kv_node",
"(",
"node",
",",
"ke... | Delete item inside node.
If this node is changed to a new node, it's parent will take the
responsibility to **store** the new node storage, and delete the old node
storage.
@param node [Array, BLANK_NODE] node in form of array, or BLANK_NODE
@param key [Array] nibble key without terminator. key maybe empty
@re... | [
"Delete",
"item",
"inside",
"node",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/trie.rb#L403-L412 | train |
cryptape/ruby-ethereum | lib/ethereum/trie.rb | Ethereum.Trie.delete_node_storage | def delete_node_storage(node)
return if node == BLANK_NODE
raise ArgumentError, "node must be Array or BLANK_NODE" unless node.instance_of?(Array)
encoded = encode_node node
return if encoded.size < 32
# FIXME: in current trie implementation two nodes can share identical
# subtree ... | ruby | def delete_node_storage(node)
return if node == BLANK_NODE
raise ArgumentError, "node must be Array or BLANK_NODE" unless node.instance_of?(Array)
encoded = encode_node node
return if encoded.size < 32
# FIXME: in current trie implementation two nodes can share identical
# subtree ... | [
"def",
"delete_node_storage",
"(",
"node",
")",
"return",
"if",
"node",
"==",
"BLANK_NODE",
"raise",
"ArgumentError",
",",
"\"node must be Array or BLANK_NODE\"",
"unless",
"node",
".",
"instance_of?",
"(",
"Array",
")",
"encoded",
"=",
"encode_node",
"node",
"retur... | Delete node storage.
@param node [Array, BLANK_NODE] node in form of array, or BLANK_NODE | [
"Delete",
"node",
"storage",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/trie.rb#L494-L505 | train |
cryptape/ruby-ethereum | lib/ethereum/trie.rb | Ethereum.Trie.get_node_type | def get_node_type(node)
return :blank if node == BLANK_NODE
case node.size
when KV_WIDTH # [k,v]
NibbleKey.decode(node[0]).terminate? ? :leaf : :extension
when BRANCH_WIDTH # [k0, ... k15, v]
:branch
else
raise InvalidNode, "node size must be #{KV_WIDTH} or #{BRANC... | ruby | def get_node_type(node)
return :blank if node == BLANK_NODE
case node.size
when KV_WIDTH # [k,v]
NibbleKey.decode(node[0]).terminate? ? :leaf : :extension
when BRANCH_WIDTH # [k0, ... k15, v]
:branch
else
raise InvalidNode, "node size must be #{KV_WIDTH} or #{BRANC... | [
"def",
"get_node_type",
"(",
"node",
")",
"return",
":blank",
"if",
"node",
"==",
"BLANK_NODE",
"case",
"node",
".",
"size",
"when",
"KV_WIDTH",
"# [k,v]",
"NibbleKey",
".",
"decode",
"(",
"node",
"[",
"0",
"]",
")",
".",
"terminate?",
"?",
":leaf",
":",... | get node type and content
@param node [Array, BLANK_NODE] node in form of array, or BLANK_NODE
@return [Symbol] node type | [
"get",
"node",
"type",
"and",
"content"
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/trie.rb#L526-L537 | train |
cryptape/ruby-ethereum | lib/ethereum/vm.rb | Ethereum.VM.preprocess_code | def preprocess_code(code)
code = Utils.bytes_to_int_array code
ops = []
i = 0
while i < code.size
o = Opcodes::TABLE.fetch(code[i], [:INVALID, 0, 0, 0]) + [code[i], 0]
ops.push o
if o[0][0,Opcodes::PREFIX_PUSH.size] == Opcodes::PREFIX_PUSH
n = o[0][Opcodes::PR... | ruby | def preprocess_code(code)
code = Utils.bytes_to_int_array code
ops = []
i = 0
while i < code.size
o = Opcodes::TABLE.fetch(code[i], [:INVALID, 0, 0, 0]) + [code[i], 0]
ops.push o
if o[0][0,Opcodes::PREFIX_PUSH.size] == Opcodes::PREFIX_PUSH
n = o[0][Opcodes::PR... | [
"def",
"preprocess_code",
"(",
"code",
")",
"code",
"=",
"Utils",
".",
"bytes_to_int_array",
"code",
"ops",
"=",
"[",
"]",
"i",
"=",
"0",
"while",
"i",
"<",
"code",
".",
"size",
"o",
"=",
"Opcodes",
"::",
"TABLE",
".",
"fetch",
"(",
"code",
"[",
"i... | Preprocesses code, and determines which locations are in the middle of
pushdata and thus invalid | [
"Preprocesses",
"code",
"and",
"determines",
"which",
"locations",
"are",
"in",
"the",
"middle",
"of",
"pushdata",
"and",
"thus",
"invalid"
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/vm.rb#L574-L599 | train |
cryptape/ruby-ethereum | lib/ethereum/block_header.rb | Ethereum.BlockHeader.check_pow | def check_pow(nonce=nil)
logger.debug "checking pow", block: full_hash_hex[0,8]
Miner.check_pow(number, mining_hash, mixhash, nonce || self.nonce, difficulty)
end | ruby | def check_pow(nonce=nil)
logger.debug "checking pow", block: full_hash_hex[0,8]
Miner.check_pow(number, mining_hash, mixhash, nonce || self.nonce, difficulty)
end | [
"def",
"check_pow",
"(",
"nonce",
"=",
"nil",
")",
"logger",
".",
"debug",
"\"checking pow\"",
",",
"block",
":",
"full_hash_hex",
"[",
"0",
",",
"8",
"]",
"Miner",
".",
"check_pow",
"(",
"number",
",",
"mining_hash",
",",
"mixhash",
",",
"nonce",
"||",
... | Check if the proof-of-work of the block is valid.
@param nonce [String] if given the proof of work function will be
evaluated with this nonce instead of the one already present in the
header
@return [Bool] | [
"Check",
"if",
"the",
"proof",
"-",
"of",
"-",
"work",
"of",
"the",
"block",
"is",
"valid",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/block_header.rb#L147-L150 | train |
cryptape/ruby-ethereum | lib/ethereum/block_header.rb | Ethereum.BlockHeader.to_h | def to_h
h = {}
%i(prevhash uncles_hash extra_data nonce mixhash).each do |field|
h[field] = "0x#{Utils.encode_hex(send field)}"
end
%i(state_root tx_list_root receipts_root coinbase).each do |field|
h[field] = Utils.encode_hex send(field)
end
%i(number difficulty ... | ruby | def to_h
h = {}
%i(prevhash uncles_hash extra_data nonce mixhash).each do |field|
h[field] = "0x#{Utils.encode_hex(send field)}"
end
%i(state_root tx_list_root receipts_root coinbase).each do |field|
h[field] = Utils.encode_hex send(field)
end
%i(number difficulty ... | [
"def",
"to_h",
"h",
"=",
"{",
"}",
"%i(",
"prevhash",
"uncles_hash",
"extra_data",
"nonce",
"mixhash",
")",
".",
"each",
"do",
"|",
"field",
"|",
"h",
"[",
"field",
"]",
"=",
"\"0x#{Utils.encode_hex(send field)}\"",
"end",
"%i(",
"state_root",
"tx_list_root",
... | Serialize the header to a readable hash. | [
"Serialize",
"the",
"header",
"to",
"a",
"readable",
"hash",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/block_header.rb#L155-L173 | train |
cryptape/ruby-ethereum | lib/ethereum/chain.rb | Ethereum.Chain.get_brothers | def get_brothers(block)
o = []
i = 0
while block.has_parent? && i < @env.config[:max_uncle_depth]
parent = block.get_parent
children = get_children(parent).select {|c| c != block }
o.concat children
block = parent
i += 1
end
o
end | ruby | def get_brothers(block)
o = []
i = 0
while block.has_parent? && i < @env.config[:max_uncle_depth]
parent = block.get_parent
children = get_children(parent).select {|c| c != block }
o.concat children
block = parent
i += 1
end
o
end | [
"def",
"get_brothers",
"(",
"block",
")",
"o",
"=",
"[",
"]",
"i",
"=",
"0",
"while",
"block",
".",
"has_parent?",
"&&",
"i",
"<",
"@env",
".",
"config",
"[",
":max_uncle_depth",
"]",
"parent",
"=",
"block",
".",
"get_parent",
"children",
"=",
"get_chi... | Return the uncles of the hypothetical child of `block`. | [
"Return",
"the",
"uncles",
"of",
"the",
"hypothetical",
"child",
"of",
"block",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/chain.rb#L68-L81 | train |
cryptape/ruby-ethereum | lib/ethereum/chain.rb | Ethereum.Chain.add_block | def add_block(block, forward_pending_transaction=true)
unless block.has_parent? || block.genesis?
logger.debug "missing parent", block_hash: block
return false
end
unless block.validate_uncles
logger.debug "invalid uncles", block_hash: block
return false
end
... | ruby | def add_block(block, forward_pending_transaction=true)
unless block.has_parent? || block.genesis?
logger.debug "missing parent", block_hash: block
return false
end
unless block.validate_uncles
logger.debug "invalid uncles", block_hash: block
return false
end
... | [
"def",
"add_block",
"(",
"block",
",",
"forward_pending_transaction",
"=",
"true",
")",
"unless",
"block",
".",
"has_parent?",
"||",
"block",
".",
"genesis?",
"logger",
".",
"debug",
"\"missing parent\"",
",",
"block_hash",
":",
"block",
"return",
"false",
"end"... | Returns `true` if block was added successfully. | [
"Returns",
"true",
"if",
"block",
"was",
"added",
"successfully",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/chain.rb#L109-L160 | train |
cryptape/ruby-ethereum | lib/ethereum/chain.rb | Ethereum.Chain.add_transaction | def add_transaction(transaction)
raise AssertError, "head candiate cannot be nil" unless @head_candidate
hc = @head_candidate
logger.debug "add tx", num_txs: transaction_count, tx: transaction, on: hc
if @head_candidate.include_transaction?(transaction.full_hash)
logger.debug "known tx... | ruby | def add_transaction(transaction)
raise AssertError, "head candiate cannot be nil" unless @head_candidate
hc = @head_candidate
logger.debug "add tx", num_txs: transaction_count, tx: transaction, on: hc
if @head_candidate.include_transaction?(transaction.full_hash)
logger.debug "known tx... | [
"def",
"add_transaction",
"(",
"transaction",
")",
"raise",
"AssertError",
",",
"\"head candiate cannot be nil\"",
"unless",
"@head_candidate",
"hc",
"=",
"@head_candidate",
"logger",
".",
"debug",
"\"add tx\"",
",",
"num_txs",
":",
"transaction_count",
",",
"tx",
":"... | Add a transaction to the `head_candidate` block.
If the transaction is invalid, the block will not be changed.
@return [Bool,NilClass] `true` is the transaction was successfully added or
`false` if the transaction was invalid, `nil` if it's already included | [
"Add",
"a",
"transaction",
"to",
"the",
"head_candidate",
"block",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/chain.rb#L174-L211 | train |
cryptape/ruby-ethereum | lib/ethereum/chain.rb | Ethereum.Chain.get_chain | def get_chain(start: '', count: 10)
logger.debug "get_chain", start: Utils.encode_hex(start), count: count
if start.true?
return [] unless @index.db.include?(start)
block = get start
return [] unless in_main_branch?(block)
else
block = head
end
blocks = [... | ruby | def get_chain(start: '', count: 10)
logger.debug "get_chain", start: Utils.encode_hex(start), count: count
if start.true?
return [] unless @index.db.include?(start)
block = get start
return [] unless in_main_branch?(block)
else
block = head
end
blocks = [... | [
"def",
"get_chain",
"(",
"start",
":",
"''",
",",
"count",
":",
"10",
")",
"logger",
".",
"debug",
"\"get_chain\"",
",",
"start",
":",
"Utils",
".",
"encode_hex",
"(",
"start",
")",
",",
"count",
":",
"count",
"if",
"start",
".",
"true?",
"return",
"... | Return `count` of blocks starting from head or `start`. | [
"Return",
"count",
"of",
"blocks",
"starting",
"from",
"head",
"or",
"start",
"."
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/chain.rb#L233-L253 | train |
cryptape/ruby-ethereum | lib/ethereum/chain.rb | Ethereum.Chain.update_head_candidate | def update_head_candidate(forward_pending_transaction=true)
logger.debug "updating head candidate", head: head
# collect uncles
blk = head # parent of the block we are collecting uncles for
uncles = get_brothers(blk).map(&:header).uniq
(@env.config[:max_uncle_depth]+2).times do |i|
... | ruby | def update_head_candidate(forward_pending_transaction=true)
logger.debug "updating head candidate", head: head
# collect uncles
blk = head # parent of the block we are collecting uncles for
uncles = get_brothers(blk).map(&:header).uniq
(@env.config[:max_uncle_depth]+2).times do |i|
... | [
"def",
"update_head_candidate",
"(",
"forward_pending_transaction",
"=",
"true",
")",
"logger",
".",
"debug",
"\"updating head candidate\"",
",",
"head",
":",
"head",
"# collect uncles",
"blk",
"=",
"head",
"# parent of the block we are collecting uncles for",
"uncles",
"="... | after new head is set | [
"after",
"new",
"head",
"is",
"set"
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/chain.rb#L355-L397 | train |
cryptape/ruby-ethereum | lib/ethereum/index.rb | Ethereum.Index.update_blocknumbers | def update_blocknumbers(blk)
loop do
if blk.number > 0
@db.put_temporarily block_by_number_key(blk.number), blk.full_hash
else
@db.put block_by_number_key(blk.number), blk.full_hash
end
@db.commit_refcount_changes blk.number
break if blk.number == 0
... | ruby | def update_blocknumbers(blk)
loop do
if blk.number > 0
@db.put_temporarily block_by_number_key(blk.number), blk.full_hash
else
@db.put block_by_number_key(blk.number), blk.full_hash
end
@db.commit_refcount_changes blk.number
break if blk.number == 0
... | [
"def",
"update_blocknumbers",
"(",
"blk",
")",
"loop",
"do",
"if",
"blk",
".",
"number",
">",
"0",
"@db",
".",
"put_temporarily",
"block_by_number_key",
"(",
"blk",
".",
"number",
")",
",",
"blk",
".",
"full_hash",
"else",
"@db",
".",
"put",
"block_by_numb... | start from head and update until the existing indices match the block | [
"start",
"from",
"head",
"and",
"update",
"until",
"the",
"existing",
"indices",
"match",
"the",
"block"
] | 763f8651085ba145355a290da716884c7625a941 | https://github.com/cryptape/ruby-ethereum/blob/763f8651085ba145355a290da716884c7625a941/lib/ethereum/index.rb#L33-L47 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/package.rb | JSS.Package.install_if_reported_available= | def install_if_reported_available=(new_val)
return nil if new_val == @install_if_reported_available
new_val = false if new_val.to_s.empty?
raise JSS::InvalidDataError, 'install_if_reported_available must be boolean true or false' unless JSS::TRUE_FALSE.include? new_val
@install_if_reported_avail... | ruby | def install_if_reported_available=(new_val)
return nil if new_val == @install_if_reported_available
new_val = false if new_val.to_s.empty?
raise JSS::InvalidDataError, 'install_if_reported_available must be boolean true or false' unless JSS::TRUE_FALSE.include? new_val
@install_if_reported_avail... | [
"def",
"install_if_reported_available",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@install_if_reported_available",
"new_val",
"=",
"false",
"if",
"new_val",
".",
"to_s",
".",
"empty?",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'insta... | Change the if_in_swupdate field in the JSS
@param new_val[Boolean]
@return [void] | [
"Change",
"the",
"if_in_swupdate",
"field",
"in",
"the",
"JSS"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/package.rb#L383-L389 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/package.rb | JSS.Package.priority= | def priority=(new_val)
return nil if new_val == @priority
new_val = DEFAULT_PRIORITY if new_val.to_s.empty?
raise JSS::InvalidDataError, ':priority must be an integer from 1-20' unless PRIORITIES.include? new_val
@priority = new_val
@need_to_update = true
end | ruby | def priority=(new_val)
return nil if new_val == @priority
new_val = DEFAULT_PRIORITY if new_val.to_s.empty?
raise JSS::InvalidDataError, ':priority must be an integer from 1-20' unless PRIORITIES.include? new_val
@priority = new_val
@need_to_update = true
end | [
"def",
"priority",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@priority",
"new_val",
"=",
"DEFAULT_PRIORITY",
"if",
"new_val",
".",
"to_s",
".",
"empty?",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"':priority must be an integer from 1-... | Change the priority field in the JSS
@param new_val[Integer] one of PRIORITIES
@return [void] | [
"Change",
"the",
"priority",
"field",
"in",
"the",
"JSS"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/package.rb#L485-L491 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/package.rb | JSS.Package.required_processor= | def required_processor=(new_val)
return nil if new_val == @required_processor
new_val = DEFAULT_PROCESSOR if new_val.to_s.empty?
raise JSS::InvalidDataError, "Required_processor must be one of: #{CPU_TYPES.join ', '}" unless CPU_TYPES.include? new_val
@required_processor = new_val
@need_... | ruby | def required_processor=(new_val)
return nil if new_val == @required_processor
new_val = DEFAULT_PROCESSOR if new_val.to_s.empty?
raise JSS::InvalidDataError, "Required_processor must be one of: #{CPU_TYPES.join ', '}" unless CPU_TYPES.include? new_val
@required_processor = new_val
@need_... | [
"def",
"required_processor",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@required_processor",
"new_val",
"=",
"DEFAULT_PROCESSOR",
"if",
"new_val",
".",
"to_s",
".",
"empty?",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"Required_proce... | Change the required processor field in the JSS
@param new_val[String] one of {CPU_TYPES}
@return [void] | [
"Change",
"the",
"required",
"processor",
"field",
"in",
"the",
"JSS"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/package.rb#L513-L521 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/package.rb | JSS.Package.calculate_checksum | def calculate_checksum(type: nil, local_file: nil, rw_pw: nil, ro_pw: nil, unmount: true )
type ||= DEFAULT_CHECKSUM_HASH_TYPE
mdp = JSS::DistributionPoint.master_distribution_point api: @api
if local_file
file_to_calc = local_file
else
if rw_pw
dppw = rw_pw
... | ruby | def calculate_checksum(type: nil, local_file: nil, rw_pw: nil, ro_pw: nil, unmount: true )
type ||= DEFAULT_CHECKSUM_HASH_TYPE
mdp = JSS::DistributionPoint.master_distribution_point api: @api
if local_file
file_to_calc = local_file
else
if rw_pw
dppw = rw_pw
... | [
"def",
"calculate_checksum",
"(",
"type",
":",
"nil",
",",
"local_file",
":",
"nil",
",",
"rw_pw",
":",
"nil",
",",
"ro_pw",
":",
"nil",
",",
"unmount",
":",
"true",
")",
"type",
"||=",
"DEFAULT_CHECKSUM_HASH_TYPE",
"mdp",
"=",
"JSS",
"::",
"DistributionPo... | Caclulate and return the checksum hash for a given local file, or the file
on the master dist point if no local file is given.
@param type [String] The checksum hash type, one of the keys of
CHECKSUM_HASH_TYPES
@param local_file [String, Pathname] A local copy of the pkg file. BE SURE
it's identical to the o... | [
"Caclulate",
"and",
"return",
"the",
"checksum",
"hash",
"for",
"a",
"given",
"local",
"file",
"or",
"the",
"file",
"on",
"the",
"master",
"dist",
"point",
"if",
"no",
"local",
"file",
"is",
"given",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/package.rb#L702-L723 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/package.rb | JSS.Package.checksum_valid? | def checksum_valid?(local_file: nil, rw_pw: nil, ro_pw: nil, unmount: true)
return false unless @checksum
new_checksum = calculate_checksum(
type: @checksum_type,
local_file: local_file,
rw_pw: rw_pw,
ro_pw: ro_pw,
unmount: unmount
)
new_checksum == @check... | ruby | def checksum_valid?(local_file: nil, rw_pw: nil, ro_pw: nil, unmount: true)
return false unless @checksum
new_checksum = calculate_checksum(
type: @checksum_type,
local_file: local_file,
rw_pw: rw_pw,
ro_pw: ro_pw,
unmount: unmount
)
new_checksum == @check... | [
"def",
"checksum_valid?",
"(",
"local_file",
":",
"nil",
",",
"rw_pw",
":",
"nil",
",",
"ro_pw",
":",
"nil",
",",
"unmount",
":",
"true",
")",
"return",
"false",
"unless",
"@checksum",
"new_checksum",
"=",
"calculate_checksum",
"(",
"type",
":",
"@checksum_t... | Is the checksum for this pkg is valid?
@param local_file [String, Pathname] A local copy of the pkg file. BE SURE
it's identical to the one on the server. If omitted, the master dist.
point will be mounted and the file read from there.
@param rw_pw [String] The read-write password for mounting the master dist... | [
"Is",
"the",
"checksum",
"for",
"this",
"pkg",
"is",
"valid?"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/package.rb#L743-L753 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/package.rb | JSS.Package.update_master_filename | def update_master_filename(old_file_name, new_file_name, rw_pw, unmount = true)
raise JSS::NoSuchItemError, "#{old_file_name} does not exist in the jss." unless @in_jss
mdp = JSS::DistributionPoint.master_distribution_point api: @api
pkgs_dir = mdp.mount(rw_pw, :rw) + DIST_POINT_PKGS_FOLDER.to_s
... | ruby | def update_master_filename(old_file_name, new_file_name, rw_pw, unmount = true)
raise JSS::NoSuchItemError, "#{old_file_name} does not exist in the jss." unless @in_jss
mdp = JSS::DistributionPoint.master_distribution_point api: @api
pkgs_dir = mdp.mount(rw_pw, :rw) + DIST_POINT_PKGS_FOLDER.to_s
... | [
"def",
"update_master_filename",
"(",
"old_file_name",
",",
"new_file_name",
",",
"rw_pw",
",",
"unmount",
"=",
"true",
")",
"raise",
"JSS",
"::",
"NoSuchItemError",
",",
"\"#{old_file_name} does not exist in the jss.\"",
"unless",
"@in_jss",
"mdp",
"=",
"JSS",
"::",
... | Change the name of a package file on the master distribution point.
@param new_file_name[String]
@param old_file_name[default: @filename, String]
@param unmount[Boolean] whether or not ot unount the distribution point when finished.
@param rw_pw[String,Symbol] the password for the read/write account on the mast... | [
"Change",
"the",
"name",
"of",
"a",
"package",
"file",
"on",
"the",
"master",
"distribution",
"point",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/package.rb#L768-L783 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/package.rb | JSS.Package.delete | def delete(delete_file: false, rw_pw: nil, unmount: true)
super()
delete_master_file(rw_pw, unmount) if delete_file
end | ruby | def delete(delete_file: false, rw_pw: nil, unmount: true)
super()
delete_master_file(rw_pw, unmount) if delete_file
end | [
"def",
"delete",
"(",
"delete_file",
":",
"false",
",",
"rw_pw",
":",
"nil",
",",
"unmount",
":",
"true",
")",
"super",
"(",
")",
"delete_master_file",
"(",
"rw_pw",
",",
"unmount",
")",
"if",
"delete_file",
"end"
] | delete master file
Delete this package from the JSS, optionally
deleting the master dist point file also.
@param delete_file[Boolean] should the master dist point file be deleted?
@param rw_pw[String] the password for the read/write account on the master Distribution Point
or :prompt, or :stdin# where # is the... | [
"delete",
"master",
"file",
"Delete",
"this",
"package",
"from",
"the",
"JSS",
"optionally",
"deleting",
"the",
"master",
"dist",
"point",
"file",
"also",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/package.rb#L822-L825 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/package.rb | JSS.Package.uninstall | def uninstall(args = {})
unless removable?
raise JSS::UnsupportedError, \
'This package cannot be uninstalled. Please use CasperAdmin to index it and allow uninstalls'
end
raise JSS::UnsupportedError, 'You must have root privileges to uninstall packages' unless JSS.superuser?
... | ruby | def uninstall(args = {})
unless removable?
raise JSS::UnsupportedError, \
'This package cannot be uninstalled. Please use CasperAdmin to index it and allow uninstalls'
end
raise JSS::UnsupportedError, 'You must have root privileges to uninstall packages' unless JSS.superuser?
... | [
"def",
"uninstall",
"(",
"args",
"=",
"{",
"}",
")",
"unless",
"removable?",
"raise",
"JSS",
"::",
"UnsupportedError",
",",
"'This package cannot be uninstalled. Please use CasperAdmin to index it and allow uninstalls'",
"end",
"raise",
"JSS",
"::",
"UnsupportedError",
",",... | Uninstall this pkg via the jamf command.
@param args[Hash] the arguments for installation
@option args :target[String,Pathname] The drive from which to uninstall the package, defaults to '/'
@option args :verbose[Boolean] be verbose to stdout, defaults to false
@option args :feu[Boolean] fill existing users, de... | [
"Uninstall",
"this",
"pkg",
"via",
"the",
"jamf",
"command",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/package.rb#L959-L978 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/distribution_point.rb | JSS.DistributionPoint.rest_xml | def rest_xml
doc = REXML::Document.new
dp = doc.add_element "distribution_point"
dp.add_element(:name.to_s).text = @name
dp.add_element(:ip_address.to_s).text = @ip_address
dp.add_element(:local_path.to_s).text = @local_path
dp.add_element(:enable_load_balancing.to_s).text = @enable_... | ruby | def rest_xml
doc = REXML::Document.new
dp = doc.add_element "distribution_point"
dp.add_element(:name.to_s).text = @name
dp.add_element(:ip_address.to_s).text = @ip_address
dp.add_element(:local_path.to_s).text = @local_path
dp.add_element(:enable_load_balancing.to_s).text = @enable_... | [
"def",
"rest_xml",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"dp",
"=",
"doc",
".",
"add_element",
"\"distribution_point\"",
"dp",
".",
"add_element",
"(",
":name",
".",
"to_s",
")",
".",
"text",
"=",
"@name",
"dp",
".",
"add_element",
"(",
":ip... | Unused - until I get around to making DP's updatable
the XML representation of the current state of this object,
for POSTing or PUTting back to the JSS via the API
Will be supported for Dist Points some day, I'm sure. | [
"Unused",
"-",
"until",
"I",
"get",
"around",
"to",
"making",
"DP",
"s",
"updatable"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/distribution_point.rb#L503-L538 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/webhook.rb | JSS.WebHook.event= | def event=(new_val)
return nil if new_val == @event
raise JSS::InvalidDataError, 'Unknown webhook event' unless EVENTS.include? new_val
@event = new_val
@need_to_update = true
end | ruby | def event=(new_val)
return nil if new_val == @event
raise JSS::InvalidDataError, 'Unknown webhook event' unless EVENTS.include? new_val
@event = new_val
@need_to_update = true
end | [
"def",
"event",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@event",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Unknown webhook event'",
"unless",
"EVENTS",
".",
"include?",
"new_val",
"@event",
"=",
"new_val",
"@need_to_update",
"="... | Set the event handled by this webhook
Must be a member of the EVENTS Array
@param new_val[String] The event name
@return [void] | [
"Set",
"the",
"event",
"handled",
"by",
"this",
"webhook",
"Must",
"be",
"a",
"member",
"of",
"the",
"EVENTS",
"Array"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/webhook.rb#L185-L190 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/webhook.rb | JSS.WebHook.rest_xml | def rest_xml
validate_before_save
doc = REXML::Document.new APIConnection::XML_HEADER
webhook = doc.add_element 'webhook'
webhook.add_element('name').text = @name
webhook.add_element('enabled').text = @enabled
webhook.add_element('url').text = @url
webhook.add_element('content_... | ruby | def rest_xml
validate_before_save
doc = REXML::Document.new APIConnection::XML_HEADER
webhook = doc.add_element 'webhook'
webhook.add_element('name').text = @name
webhook.add_element('enabled').text = @enabled
webhook.add_element('url').text = @url
webhook.add_element('content_... | [
"def",
"rest_xml",
"validate_before_save",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"APIConnection",
"::",
"XML_HEADER",
"webhook",
"=",
"doc",
".",
"add_element",
"'webhook'",
"webhook",
".",
"add_element",
"(",
"'name'",
")",
".",
"text",
"=",
"@na... | Return the REST XML for this webhook, with the current values,
for saving or updating | [
"Return",
"the",
"REST",
"XML",
"for",
"this",
"webhook",
"with",
"the",
"current",
"values",
"for",
"saving",
"or",
"updating"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/webhook.rb#L228-L238 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/computer_invitation.rb | JSS.ComputerInvitation.create | 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 = js... | ruby | 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 = js... | [
"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",
".",
... | Public Instance Methods
@see APIObject#initialize
Public Class Methods
Needed to support creation of new Computer Invitations to set their name.
@return [JSS::ComputerInvitation] | [
"Public",
"Instance",
"Methods"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/computer_invitation.rb#L172-L184 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/computer_invitation.rb | JSS.ComputerInvitation.rest_xml | def rest_xml
doc = REXML::Document.new APIConnection::XML_HEADER
obj = doc.add_element RSRC_OBJECT_KEY.to_s
obj.add_element('invitation_type').text = invitation_type
obj.add_element('create_account_if_does_not_exist').text = create_account_if_does_not_exist
if expiration_date_epoch
... | ruby | def rest_xml
doc = REXML::Document.new APIConnection::XML_HEADER
obj = doc.add_element RSRC_OBJECT_KEY.to_s
obj.add_element('invitation_type').text = invitation_type
obj.add_element('create_account_if_does_not_exist').text = create_account_if_does_not_exist
if expiration_date_epoch
... | [
"def",
"rest_xml",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"APIConnection",
"::",
"XML_HEADER",
"obj",
"=",
"doc",
".",
"add_element",
"RSRC_OBJECT_KEY",
".",
"to_s",
"obj",
".",
"add_element",
"(",
"'invitation_type'",
")",
".",
"text",
"=",
"inv... | Sets invitation expiration 4 hours after request. | [
"Sets",
"invitation",
"expiration",
"4",
"hours",
"after",
"request",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/computer_invitation.rb#L192-L206 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable/icon.rb | JSS.Icon.save | def save(path, overwrite = false)
path = Pathname.new path
path = path + @name if path.directory? && @name
raise JSS::AlreadyExistsError, "The file #{path} already exists" if path.exist? unless overwrite
path.delete if path.exist?
path.jss_save @data
end | ruby | def save(path, overwrite = false)
path = Pathname.new path
path = path + @name if path.directory? && @name
raise JSS::AlreadyExistsError, "The file #{path} already exists" if path.exist? unless overwrite
path.delete if path.exist?
path.jss_save @data
end | [
"def",
"save",
"(",
"path",
",",
"overwrite",
"=",
"false",
")",
"path",
"=",
"Pathname",
".",
"new",
"path",
"path",
"=",
"path",
"+",
"@name",
"if",
"path",
".",
"directory?",
"&&",
"@name",
"raise",
"JSS",
"::",
"AlreadyExistsError",
",",
"\"The file ... | Save the icon to a file.
@param path[Pathname, String] The path to which the file should be saved.
If the path given is an existing directory, the icon's current filename will
be used, if known.
@param overwrite[Boolean] Overwrite the file if it exists? Defaults to false
@return [void] | [
"Save",
"the",
"icon",
"to",
"a",
"file",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable/icon.rb#L177-L184 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/categorizable.rb | JSS.Categorizable.category= | def category=(new_cat)
return nil unless updatable? || creatable?
# unset the category? Use nil or an empty string
if NON_CATEGORIES.include? new_cat
unset_category
return
end
new_name, new_id = evaluate_new_category(new_cat)
# no change, go home.
return nil ... | ruby | def category=(new_cat)
return nil unless updatable? || creatable?
# unset the category? Use nil or an empty string
if NON_CATEGORIES.include? new_cat
unset_category
return
end
new_name, new_id = evaluate_new_category(new_cat)
# no change, go home.
return nil ... | [
"def",
"category",
"=",
"(",
"new_cat",
")",
"return",
"nil",
"unless",
"updatable?",
"||",
"creatable?",
"# unset the category? Use nil or an empty string",
"if",
"NON_CATEGORIES",
".",
"include?",
"new_cat",
"unset_category",
"return",
"end",
"new_name",
",",
"new_id"... | Change the category of this object.
Any of the NON_CATEGORIES values will
unset the category
@param new_cat[Integer, String] The new category
@return [void] | [
"Change",
"the",
"category",
"of",
"this",
"object",
".",
"Any",
"of",
"the",
"NON_CATEGORIES",
"values",
"will",
"unset",
"the",
"category"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/categorizable.rb#L132-L151 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/categorizable.rb | JSS.Categorizable.parse_category | def parse_category
cat =
if self.class::CATEGORY_SUBSET == :top
@init_data[:category]
else
@init_data[self.class::CATEGORY_SUBSET][:category]
end
if cat.is_a? String
@category_name = cat
@category_id = JSS::Category.category_id_from_name @category... | ruby | def parse_category
cat =
if self.class::CATEGORY_SUBSET == :top
@init_data[:category]
else
@init_data[self.class::CATEGORY_SUBSET][:category]
end
if cat.is_a? String
@category_name = cat
@category_id = JSS::Category.category_id_from_name @category... | [
"def",
"parse_category",
"cat",
"=",
"if",
"self",
".",
"class",
"::",
"CATEGORY_SUBSET",
"==",
":top",
"@init_data",
"[",
":category",
"]",
"else",
"@init_data",
"[",
"self",
".",
"class",
"::",
"CATEGORY_SUBSET",
"]",
"[",
":category",
"]",
"end",
"if",
... | Parse the category data from any incoming API data
@return [void] description_of_returned_object | [
"Parse",
"the",
"category",
"data",
"from",
"any",
"incoming",
"API",
"data"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/categorizable.rb#L191-L207 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/categorizable.rb | JSS.Categorizable.add_category_to_xml | def add_category_to_xml(xmldoc)
return if category_name.to_s.empty?
cat_elem = REXML::Element.new('category')
if self.class::CATEGORY_DATA_TYPE == String
cat_elem.text = @category_name.to_s
elsif self.class::CATEGORY_DATA_TYPE == Hash
cat_elem.add_element('name').text = @categor... | ruby | def add_category_to_xml(xmldoc)
return if category_name.to_s.empty?
cat_elem = REXML::Element.new('category')
if self.class::CATEGORY_DATA_TYPE == String
cat_elem.text = @category_name.to_s
elsif self.class::CATEGORY_DATA_TYPE == Hash
cat_elem.add_element('name').text = @categor... | [
"def",
"add_category_to_xml",
"(",
"xmldoc",
")",
"return",
"if",
"category_name",
".",
"to_s",
".",
"empty?",
"cat_elem",
"=",
"REXML",
"::",
"Element",
".",
"new",
"(",
"'category'",
")",
"if",
"self",
".",
"class",
"::",
"CATEGORY_DATA_TYPE",
"==",
"Strin... | Add the category to the XML for POSTing or PUTting to the API.
@param xmldoc[REXML::Document] The in-construction XML document
@return [void] | [
"Add",
"the",
"category",
"to",
"the",
"XML",
"for",
"POSTing",
"or",
"PUTting",
"to",
"the",
"API",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/categorizable.rb#L221-L243 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/scopable.rb | JSS.Scopable.scope= | def scope= (new_scope)
raise JSS::InvalidDataError, "JSS::Scopable::Scope instance required" unless new_criteria.kind_of?(JSS::Scopable::Scope)
raise JSS::InvalidDataError, "Scope object must have target_key of :#{self.class::SCOPE_TARGET_KEY}" unless self.class::SCOPE_TARGET_KEY == new_scope.target_key
... | ruby | def scope= (new_scope)
raise JSS::InvalidDataError, "JSS::Scopable::Scope instance required" unless new_criteria.kind_of?(JSS::Scopable::Scope)
raise JSS::InvalidDataError, "Scope object must have target_key of :#{self.class::SCOPE_TARGET_KEY}" unless self.class::SCOPE_TARGET_KEY == new_scope.target_key
... | [
"def",
"scope",
"=",
"(",
"new_scope",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"JSS::Scopable::Scope instance required\"",
"unless",
"new_criteria",
".",
"kind_of?",
"(",
"JSS",
"::",
"Scopable",
"::",
"Scope",
")",
"raise",
"JSS",
"::",
"InvalidData... | Change the scope
@param new_scope[JSS::Scopable::Scope] the new scope
@return [void] | [
"Change",
"the",
"scope"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/scopable.rb#L98-L103 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mdm.rb | JSS.MDM.erase_device | def erase_device(passcode = '', preserve_data_plan: false)
self.class.erase_device @id, passcode: passcode, preserve_data_plan: preserve_data_plan, api: @api
end | ruby | def erase_device(passcode = '', preserve_data_plan: false)
self.class.erase_device @id, passcode: passcode, preserve_data_plan: preserve_data_plan, api: @api
end | [
"def",
"erase_device",
"(",
"passcode",
"=",
"''",
",",
"preserve_data_plan",
":",
"false",
")",
"self",
".",
"class",
".",
"erase_device",
"@id",
",",
"passcode",
":",
"passcode",
",",
"preserve_data_plan",
":",
"preserve_data_plan",
",",
"api",
":",
"@api",
... | Send an erase device command to this object
@param passcode[String] a six-char passcode, required for computers & computergroups
@return (see .send_mdm_command) | [
"Send",
"an",
"erase",
"device",
"command",
"to",
"this",
"object"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mdm.rb#L1033-L1035 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mdm.rb | JSS.MDM.wallpaper | def wallpaper(wallpaper_setting: nil, wallpaper_content: nil, wallpaper_id: nil)
self.class.wallpaper(
@id,
wallpaper_setting: wallpaper_setting,
wallpaper_content: wallpaper_content,
wallpaper_id: wallpaper_id,
api: @api
)
end | ruby | def wallpaper(wallpaper_setting: nil, wallpaper_content: nil, wallpaper_id: nil)
self.class.wallpaper(
@id,
wallpaper_setting: wallpaper_setting,
wallpaper_content: wallpaper_content,
wallpaper_id: wallpaper_id,
api: @api
)
end | [
"def",
"wallpaper",
"(",
"wallpaper_setting",
":",
"nil",
",",
"wallpaper_content",
":",
"nil",
",",
"wallpaper_id",
":",
"nil",
")",
"self",
".",
"class",
".",
"wallpaper",
"(",
"@id",
",",
"wallpaper_setting",
":",
"wallpaper_setting",
",",
"wallpaper_content"... | Send a wallpaper command to this object
@param wallpaper_setting[Symbol] :lock_screen, :home_screen, or :lock_and_home_screen
@param wallpaper_content[String,Pathname] The local path to a .png or .jpg to use
as the walpaper image, required if no wallpaper_id
@param wallpaper_id[Symbol] The id of an Icon in Jam... | [
"Send",
"a",
"wallpaper",
"command",
"to",
"this",
"object"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mdm.rb#L1171-L1179 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mdm.rb | JSS.MDM.enable_lost_mode | def enable_lost_mode(
message: nil,
phone_number: nil,
footnote: nil,
enforce_lost_mode: true,
play_sound: false
)
self.class.enable_lost_mode(
@id,
message: message,
phone_number: phone_number,
footnote: footnote,
play_... | ruby | def enable_lost_mode(
message: nil,
phone_number: nil,
footnote: nil,
enforce_lost_mode: true,
play_sound: false
)
self.class.enable_lost_mode(
@id,
message: message,
phone_number: phone_number,
footnote: footnote,
play_... | [
"def",
"enable_lost_mode",
"(",
"message",
":",
"nil",
",",
"phone_number",
":",
"nil",
",",
"footnote",
":",
"nil",
",",
"enforce_lost_mode",
":",
"true",
",",
"play_sound",
":",
"false",
")",
"self",
".",
"class",
".",
"enable_lost_mode",
"(",
"@id",
","... | Send a enable_lost_mode command to one or more targets
Either or both of message and phone number must be provided
@param message[String] The message to display on the lock screen
@param phone_number[String] The phone number to display on the lock screen
@param footnote[String] Optional footnote to display on t... | [
"Send",
"a",
"enable_lost_mode",
"command",
"to",
"one",
"or",
"more",
"targets"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mdm.rb#L1260-L1276 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.frequency= | def frequency=(freq)
raise JSS::InvalidDataError, "New frequency must be one of :#{FREQUENCIES.keys.join ', :'}" unless FREQUENCIES.key?(freq)
@frequency = FREQUENCIES[freq]
@need_to_update = true
end | ruby | def frequency=(freq)
raise JSS::InvalidDataError, "New frequency must be one of :#{FREQUENCIES.keys.join ', :'}" unless FREQUENCIES.key?(freq)
@frequency = FREQUENCIES[freq]
@need_to_update = true
end | [
"def",
"frequency",
"=",
"(",
"freq",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"New frequency must be one of :#{FREQUENCIES.keys.join ', :'}\"",
"unless",
"FREQUENCIES",
".",
"key?",
"(",
"freq",
")",
"@frequency",
"=",
"FREQUENCIES",
"[",
"freq",
"]",
... | Set a new frequency for this policy.
@param freq[Symbol] the desired frequency, must be one of the keys of {FREQUENCIES}
@return [void] | [
"Set",
"a",
"new",
"frequency",
"for",
"this",
"policy",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L718-L722 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.target_drive= | def target_drive=(path_to_drive)
raise JSS::InvalidDataError, 'Path to target drive must be absolute' unless path_to_drive.to_s.start_with? '/'
@target_drive = path_to_drive.to_s
@need_to_update = true
end | ruby | def target_drive=(path_to_drive)
raise JSS::InvalidDataError, 'Path to target drive must be absolute' unless path_to_drive.to_s.start_with? '/'
@target_drive = path_to_drive.to_s
@need_to_update = true
end | [
"def",
"target_drive",
"=",
"(",
"path_to_drive",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Path to target drive must be absolute'",
"unless",
"path_to_drive",
".",
"to_s",
".",
"start_with?",
"'/'",
"@target_drive",
"=",
"path_to_drive",
".",
"to_s",
"@ne... | Set a new target drive for this policy.
@param path_to_drive[String,Pathname] the full path to the target drive, must start with a '/'
@return [void] | [
"Set",
"a",
"new",
"target",
"drive",
"for",
"this",
"policy",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L730-L734 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.offline= | def offline=(new_val)
raise JSS::InvalidDataError, 'New value must be boolean true or false' unless JSS::TRUE_FALSE.include? new_val
@offline = new_val
@need_to_update = true
end | ruby | def offline=(new_val)
raise JSS::InvalidDataError, 'New value must be boolean true or false' unless JSS::TRUE_FALSE.include? new_val
@offline = new_val
@need_to_update = true
end | [
"def",
"offline",
"=",
"(",
"new_val",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be boolean true or false'",
"unless",
"JSS",
"::",
"TRUE_FALSE",
".",
"include?",
"new_val",
"@offline",
"=",
"new_val",
"@need_to_update",
"=",
"true",
"end"... | Set whether this policy is available offline.
@param new_val[Boolean]
@return [void] | [
"Set",
"whether",
"this",
"policy",
"is",
"available",
"offline",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L742-L746 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.set_trigger_event | def set_trigger_event(type, new_val)
raise JSS::InvalidDataError, "Trigger type must be one of #{TRIGGER_EVENTS.keys.join(', ')}" unless TRIGGER_EVENTS.key?(type)
if type == :custom
raise JSS::InvalidDataError, 'Custom triggers must be Strings' unless new_val.is_a? String
else
raise JS... | ruby | def set_trigger_event(type, new_val)
raise JSS::InvalidDataError, "Trigger type must be one of #{TRIGGER_EVENTS.keys.join(', ')}" unless TRIGGER_EVENTS.key?(type)
if type == :custom
raise JSS::InvalidDataError, 'Custom triggers must be Strings' unless new_val.is_a? String
else
raise JS... | [
"def",
"set_trigger_event",
"(",
"type",
",",
"new_val",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"Trigger type must be one of #{TRIGGER_EVENTS.keys.join(', ')}\"",
"unless",
"TRIGGER_EVENTS",
".",
"key?",
"(",
"type",
")",
"if",
"type",
"==",
":custom",
... | Change a trigger event
@param type[Symbol] the type of trigger, one of the keys of {TRIGGER_EVENTS}
@param new_val[Boolean] whether the type of trigger is active or not.
@return [void] | [
"Change",
"a",
"trigger",
"event"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L756-L765 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.server_side_activation= | def server_side_activation=(activation)
raise JSS::InvalidDataError, 'Activation must be a Time' unless activation.is_a? Time
@server_side_limitations[:activation] = activation
@need_to_update = true
end | ruby | def server_side_activation=(activation)
raise JSS::InvalidDataError, 'Activation must be a Time' unless activation.is_a? Time
@server_side_limitations[:activation] = activation
@need_to_update = true
end | [
"def",
"server_side_activation",
"=",
"(",
"activation",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Activation must be a Time'",
"unless",
"activation",
".",
"is_a?",
"Time",
"@server_side_limitations",
"[",
":activation",
"]",
"=",
"activation",
"@need_to_up... | Set Server Side Activation
@param activation[Time] Activation date and time
@return [void] | [
"Set",
"Server",
"Side",
"Activation"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L773-L777 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.server_side_expiration= | def server_side_expiration=(expiration)
raise JSS::InvalidDataError, 'Expiration must be a Time' unless expiration.is_a? Time
@server_side_limitations[:expiration] = expiration
@need_to_update = true
end | ruby | def server_side_expiration=(expiration)
raise JSS::InvalidDataError, 'Expiration must be a Time' unless expiration.is_a? Time
@server_side_limitations[:expiration] = expiration
@need_to_update = true
end | [
"def",
"server_side_expiration",
"=",
"(",
"expiration",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Expiration must be a Time'",
"unless",
"expiration",
".",
"is_a?",
"Time",
"@server_side_limitations",
"[",
":expiration",
"]",
"=",
"expiration",
"@need_to_up... | Set Server Side Expiration
@param expiration[Time] Expiration date and time
@return [void] | [
"Set",
"Server",
"Side",
"Expiration"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L785-L789 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.user_logged_in= | def user_logged_in=(logged_in_option)
raise JSS::InvalidDataError, "user_logged_in options: #{USER_LOGGED_IN.join(', ')}" unless USER_LOGGED_IN.include? logged_in_option
@reboot_options[:user_logged_in] = logged_in_option
@need_to_update = true
end | ruby | def user_logged_in=(logged_in_option)
raise JSS::InvalidDataError, "user_logged_in options: #{USER_LOGGED_IN.join(', ')}" unless USER_LOGGED_IN.include? logged_in_option
@reboot_options[:user_logged_in] = logged_in_option
@need_to_update = true
end | [
"def",
"user_logged_in",
"=",
"(",
"logged_in_option",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"user_logged_in options: #{USER_LOGGED_IN.join(', ')}\"",
"unless",
"USER_LOGGED_IN",
".",
"include?",
"logged_in_option",
"@reboot_options",
"[",
":user_logged_in",
"... | What to do at reboot when there is a User Logged In
@param logged_in_option[String] Any one of the Strings from USER_LOGGED_IN
@return [void] | [
"What",
"to",
"do",
"at",
"reboot",
"when",
"there",
"is",
"a",
"User",
"Logged",
"In"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L879-L883 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.reboot_message= | def reboot_message=(message)
raise JSS::InvalidDataError, 'Reboot message must be a String' unless message.is_a? String
@reboot_options[:message] = message
@need_to_update = true
end | ruby | def reboot_message=(message)
raise JSS::InvalidDataError, 'Reboot message must be a String' unless message.is_a? String
@reboot_options[:message] = message
@need_to_update = true
end | [
"def",
"reboot_message",
"=",
"(",
"message",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Reboot message must be a String'",
"unless",
"message",
".",
"is_a?",
"String",
"@reboot_options",
"[",
":message",
"]",
"=",
"message",
"@need_to_update",
"=",
"true... | Set Reboot Message
@param reboot_message[String] Text of Reboot Message
@return [void] description of returned object | [
"Set",
"Reboot",
"Message"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L891-L895 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.startup_disk= | def startup_disk=(startup_disk_option)
raise JSS::InvalidDataError, "#{startup_disk_option} is not a valid Startup Disk" unless startup_disk_option.is_a? String
@reboot_options[:startup_disk] = 'Specify Local Startup Disk'
self.specify_startup = startup_disk_option
@need_to_update = true
end | ruby | def startup_disk=(startup_disk_option)
raise JSS::InvalidDataError, "#{startup_disk_option} is not a valid Startup Disk" unless startup_disk_option.is_a? String
@reboot_options[:startup_disk] = 'Specify Local Startup Disk'
self.specify_startup = startup_disk_option
@need_to_update = true
end | [
"def",
"startup_disk",
"=",
"(",
"startup_disk_option",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"#{startup_disk_option} is not a valid Startup Disk\"",
"unless",
"startup_disk_option",
".",
"is_a?",
"String",
"@reboot_options",
"[",
":startup_disk",
"]",
"=",
... | Set Startup Disk
Only Supports 'Specify Local Startup Disk' at the moment
@param startup_disk_option[String]
@return [void] | [
"Set",
"Startup",
"Disk",
"Only",
"Supports",
"Specify",
"Local",
"Startup",
"Disk",
"at",
"the",
"moment"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L905-L910 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.specify_startup= | def specify_startup=(startup_volume)
raise JSS::InvalidDataError, "#{startup_volume} is not a valid Startup Disk" unless startup_volume.is_a? String
@reboot_options[:specify_startup] = startup_volume
@need_to_update = true
end | ruby | def specify_startup=(startup_volume)
raise JSS::InvalidDataError, "#{startup_volume} is not a valid Startup Disk" unless startup_volume.is_a? String
@reboot_options[:specify_startup] = startup_volume
@need_to_update = true
end | [
"def",
"specify_startup",
"=",
"(",
"startup_volume",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"#{startup_volume} is not a valid Startup Disk\"",
"unless",
"startup_volume",
".",
"is_a?",
"String",
"@reboot_options",
"[",
":specify_startup",
"]",
"=",
"startu... | Specify Startup Volume
Only Supports "Specify Local Startup Disk"
@param startup_volume[String] a Volume to reboot to
@return [void] | [
"Specify",
"Startup",
"Volume",
"Only",
"Supports",
"Specify",
"Local",
"Startup",
"Disk"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L919-L923 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.minutes_until_reboot= | def minutes_until_reboot=(minutes)
raise JSS::InvalidDataError, 'Minutes until reboot must be an Integer' unless minutes.is_a? Integer
@reboot_options[:minutes_until_reboot] = minutes
@need_to_update = true
end | ruby | def minutes_until_reboot=(minutes)
raise JSS::InvalidDataError, 'Minutes until reboot must be an Integer' unless minutes.is_a? Integer
@reboot_options[:minutes_until_reboot] = minutes
@need_to_update = true
end | [
"def",
"minutes_until_reboot",
"=",
"(",
"minutes",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Minutes until reboot must be an Integer'",
"unless",
"minutes",
".",
"is_a?",
"Integer",
"@reboot_options",
"[",
":minutes_until_reboot",
"]",
"=",
"minutes",
"@nee... | Reboot Options
Minutes Until Reboot
@param minutes[String] The number of minutes to delay prior to reboot
@return [void] | [
"Reboot",
"Options",
"Minutes",
"Until",
"Reboot"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L944-L948 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.run_command= | def run_command=(command)
raise JSS::InvalidDataError, 'Command to run must be a String' unless command.is_a? String
@files_processes[:run_command] = command
@need_to_update = true
end | ruby | def run_command=(command)
raise JSS::InvalidDataError, 'Command to run must be a String' unless command.is_a? String
@files_processes[:run_command] = command
@need_to_update = true
end | [
"def",
"run_command",
"=",
"(",
"command",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Command to run must be a String'",
"unless",
"command",
".",
"is_a?",
"String",
"@files_processes",
"[",
":run_command",
"]",
"=",
"command",
"@need_to_update",
"=",
"tr... | Set the unix shell command to be run on the client
@param command[String] the unix shell command to be run on the client
@return [void] | [
"Set",
"the",
"unix",
"shell",
"command",
"to",
"be",
"run",
"on",
"the",
"client"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L978-L982 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.set_search_for_process | def set_search_for_process(process, kill = false)
@files_processes[:search_for_process] = process.to_s
@files_processes[:kill_process] = kill ? true : false
@need_to_update = true
end | ruby | def set_search_for_process(process, kill = false)
@files_processes[:search_for_process] = process.to_s
@files_processes[:kill_process] = kill ? true : false
@need_to_update = true
end | [
"def",
"set_search_for_process",
"(",
"process",
",",
"kill",
"=",
"false",
")",
"@files_processes",
"[",
":search_for_process",
"]",
"=",
"process",
".",
"to_s",
"@files_processes",
"[",
":kill_process",
"]",
"=",
"kill",
"?",
"true",
":",
"false",
"@need_to_up... | Set the process name to search for, and if it should be killed if found.
Setter methods (which end with =) can't easily take
multiple arguments, so we instead name them "set_blah_blah"
rather than "blah_blah="
@param process[String] the process name to search for
@param kill[Boolean] should be process be killed... | [
"Set",
"the",
"process",
"name",
"to",
"search",
"for",
"and",
"if",
"it",
"should",
"be",
"killed",
"if",
"found",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1026-L1030 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.set_search_by_path | def set_search_by_path(path, delete = false)
raise JSS::InvalidDataError, 'Path to search for must be a String or a Pathname' unless path.is_a?(String) || path.is_a?(Pathname)
@files_processes[:search_by_path] = path.to_s
@files_processes[:delete_file] = delete ? true : false
@need_to_update = t... | ruby | def set_search_by_path(path, delete = false)
raise JSS::InvalidDataError, 'Path to search for must be a String or a Pathname' unless path.is_a?(String) || path.is_a?(Pathname)
@files_processes[:search_by_path] = path.to_s
@files_processes[:delete_file] = delete ? true : false
@need_to_update = t... | [
"def",
"set_search_by_path",
"(",
"path",
",",
"delete",
"=",
"false",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Path to search for must be a String or a Pathname'",
"unless",
"path",
".",
"is_a?",
"(",
"String",
")",
"||",
"path",
".",
"is_a?",
"(",
... | Set the path to search for, a String or Pathname, and whether or not to delete it if found.
Setter methods (which end with =) can't easily take
multiple arguments, so we instead name them "set_blah_blah"
rather than "blah_blah="
@param path[String,Pathname] the path to search for
@param delete[Boolean] should t... | [
"Set",
"the",
"path",
"to",
"search",
"for",
"a",
"String",
"or",
"Pathname",
"and",
"whether",
"or",
"not",
"to",
"delete",
"it",
"if",
"found",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1057-L1062 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.spotlight_search= | def spotlight_search=(term)
raise JSS::InvalidDataError, 'Spotlight search term must be a String' unless term.is_a? String
@files_processes[:spotlight_search] = term
@need_to_update = true
end | ruby | def spotlight_search=(term)
raise JSS::InvalidDataError, 'Spotlight search term must be a String' unless term.is_a? String
@files_processes[:spotlight_search] = term
@need_to_update = true
end | [
"def",
"spotlight_search",
"=",
"(",
"term",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Spotlight search term must be a String'",
"unless",
"term",
".",
"is_a?",
"String",
"@files_processes",
"[",
":spotlight_search",
"]",
"=",
"term",
"@need_to_update",
"=... | Set the term to seach for using spotlight
@param term[String] the term to seach for using spotlight
@return [void] | [
"Set",
"the",
"term",
"to",
"seach",
"for",
"using",
"spotlight"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1076-L1080 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.locate_file= | def locate_file=(term)
raise JSS::InvalidDataError, 'Term to locate must be a String' unless term.is_a? String
@files_processes[:locate_file] = term
@need_to_update = true
end | ruby | def locate_file=(term)
raise JSS::InvalidDataError, 'Term to locate must be a String' unless term.is_a? String
@files_processes[:locate_file] = term
@need_to_update = true
end | [
"def",
"locate_file",
"=",
"(",
"term",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Term to locate must be a String'",
"unless",
"term",
".",
"is_a?",
"String",
"@files_processes",
"[",
":locate_file",
"]",
"=",
"term",
"@need_to_update",
"=",
"true",
"e... | Set the term to seach for using the locate command
@param term[String] the term to seach for using the locate command
@return [void] | [
"Set",
"the",
"term",
"to",
"seach",
"for",
"using",
"the",
"locate",
"command"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1094-L1098 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.add_package | def add_package(identifier, **opts)
id = validate_package_opts(identifier, opts)
return nil if @packages.map { |p| p[:id] }.include? id
name = JSS::Package.map_all_ids_to(:name, api: @api)[id]
pkg_data = {
id: id,
name: name,
action: PACKAGE_ACTIONS[opts[:action]],
... | ruby | def add_package(identifier, **opts)
id = validate_package_opts(identifier, opts)
return nil if @packages.map { |p| p[:id] }.include? id
name = JSS::Package.map_all_ids_to(:name, api: @api)[id]
pkg_data = {
id: id,
name: name,
action: PACKAGE_ACTIONS[opts[:action]],
... | [
"def",
"add_package",
"(",
"identifier",
",",
"**",
"opts",
")",
"id",
"=",
"validate_package_opts",
"(",
"identifier",
",",
"opts",
")",
"return",
"nil",
"if",
"@packages",
".",
"map",
"{",
"|",
"p",
"|",
"p",
"[",
":id",
"]",
"}",
".",
"include?",
... | Add a package to the list of pkgs handled by this policy.
If the pkg already exists in the policy, nil is returned and
no changes are made.
@param [String,Integer] identifier the name or id of the package to add to this policy
@param position [Symbol, Integer] where to add this pkg among the list of
pkgs. Zero... | [
"Add",
"a",
"package",
"to",
"the",
"list",
"of",
"pkgs",
"handled",
"by",
"this",
"policy",
".",
"If",
"the",
"pkg",
"already",
"exists",
"in",
"the",
"policy",
"nil",
"is",
"returned",
"and",
"no",
"changes",
"are",
"made",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1136-L1156 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.remove_package | def remove_package(identifier)
removed = @packages.delete_if { |p| p[:id] == identifier || p[:name] == identifier }
@need_to_update = true if removed
removed
end | ruby | def remove_package(identifier)
removed = @packages.delete_if { |p| p[:id] == identifier || p[:name] == identifier }
@need_to_update = true if removed
removed
end | [
"def",
"remove_package",
"(",
"identifier",
")",
"removed",
"=",
"@packages",
".",
"delete_if",
"{",
"|",
"p",
"|",
"p",
"[",
":id",
"]",
"==",
"identifier",
"||",
"p",
"[",
":name",
"]",
"==",
"identifier",
"}",
"@need_to_update",
"=",
"true",
"if",
"... | Remove a package from this policy by name or id
@param identfier [String,Integer] the name or id of the package to remove
@return [Array, nil] the new packages array or nil if no change | [
"Remove",
"a",
"package",
"from",
"this",
"policy",
"by",
"name",
"or",
"id"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1164-L1168 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.add_script | def add_script(identifier, **opts)
id = validate_script_opts(identifier, opts)
return nil if @scripts.map { |s| s[:id] }.include? id
name = JSS::Script.map_all_ids_to(:name, api: @api)[id]
script_data = {
id: id,
name: name,
priority: SCRIPT_PRIORITIES[opts[:priority]]... | ruby | def add_script(identifier, **opts)
id = validate_script_opts(identifier, opts)
return nil if @scripts.map { |s| s[:id] }.include? id
name = JSS::Script.map_all_ids_to(:name, api: @api)[id]
script_data = {
id: id,
name: name,
priority: SCRIPT_PRIORITIES[opts[:priority]]... | [
"def",
"add_script",
"(",
"identifier",
",",
"**",
"opts",
")",
"id",
"=",
"validate_script_opts",
"(",
"identifier",
",",
"opts",
")",
"return",
"nil",
"if",
"@scripts",
".",
"map",
"{",
"|",
"s",
"|",
"s",
"[",
":id",
"]",
"}",
".",
"include?",
"id... | Add a script to the list of SCRIPT_PRIORITIESipts run by this policy.
If the script already exists in the policy, nil is returned and
no changes are made.
@param [String,Integer] identifier the name or id of the script to add to this policy
@param [Hash] opts the options for this script
@option [Symbol, Integer... | [
"Add",
"a",
"script",
"to",
"the",
"list",
"of",
"SCRIPT_PRIORITIESipts",
"run",
"by",
"this",
"policy",
".",
"If",
"the",
"script",
"already",
"exists",
"in",
"the",
"policy",
"nil",
"is",
"returned",
"and",
"no",
"changes",
"are",
"made",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1221-L1246 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.remove_script | def remove_script(identifier)
removed = @scripts.delete_if { |s| s[:id] == identifier || s[:name] == identifier }
@need_to_update = true if removed
removed
end | ruby | def remove_script(identifier)
removed = @scripts.delete_if { |s| s[:id] == identifier || s[:name] == identifier }
@need_to_update = true if removed
removed
end | [
"def",
"remove_script",
"(",
"identifier",
")",
"removed",
"=",
"@scripts",
".",
"delete_if",
"{",
"|",
"s",
"|",
"s",
"[",
":id",
"]",
"==",
"identifier",
"||",
"s",
"[",
":name",
"]",
"==",
"identifier",
"}",
"@need_to_update",
"=",
"true",
"if",
"re... | Remove a script from this policy by name or id
@param identfier [String,Integer] the name or id of the script to remove
@return [Array, nil] the new scripts array or nil if no change | [
"Remove",
"a",
"script",
"from",
"this",
"policy",
"by",
"name",
"or",
"id"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1254-L1258 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.run | def run(show_output = false)
return nil unless enabled?
output = JSS::Client.run_jamf('policy', "-id #{id}", show_output)
return nil if output.include? 'No policies were found for the ID'
$CHILD_STATUS.exitstatus.zero? ? true : false
end | ruby | def run(show_output = false)
return nil unless enabled?
output = JSS::Client.run_jamf('policy', "-id #{id}", show_output)
return nil if output.include? 'No policies were found for the ID'
$CHILD_STATUS.exitstatus.zero? ? true : false
end | [
"def",
"run",
"(",
"show_output",
"=",
"false",
")",
"return",
"nil",
"unless",
"enabled?",
"output",
"=",
"JSS",
"::",
"Client",
".",
"run_jamf",
"(",
"'policy'",
",",
"\"-id #{id}\"",
",",
"show_output",
")",
"return",
"nil",
"if",
"output",
".",
"includ... | Actions
Try to execute this policy on this machine.
@param show_output[Boolean] should the stdout and stderr of the
'jamf policy' command be sent to stdout in realtime?
@return [Boolean, nil] The success of the 'jamf policy' command, or nil
if the policy couldn't be executed (out of scope, policy disabled, et... | [
"Actions",
"Try",
"to",
"execute",
"this",
"policy",
"on",
"this",
"machine",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1306-L1311 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.flush_logs | def flush_logs(older_than: 0, period: :days)
raise JSS::NoSuchItemError, "Policy doesn't exist in the JSS. Use #create first." unless @in_jss
unless LOG_FLUSH_INTERVAL_INTEGERS.key?(older_than)
raise JSS::InvalidDataError, "older_than must be one of these integers: #{LOG_FLUSH_INTERVAL_INTEGERS.key... | ruby | def flush_logs(older_than: 0, period: :days)
raise JSS::NoSuchItemError, "Policy doesn't exist in the JSS. Use #create first." unless @in_jss
unless LOG_FLUSH_INTERVAL_INTEGERS.key?(older_than)
raise JSS::InvalidDataError, "older_than must be one of these integers: #{LOG_FLUSH_INTERVAL_INTEGERS.key... | [
"def",
"flush_logs",
"(",
"older_than",
":",
"0",
",",
"period",
":",
":days",
")",
"raise",
"JSS",
"::",
"NoSuchItemError",
",",
"\"Policy doesn't exist in the JSS. Use #create first.\"",
"unless",
"@in_jss",
"unless",
"LOG_FLUSH_INTERVAL_INTEGERS",
".",
"key?",
"(",
... | Flush all policy logs for this policy older than
some number of days, weeks, months or years.
With no parameters, flushes all logs
NOTE: Currently the API doesn't have a way to
flush only failed policies.
@param older_than[Integer] 0, 1, 2, 3, or 6
@param period[Symbol] :days, :weeks, :months, or :years
@re... | [
"Flush",
"all",
"policy",
"logs",
"for",
"this",
"policy",
"older",
"than",
"some",
"number",
"of",
"days",
"weeks",
"months",
"or",
"years",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1328-L1342 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.validate_package_opts | def validate_package_opts(identifier, opts)
opts[:position] ||= -1
opts[:action] ||= :install
opts[:feu] ||= false
opts[:fut] ||= false
opts[:update_autorun] ||= false
opts[:position] =
case opts[:position]
when :start then 0
when :end then -1
else JS... | ruby | def validate_package_opts(identifier, opts)
opts[:position] ||= -1
opts[:action] ||= :install
opts[:feu] ||= false
opts[:fut] ||= false
opts[:update_autorun] ||= false
opts[:position] =
case opts[:position]
when :start then 0
when :end then -1
else JS... | [
"def",
"validate_package_opts",
"(",
"identifier",
",",
"opts",
")",
"opts",
"[",
":position",
"]",
"||=",
"-",
"1",
"opts",
"[",
":action",
"]",
"||=",
":install",
"opts",
"[",
":feu",
"]",
"||=",
"false",
"opts",
"[",
":fut",
"]",
"||=",
"false",
"op... | raise an error if a package being added isn't valid
@see #add_package
@return [Integer, nil] the valid id for the package | [
"raise",
"an",
"error",
"if",
"a",
"package",
"being",
"added",
"isn",
"t",
"valid"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1355-L1383 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/policy.rb | JSS.Policy.validate_script_opts | def validate_script_opts(identifier, opts)
opts[:position] ||= -1
opts[:priority] ||= :after
raise JSS::InvalidDataError, "priority must be one of: :#{SCRIPT_PRIORITIES.keys.join ', :'}" unless \
SCRIPT_PRIORITIES.include? opts[:priority]
opts[:position] =
case opts[:position]
... | ruby | def validate_script_opts(identifier, opts)
opts[:position] ||= -1
opts[:priority] ||= :after
raise JSS::InvalidDataError, "priority must be one of: :#{SCRIPT_PRIORITIES.keys.join ', :'}" unless \
SCRIPT_PRIORITIES.include? opts[:priority]
opts[:position] =
case opts[:position]
... | [
"def",
"validate_script_opts",
"(",
"identifier",
",",
"opts",
")",
"opts",
"[",
":position",
"]",
"||=",
"-",
"1",
"opts",
"[",
":priority",
"]",
"||=",
":after",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"priority must be one of: :#{SCRIPT_PRIORITIES.keys.j... | raise an error if a script being added isn't valid
@see #add_script
@return [Integer, nil] the valid id for the package | [
"raise",
"an",
"error",
"if",
"a",
"script",
"being",
"added",
"isn",
"t",
"valid"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/policy.rb#L1391-L1411 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/extension_attribute.rb | JSS.ExtensionAttribute.web_display= | def web_display=(new_val)
return nil if @web_display == new_val
raise JSS::InvalidDataError, "inventory_display must be a string, one of: #{INVENTORY_DISPLAY_CHOICES.join(', ')}" unless WEB_DISPLAY_CHOICES.include? new_val
@web_display = new_val
@need_to_update = true
end | ruby | def web_display=(new_val)
return nil if @web_display == new_val
raise JSS::InvalidDataError, "inventory_display must be a string, one of: #{INVENTORY_DISPLAY_CHOICES.join(', ')}" unless WEB_DISPLAY_CHOICES.include? new_val
@web_display = new_val
@need_to_update = true
end | [
"def",
"web_display",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"@web_display",
"==",
"new_val",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"inventory_display must be a string, one of: #{INVENTORY_DISPLAY_CHOICES.join(', ')}\"",
"unless",
"WEB_DISPLAY_CHOICES",
"... | Change the inventory_display of this EA
@param new_val[String] the new value, which must be a member of INVENTORY_DISPLAY_CHOICES
@return [void] | [
"Change",
"the",
"inventory_display",
"of",
"this",
"EA"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/extension_attribute.rb#L214-L219 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/extension_attribute.rb | JSS.ExtensionAttribute.input_type= | def input_type=(new_val)
return nil if @input_type == new_val
raise JSS::InvalidDataError, "input_type must be a string, one of: #{INPUT_TYPES.join(', ')}" unless INPUT_TYPES.include? new_val
@input_type = new_val
@popup_choices = nil if @input_type == 'Text Field'
@need_to_update = true
... | ruby | def input_type=(new_val)
return nil if @input_type == new_val
raise JSS::InvalidDataError, "input_type must be a string, one of: #{INPUT_TYPES.join(', ')}" unless INPUT_TYPES.include? new_val
@input_type = new_val
@popup_choices = nil if @input_type == 'Text Field'
@need_to_update = true
... | [
"def",
"input_type",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"@input_type",
"==",
"new_val",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"input_type must be a string, one of: #{INPUT_TYPES.join(', ')}\"",
"unless",
"INPUT_TYPES",
".",
"include?",
"new_val",
... | Change the input type of this EA
@param new_val[String] the new value, which must be a member of INPUT_TYPES
@return [void] | [
"Change",
"the",
"input",
"type",
"of",
"this",
"EA"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/extension_attribute.rb#L227-L233 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/extension_attribute.rb | JSS.ExtensionAttribute.popup_choices= | def popup_choices=(new_val)
return nil if @popup_choices == new_val
raise JSS::InvalidDataError, 'popup_choices must be an Array' unless new_val.is_a?(Array)
# convert each one to a String,
# and check that it matches the @data_type
new_val.map! do |v|
v = v.to_s.strip
cas... | ruby | def popup_choices=(new_val)
return nil if @popup_choices == new_val
raise JSS::InvalidDataError, 'popup_choices must be an Array' unless new_val.is_a?(Array)
# convert each one to a String,
# and check that it matches the @data_type
new_val.map! do |v|
v = v.to_s.strip
cas... | [
"def",
"popup_choices",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"@popup_choices",
"==",
"new_val",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'popup_choices must be an Array'",
"unless",
"new_val",
".",
"is_a?",
"(",
"Array",
")",
"# convert each one t... | Change the Popup Choices of this EA
New value must be an Array, the items will be converted to Strings.
This automatically sets input_type to "Pop-up Menu"
Values are checked to ensure they match the @data_type
Note, Dates must be in the format "YYYY-MM-DD hh:mm:ss"
@param new_val[Array<#to_s>] the new values
... | [
"Change",
"the",
"Popup",
"Choices",
"of",
"this",
"EA",
"New",
"value",
"must",
"be",
"an",
"Array",
"the",
"items",
"will",
"be",
"converted",
"to",
"Strings",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/extension_attribute.rb#L247-L266 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/extension_attribute.rb | JSS.ExtensionAttribute.all_with_result | def all_with_result(search_type, desired_value)
raise JSS::NoSuchItemError, "EA Not In JSS! Use #create to create this #{self.class::RSRC_OBJECT_KEY}." unless @in_jss
raise JSS::InvalidDataError, 'Invalid search_type, see JSS::Criteriable::Criterion::SEARCH_TYPES' unless JSS::Criteriable::Criterion::SEARCH_... | ruby | def all_with_result(search_type, desired_value)
raise JSS::NoSuchItemError, "EA Not In JSS! Use #create to create this #{self.class::RSRC_OBJECT_KEY}." unless @in_jss
raise JSS::InvalidDataError, 'Invalid search_type, see JSS::Criteriable::Criterion::SEARCH_TYPES' unless JSS::Criteriable::Criterion::SEARCH_... | [
"def",
"all_with_result",
"(",
"search_type",
",",
"desired_value",
")",
"raise",
"JSS",
"::",
"NoSuchItemError",
",",
"\"EA Not In JSS! Use #create to create this #{self.class::RSRC_OBJECT_KEY}.\"",
"unless",
"@in_jss",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'Invali... | Get an Array of Hashes for all inventory objects
with a desired result in their latest report for this EA.
Each Hash is one inventory object (computer, mobile device, user), with these keys:
:id - the computer id
:name - the computer name
:value - the matching ext attr value for the objects latest report.
... | [
"Get",
"an",
"Array",
"of",
"Hashes",
"for",
"all",
"inventory",
"objects",
"with",
"a",
"desired",
"result",
"in",
"their",
"latest",
"report",
"for",
"this",
"EA",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/extension_attribute.rb#L288-L314 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/extension_attribute.rb | JSS.ExtensionAttribute.rest_rexml | def rest_rexml
ea = REXML::Element.new self.class::RSRC_OBJECT_KEY.to_s
ea.add_element('name').text = @name
ea.add_element('description').text = @description
ea.add_element('data_type').text = @data_type
ea.add_element('inventory_display').text = @web_display
it = ea.add_element('in... | ruby | def rest_rexml
ea = REXML::Element.new self.class::RSRC_OBJECT_KEY.to_s
ea.add_element('name').text = @name
ea.add_element('description').text = @description
ea.add_element('data_type').text = @data_type
ea.add_element('inventory_display').text = @web_display
it = ea.add_element('in... | [
"def",
"rest_rexml",
"ea",
"=",
"REXML",
"::",
"Element",
".",
"new",
"self",
".",
"class",
"::",
"RSRC_OBJECT_KEY",
".",
"to_s",
"ea",
".",
"add_element",
"(",
"'name'",
")",
".",
"text",
"=",
"@name",
"ea",
".",
"add_element",
"(",
"'description'",
")"... | Return a REXML object for this ext attr, with the current values.
Subclasses should augment this in their rest_xml methods
then return it .to_s, for saving or updating | [
"Return",
"a",
"REXML",
"object",
"for",
"this",
"ext",
"attr",
"with",
"the",
"current",
"values",
".",
"Subclasses",
"should",
"augment",
"this",
"in",
"their",
"rest_xml",
"methods",
"then",
"return",
"it",
".",
"to_s",
"for",
"saving",
"or",
"updating"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/extension_attribute.rb#L394-L408 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/extension_attribute/computer_extension_attribute.rb | JSS.ComputerExtensionAttribute.recon_display= | def recon_display= (new_val)
return nil if @recon_display == new_val
raise JSS::InvalidDataError, "recon_display must be a string, one of: #{RECON_DISPLAY_CHOICES.join(", ")}" unless RECON_DISPLAY_CHOICES.include? new_val
@recon_display = new_val
@need_to_update = true
end | ruby | def recon_display= (new_val)
return nil if @recon_display == new_val
raise JSS::InvalidDataError, "recon_display must be a string, one of: #{RECON_DISPLAY_CHOICES.join(", ")}" unless RECON_DISPLAY_CHOICES.include? new_val
@recon_display = new_val
@need_to_update = true
end | [
"def",
"recon_display",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"@recon_display",
"==",
"new_val",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"recon_display must be a string, one of: #{RECON_DISPLAY_CHOICES.join(\", \")}\"",
"unless",
"RECON_DISPLAY_CHOICES",
"... | Change the recon_display of this EA | [
"Change",
"the",
"recon_display",
"of",
"this",
"EA"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/extension_attribute/computer_extension_attribute.rb#L180-L185 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/patch_source/patch_external_source.rb | JSS.PatchExternalSource.validate_host_port | def validate_host_port(action)
raise JSS::UnsupportedError, "Cannot #{action} without first setting a host_name and port" if host_name.to_s.empty? || port.to_s.empty?
end | ruby | def validate_host_port(action)
raise JSS::UnsupportedError, "Cannot #{action} without first setting a host_name and port" if host_name.to_s.empty? || port.to_s.empty?
end | [
"def",
"validate_host_port",
"(",
"action",
")",
"raise",
"JSS",
"::",
"UnsupportedError",
",",
"\"Cannot #{action} without first setting a host_name and port\"",
"if",
"host_name",
".",
"to_s",
".",
"empty?",
"||",
"port",
".",
"to_s",
".",
"empty?",
"end"
] | raise an exeption if needed when trying to do something that needs
a host and port set
@param action[String] The action that needs a host and port
@return [void] | [
"raise",
"an",
"exeption",
"if",
"needed",
"when",
"trying",
"to",
"do",
"something",
"that",
"needs",
"a",
"host",
"and",
"port",
"set"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/patch_source/patch_external_source.rb#L139-L141 | train |
PixarAnimationStudios/ruby-jss | lib/jss/db_connection.rb | JSS.DBConnection.valid_server? | def valid_server?(server, port = DFT_PORT)
mysql = Mysql.init
mysql.options Mysql::OPT_CONNECT_TIMEOUT, 5
begin
# this connection should get an access denied error if there is
# a mysql server there. I'm assuming no one will use this username
# and pw for anything real
... | ruby | def valid_server?(server, port = DFT_PORT)
mysql = Mysql.init
mysql.options Mysql::OPT_CONNECT_TIMEOUT, 5
begin
# this connection should get an access denied error if there is
# a mysql server there. I'm assuming no one will use this username
# and pw for anything real
... | [
"def",
"valid_server?",
"(",
"server",
",",
"port",
"=",
"DFT_PORT",
")",
"mysql",
"=",
"Mysql",
".",
"init",
"mysql",
".",
"options",
"Mysql",
"::",
"OPT_CONNECT_TIMEOUT",
",",
"5",
"begin",
"# this connection should get an access denied error if there is",
"# a mysq... | disconnect
Test that a given hostname is a MySQL server
@param server[String] The hostname to test
@return [Boolean] does the server host a MySQL server? | [
"disconnect",
"Test",
"that",
"a",
"given",
"hostname",
"is",
"a",
"MySQL",
"server"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/db_connection.rb#L240-L256 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.add_self_service_category | def add_self_service_category(new_cat, display_in: true, feature_in: false)
new_cat = JSS::Category.map_all_ids_to(:name, api: @api)[new_cat] if new_cat.is_a? Integer
feature_in = false if display_in == false
raise JSS::NoSuchItemError, "No category '#{new_cat}' in the JSS" unless JSS::Category.all_na... | ruby | def add_self_service_category(new_cat, display_in: true, feature_in: false)
new_cat = JSS::Category.map_all_ids_to(:name, api: @api)[new_cat] if new_cat.is_a? Integer
feature_in = false if display_in == false
raise JSS::NoSuchItemError, "No category '#{new_cat}' in the JSS" unless JSS::Category.all_na... | [
"def",
"add_self_service_category",
"(",
"new_cat",
",",
"display_in",
":",
"true",
",",
"feature_in",
":",
"false",
")",
"new_cat",
"=",
"JSS",
"::",
"Category",
".",
"map_all_ids_to",
"(",
":name",
",",
"api",
":",
"@api",
")",
"[",
"new_cat",
"]",
"if",... | Add or change one of the categories for this item in self service
@param new_cat[String, Integer] the name or id of a category where this
object should appear in SelfSvc
@param display_in[Boolean] should this item appear in the SelfSvc page for
the category? Only meaningful in applicable classes
@param featu... | [
"Add",
"or",
"change",
"one",
"of",
"the",
"categories",
"for",
"this",
"item",
"in",
"self",
"service"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L431-L454 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.self_service_user_removable= | def self_service_user_removable=(new_val, pw = @self_service_removal_password)
new_val, pw = *new_val if new_val.is_a? Array
pw = nil unless new_val == :with_auth
return if new_val == self_service_user_removable && pw == self_service_removal_password
validate_user_removable new_val
@sel... | ruby | def self_service_user_removable=(new_val, pw = @self_service_removal_password)
new_val, pw = *new_val if new_val.is_a? Array
pw = nil unless new_val == :with_auth
return if new_val == self_service_user_removable && pw == self_service_removal_password
validate_user_removable new_val
@sel... | [
"def",
"self_service_user_removable",
"=",
"(",
"new_val",
",",
"pw",
"=",
"@self_service_removal_password",
")",
"new_val",
",",
"pw",
"=",
"new_val",
"if",
"new_val",
".",
"is_a?",
"Array",
"pw",
"=",
"nil",
"unless",
"new_val",
"==",
":with_auth",
"return",
... | Set the value for user-removability of profiles, optionally
providing a password for removal, on iOS targets.
@param new_val[Symbol] One of the keys of PROFILE_REMOVAL_BY_USER,
:always, :never, or :with_auth
@param pw[String] A new password to use if removable :with_auth
@return [void] | [
"Set",
"the",
"value",
"for",
"user",
"-",
"removability",
"of",
"profiles",
"optionally",
"providing",
"a",
"password",
"for",
"removal",
"on",
"iOS",
"targets",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L479-L490 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.self_service_notification_type= | def self_service_notification_type=(type)
validate_notifications_supported
# HACK: Until jamf fixes bugs, you can only set notifications
# :off or :ssvc_only. If you want :ssvc_and_nctr, you must
# check the checkbox in the web-UI.
if @self_service_data_config[:notifications_supported] ==... | ruby | def self_service_notification_type=(type)
validate_notifications_supported
# HACK: Until jamf fixes bugs, you can only set notifications
# :off or :ssvc_only. If you want :ssvc_and_nctr, you must
# check the checkbox in the web-UI.
if @self_service_data_config[:notifications_supported] ==... | [
"def",
"self_service_notification_type",
"=",
"(",
"type",
")",
"validate_notifications_supported",
"# HACK: Until jamf fixes bugs, you can only set notifications",
"# :off or :ssvc_only. If you want :ssvc_and_nctr, you must",
"# check the checkbox in the web-UI.",
"if",
"@self_service_data_co... | How should self service notifications be displayed
@param type[Symbol] A key from SelfServable::NOTIFICATION_TYPES
@return [void] | [
"How",
"should",
"self",
"service",
"notifications",
"be",
"displayed"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L512-L526 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.self_service_reminder_frequency= | def self_service_reminder_frequency=(days)
return if days == self_service_reminder_frequency
validate_notification_reminders_supported
JSS::Validate.integer days
@self_service_reminder_frequency = days
@need_to_update = true
end | ruby | def self_service_reminder_frequency=(days)
return if days == self_service_reminder_frequency
validate_notification_reminders_supported
JSS::Validate.integer days
@self_service_reminder_frequency = days
@need_to_update = true
end | [
"def",
"self_service_reminder_frequency",
"=",
"(",
"days",
")",
"return",
"if",
"days",
"==",
"self_service_reminder_frequency",
"validate_notification_reminders_supported",
"JSS",
"::",
"Validate",
".",
"integer",
"days",
"@self_service_reminder_frequency",
"=",
"days",
"... | set reminder notification frequency
@param new_val[Integer] How many days between reminder notifications?
@return [void] | [
"set",
"reminder",
"notification",
"frequency"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L572-L578 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.icon= | def icon=(new_icon)
if new_icon.is_a? Integer
return if @icon && new_icon == @icon.id
validate_icon new_icon
@new_icon_id = new_icon
@need_to_update = true
else
unless uploadable? && defined?(self.class::UPLOAD_TYPES) && self.class::UPLOAD_TYPES.key?(:icon)
... | ruby | def icon=(new_icon)
if new_icon.is_a? Integer
return if @icon && new_icon == @icon.id
validate_icon new_icon
@new_icon_id = new_icon
@need_to_update = true
else
unless uploadable? && defined?(self.class::UPLOAD_TYPES) && self.class::UPLOAD_TYPES.key?(:icon)
... | [
"def",
"icon",
"=",
"(",
"new_icon",
")",
"if",
"new_icon",
".",
"is_a?",
"Integer",
"return",
"if",
"@icon",
"&&",
"new_icon",
"==",
"@icon",
".",
"id",
"validate_icon",
"new_icon",
"@new_icon_id",
"=",
"new_icon",
"@need_to_update",
"=",
"true",
"else",
"u... | Set a new Self Service icon for this object.
Since JSS::Icon objects are read-only,
the icon can only be changed by supplying the id number
of an icon already existing in the JSS, or a path to
a local file, which will be uploaded to the JSS and added
to this instance. Uploads
take effect immediately, but if an ... | [
"Set",
"a",
"new",
"Self",
"Service",
"icon",
"for",
"this",
"object",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L594-L609 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.parse_self_service_notifications | def parse_self_service_notifications(ss_data)
return unless @self_service_data_config[:notifications_supported]
# oldstyle/broken, we need the XML to know if notifications are turned on
if @self_service_data_config[:notifications_supported] == :ssvc_only && @in_jss
ssrsrc = "#{rest_rsrc}/subs... | ruby | def parse_self_service_notifications(ss_data)
return unless @self_service_data_config[:notifications_supported]
# oldstyle/broken, we need the XML to know if notifications are turned on
if @self_service_data_config[:notifications_supported] == :ssvc_only && @in_jss
ssrsrc = "#{rest_rsrc}/subs... | [
"def",
"parse_self_service_notifications",
"(",
"ss_data",
")",
"return",
"unless",
"@self_service_data_config",
"[",
":notifications_supported",
"]",
"# oldstyle/broken, we need the XML to know if notifications are turned on",
"if",
"@self_service_data_config",
"[",
":notifications_su... | parse incoming ssvc notification settings | [
"parse",
"incoming",
"ssvc",
"notification",
"settings"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L760-L788 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.add_self_service_xml | def add_self_service_xml(xdoc)
doc_root = xdoc.root
# whether or not we're in self service is usually not in the
# ssvc subset...
add_in_self_service_xml doc_root
subset_key = @self_service_data_config[:self_service_subset] ? @self_service_data_config[:self_service_subset] : :self_servic... | ruby | def add_self_service_xml(xdoc)
doc_root = xdoc.root
# whether or not we're in self service is usually not in the
# ssvc subset...
add_in_self_service_xml doc_root
subset_key = @self_service_data_config[:self_service_subset] ? @self_service_data_config[:self_service_subset] : :self_servic... | [
"def",
"add_self_service_xml",
"(",
"xdoc",
")",
"doc_root",
"=",
"xdoc",
".",
"root",
"# whether or not we're in self service is usually not in the",
"# ssvc subset...",
"add_in_self_service_xml",
"doc_root",
"subset_key",
"=",
"@self_service_data_config",
"[",
":self_service_su... | refresh icon
Add approriate XML for self service data to the XML document for this
item.
@param xdoc[REXML::Document] The XML Document to which we're adding Self
Service data
@return [void] | [
"refresh",
"icon",
"Add",
"approriate",
"XML",
"for",
"self",
"service",
"data",
"to",
"the",
"XML",
"document",
"for",
"this",
"item",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L814-L840 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.add_in_self_service_xml | def add_in_self_service_xml(doc_root)
return unless @self_service_data_config[:in_self_service_data_path]
in_ss_section, in_ss_elem = @self_service_data_config[:in_self_service_data_path]
in_ss_value = @in_self_service ? @self_service_data_config[:in_self_service] : @self_service_data_config[:not_in... | ruby | def add_in_self_service_xml(doc_root)
return unless @self_service_data_config[:in_self_service_data_path]
in_ss_section, in_ss_elem = @self_service_data_config[:in_self_service_data_path]
in_ss_value = @in_self_service ? @self_service_data_config[:in_self_service] : @self_service_data_config[:not_in... | [
"def",
"add_in_self_service_xml",
"(",
"doc_root",
")",
"return",
"unless",
"@self_service_data_config",
"[",
":in_self_service_data_path",
"]",
"in_ss_section",
",",
"in_ss_elem",
"=",
"@self_service_data_config",
"[",
":in_self_service_data_path",
"]",
"in_ss_value",
"=",
... | add_self_service_xml
add the correct XML indicating whether or not we're even in SSvc | [
"add_self_service_xml",
"add",
"the",
"correct",
"XML",
"indicating",
"whether",
"or",
"not",
"we",
"re",
"even",
"in",
"SSvc"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L843-L853 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.add_self_service_profile_xml | def add_self_service_profile_xml(ssvc, doc_root)
return unless self_service_payload == :profile
if self_service_targets.include? :ios
sec = ssvc.add_element('security')
sec.add_element('removal_disallowed').text = PROFILE_REMOVAL_BY_USER[@self_service_user_removable]
sec.add_element(... | ruby | def add_self_service_profile_xml(ssvc, doc_root)
return unless self_service_payload == :profile
if self_service_targets.include? :ios
sec = ssvc.add_element('security')
sec.add_element('removal_disallowed').text = PROFILE_REMOVAL_BY_USER[@self_service_user_removable]
sec.add_element(... | [
"def",
"add_self_service_profile_xml",
"(",
"ssvc",
",",
"doc_root",
")",
"return",
"unless",
"self_service_payload",
"==",
":profile",
"if",
"self_service_targets",
".",
"include?",
":ios",
"sec",
"=",
"ssvc",
".",
"add_element",
"(",
"'security'",
")",
"sec",
".... | add the xml specific to profiles | [
"add",
"the",
"xml",
"specific",
"to",
"profiles"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L856-L866 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.add_self_service_category_xml | def add_self_service_category_xml(ssvc)
cats = ssvc.add_element('self_service_categories')
return if self_service_categories.empty?
self_service_categories.each do |cat|
catelem = cats.add_element('category')
catelem.add_element('name').text = cat[:name]
catelem.add_element('di... | ruby | def add_self_service_category_xml(ssvc)
cats = ssvc.add_element('self_service_categories')
return if self_service_categories.empty?
self_service_categories.each do |cat|
catelem = cats.add_element('category')
catelem.add_element('name').text = cat[:name]
catelem.add_element('di... | [
"def",
"add_self_service_category_xml",
"(",
"ssvc",
")",
"cats",
"=",
"ssvc",
".",
"add_element",
"(",
"'self_service_categories'",
")",
"return",
"if",
"self_service_categories",
".",
"empty?",
"self_service_categories",
".",
"each",
"do",
"|",
"cat",
"|",
"catele... | add the xml for self-service categories | [
"add",
"the",
"xml",
"for",
"self",
"-",
"service",
"categories"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L869-L878 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.add_self_service_macos_xml | def add_self_service_macos_xml(ssvc)
return unless self_service_targets.include? :macos
ssvc.add_element('self_service_display_name').text = self_service_display_name if self_service_display_name
ssvc.add_element('install_button_text').text = self_service_install_button_text if self_service_install_bu... | ruby | def add_self_service_macos_xml(ssvc)
return unless self_service_targets.include? :macos
ssvc.add_element('self_service_display_name').text = self_service_display_name if self_service_display_name
ssvc.add_element('install_button_text').text = self_service_install_button_text if self_service_install_bu... | [
"def",
"add_self_service_macos_xml",
"(",
"ssvc",
")",
"return",
"unless",
"self_service_targets",
".",
"include?",
":macos",
"ssvc",
".",
"add_element",
"(",
"'self_service_display_name'",
")",
".",
"text",
"=",
"self_service_display_name",
"if",
"self_service_display_na... | set macOS settings in ssvc xml | [
"set",
"macOS",
"settings",
"in",
"ssvc",
"xml"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L881-L887 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.add_self_service_notification_xml | def add_self_service_notification_xml(ssvc)
return unless @self_service_data_config[:notifications_supported]
# oldstyle/broken, only sscv notifs
if @self_service_data_config[:notifications_supported] == :ssvc_only
ssvc.add_element('notification').text = self_service_notifications_enabled.to_... | ruby | def add_self_service_notification_xml(ssvc)
return unless @self_service_data_config[:notifications_supported]
# oldstyle/broken, only sscv notifs
if @self_service_data_config[:notifications_supported] == :ssvc_only
ssvc.add_element('notification').text = self_service_notifications_enabled.to_... | [
"def",
"add_self_service_notification_xml",
"(",
"ssvc",
")",
"return",
"unless",
"@self_service_data_config",
"[",
":notifications_supported",
"]",
"# oldstyle/broken, only sscv notifs",
"if",
"@self_service_data_config",
"[",
":notifications_supported",
"]",
"==",
":ssvc_only",... | set ssvc notification settings in xml | [
"set",
"ssvc",
"notification",
"settings",
"in",
"xml"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L891-L915 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.validate_user_removable | def validate_user_removable(new_val)
raise JSS::UnsupportedError, 'User removal settings not applicable to this class' unless self_service_payload == :profile
raise JSS::UnsupportedError, 'Removal :with_auth not applicable to this class' if new_val == :with_auth && !self_service_targets.include?(:ios)
... | ruby | def validate_user_removable(new_val)
raise JSS::UnsupportedError, 'User removal settings not applicable to this class' unless self_service_payload == :profile
raise JSS::UnsupportedError, 'Removal :with_auth not applicable to this class' if new_val == :with_auth && !self_service_targets.include?(:ios)
... | [
"def",
"validate_user_removable",
"(",
"new_val",
")",
"raise",
"JSS",
"::",
"UnsupportedError",
",",
"'User removal settings not applicable to this class'",
"unless",
"self_service_payload",
"==",
":profile",
"raise",
"JSS",
"::",
"UnsupportedError",
",",
"'Removal :with_aut... | Raise an error if user_removable settings are wrong | [
"Raise",
"an",
"error",
"if",
"user_removable",
"settings",
"are",
"wrong"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L918-L924 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/self_servable.rb | JSS.SelfServable.validate_icon | def validate_icon(id)
return nil unless JSS::DB_CNX.connected?
raise JSS::NoSuchItemError, "No icon with id #{id}" unless JSS::Icon.all_ids.include? id
end | ruby | def validate_icon(id)
return nil unless JSS::DB_CNX.connected?
raise JSS::NoSuchItemError, "No icon with id #{id}" unless JSS::Icon.all_ids.include? id
end | [
"def",
"validate_icon",
"(",
"id",
")",
"return",
"nil",
"unless",
"JSS",
"::",
"DB_CNX",
".",
"connected?",
"raise",
"JSS",
"::",
"NoSuchItemError",
",",
"\"No icon with id #{id}\"",
"unless",
"JSS",
"::",
"Icon",
".",
"all_ids",
".",
"include?",
"id",
"end"
... | Raise an error if an icon id is not valid | [
"Raise",
"an",
"error",
"if",
"an",
"icon",
"id",
"is",
"not",
"valid"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/self_servable.rb#L927-L930 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/advanced_search.rb | JSS.AdvancedSearch.update | def update(get_results = false)
orig_timeout = @api.cnx.options[:timeout]
@api.timeout = 1800
super()
requery_search_results if get_results
@api.timeout = orig_timeout
@id # remember to return the id
end | ruby | def update(get_results = false)
orig_timeout = @api.cnx.options[:timeout]
@api.timeout = 1800
super()
requery_search_results if get_results
@api.timeout = orig_timeout
@id # remember to return the id
end | [
"def",
"update",
"(",
"get_results",
"=",
"false",
")",
"orig_timeout",
"=",
"@api",
".",
"cnx",
".",
"options",
"[",
":timeout",
"]",
"@api",
".",
"timeout",
"=",
"1800",
"super",
"(",
")",
"requery_search_results",
"if",
"get_results",
"@api",
".",
"time... | Save any changes
If get_results is true, they'll be available in {#search_results}. This might be slow.
@param get_results[Boolean] should the results of the search be queried immediately?
@return [Integer] the id of the updated search | [
"Save",
"any",
"changes"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/advanced_search.rb#L191-L199 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/advanced_search.rb | JSS.AdvancedSearch.requery_search_results | def requery_search_results
orig_open_timeout = @api.cnx.options[:open_timeout]
orig_timeout = @api.cnx.options[:timeout]
@api.timeout = 1800
@api.open_timeout = 1800
begin
requery = self.class.fetch(id: @id)
@search_results = requery.search_results
@result_display_k... | ruby | def requery_search_results
orig_open_timeout = @api.cnx.options[:open_timeout]
orig_timeout = @api.cnx.options[:timeout]
@api.timeout = 1800
@api.open_timeout = 1800
begin
requery = self.class.fetch(id: @id)
@search_results = requery.search_results
@result_display_k... | [
"def",
"requery_search_results",
"orig_open_timeout",
"=",
"@api",
".",
"cnx",
".",
"options",
"[",
":open_timeout",
"]",
"orig_timeout",
"=",
"@api",
".",
"cnx",
".",
"options",
"[",
":timeout",
"]",
"@api",
".",
"timeout",
"=",
"1800",
"@api",
".",
"open_t... | Requery the API for the search results.
This can be very slow, so temporarily reset the API timeout to 30 minutes
@return [Array<Hash>] the new search results | [
"Requery",
"the",
"API",
"for",
"the",
"search",
"results",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/advanced_search.rb#L207-L220 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/advanced_search.rb | JSS.AdvancedSearch.display_fields= | def display_fields=(new_val)
raise JSS::InvalidDataError, 'display_fields must be an Array.' unless new_val.is_a? Array
return if new_val.sort == @display_fields.sort
@display_fields = new_val
@need_to_update = true
end | ruby | def display_fields=(new_val)
raise JSS::InvalidDataError, 'display_fields must be an Array.' unless new_val.is_a? Array
return if new_val.sort == @display_fields.sort
@display_fields = new_val
@need_to_update = true
end | [
"def",
"display_fields",
"=",
"(",
"new_val",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'display_fields must be an Array.'",
"unless",
"new_val",
".",
"is_a?",
"Array",
"return",
"if",
"new_val",
".",
"sort",
"==",
"@display_fields",
".",
"sort",
"@disp... | Set the list of fields to be retrieved with the
search results.
@param new_val[Array<String>] the new field names | [
"Set",
"the",
"list",
"of",
"fields",
"to",
"be",
"retrieved",
"with",
"the",
"search",
"results",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/advanced_search.rb#L244-L249 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/advanced_search.rb | JSS.AdvancedSearch.export | def export(output_file, format = :csv, overwrite = false)
raise JSS::InvalidDataError, "Export format must be one of: :#{EXPORT_FORMATS.join ', :'}" unless EXPORT_FORMATS.include? format
out = Pathname.new output_file
unless overwrite
raise JSS::AlreadyExistsError, "The output file already e... | ruby | def export(output_file, format = :csv, overwrite = false)
raise JSS::InvalidDataError, "Export format must be one of: :#{EXPORT_FORMATS.join ', :'}" unless EXPORT_FORMATS.include? format
out = Pathname.new output_file
unless overwrite
raise JSS::AlreadyExistsError, "The output file already e... | [
"def",
"export",
"(",
"output_file",
",",
"format",
"=",
":csv",
",",
"overwrite",
"=",
"false",
")",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"\"Export format must be one of: :#{EXPORT_FORMATS.join ', :'}\"",
"unless",
"EXPORT_FORMATS",
".",
"include?",
"format",... | Export the display fields of the search results to a file.
@param output_file[String,Pathname] The file in which to store the exported results
@param format[Symbol] one of :csv, :tab, or :xml, defaults to :csv
@param overwrite[Boolean] should the output_file be overwrite if it exists? Defaults to false
@return ... | [
"Export",
"the",
"display",
"fields",
"of",
"the",
"search",
"results",
"to",
"a",
"file",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/advanced_search.rb#L272-L311 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/advanced_search.rb | JSS.AdvancedSearch.rest_xml | def rest_xml
doc = REXML::Document.new APIConnection::XML_HEADER
acs = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
acs.add_element('name').text = @name
acs.add_element('sort_1').text = @sort_1 if @sort_1
acs.add_element('sort_2').text = @sort_2 if @sort_2
acs.add_element('sort_3... | ruby | def rest_xml
doc = REXML::Document.new APIConnection::XML_HEADER
acs = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
acs.add_element('name').text = @name
acs.add_element('sort_1').text = @sort_1 if @sort_1
acs.add_element('sort_2').text = @sort_2 if @sort_2
acs.add_element('sort_3... | [
"def",
"rest_xml",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"APIConnection",
"::",
"XML_HEADER",
"acs",
"=",
"doc",
".",
"add_element",
"self",
".",
"class",
"::",
"RSRC_OBJECT_KEY",
".",
"to_s",
"acs",
".",
"add_element",
"(",
"'name'",
")",
"."... | Clean up the inconsistent "Display Field" keys in the search results.
Sometimes spaces have been converted to underscores, sometimes not, sometimes both.
Same for dashes.
E.g :"Last Check-in"/:Last_Check_in/:"Last_Check-in", :Computer_Name, and :"Display Name"/:Display_Name
This ensures there's always the fully ... | [
"Clean",
"up",
"the",
"inconsistent",
"Display",
"Field",
"keys",
"in",
"the",
"search",
"results",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/advanced_search.rb#L337-L351 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mobile_device_application.rb | JSS.MobileDeviceApplication.deploy_as_managed_app= | def deploy_as_managed_app=(new_val)
return nil if new_val == @deploy_as_managed_app
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@deploy_as_managed_app = new_val
@need_to_update = true
end | ruby | def deploy_as_managed_app=(new_val)
return nil if new_val == @deploy_as_managed_app
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@deploy_as_managed_app = new_val
@need_to_update = true
end | [
"def",
"deploy_as_managed_app",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@deploy_as_managed_app",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be true or false'",
"unless",
"new_val",
".",
"jss_boolean?",
"@deploy_as_managed_ap... | Set whether or not this app should be deployed as managed
@param new_val[Boolean] The new value
@return [void] | [
"Set",
"whether",
"or",
"not",
"this",
"app",
"should",
"be",
"deployed",
"as",
"managed"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mobile_device_application.rb#L284-L289 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mobile_device_application.rb | JSS.MobileDeviceApplication.remove_app_when_mdm_profile_is_removed= | def remove_app_when_mdm_profile_is_removed=(new_val)
return nil if new_val == @remove_app_when_mdm_profile_is_removed
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@remove_app_when_mdm_profile_is_removed = new_val
@need_to_update = true
end | ruby | def remove_app_when_mdm_profile_is_removed=(new_val)
return nil if new_val == @remove_app_when_mdm_profile_is_removed
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@remove_app_when_mdm_profile_is_removed = new_val
@need_to_update = true
end | [
"def",
"remove_app_when_mdm_profile_is_removed",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@remove_app_when_mdm_profile_is_removed",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be true or false'",
"unless",
"new_val",
".",
"jss_b... | Set whether or not this app should be removed when
the device is unmanaged
@param new_val[Boolean] The new value
@return [void] | [
"Set",
"whether",
"or",
"not",
"this",
"app",
"should",
"be",
"removed",
"when",
"the",
"device",
"is",
"unmanaged"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mobile_device_application.rb#L299-L304 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mobile_device_application.rb | JSS.MobileDeviceApplication.prevent_backup_of_app_data= | def prevent_backup_of_app_data=(new_val)
return nil if new_val == @prevent_backup_of_app_data
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@prevent_backup_of_app_data = new_val
@need_to_update = true
end | ruby | def prevent_backup_of_app_data=(new_val)
return nil if new_val == @prevent_backup_of_app_data
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@prevent_backup_of_app_data = new_val
@need_to_update = true
end | [
"def",
"prevent_backup_of_app_data",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@prevent_backup_of_app_data",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be true or false'",
"unless",
"new_val",
".",
"jss_boolean?",
"@prevent_ba... | Set whether or not the device should back up this app's data
@param new_val[Boolean] The new value
@return [void] | [
"Set",
"whether",
"or",
"not",
"the",
"device",
"should",
"back",
"up",
"this",
"app",
"s",
"data"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mobile_device_application.rb#L312-L317 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mobile_device_application.rb | JSS.MobileDeviceApplication.keep_description_and_icon_up_to_date= | def keep_description_and_icon_up_to_date=(new_val)
return nil if new_val == @keep_description_and_icon_up_to_date
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@keep_description_and_icon_up_to_date = new_val
@need_to_update = true
end | ruby | def keep_description_and_icon_up_to_date=(new_val)
return nil if new_val == @keep_description_and_icon_up_to_date
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@keep_description_and_icon_up_to_date = new_val
@need_to_update = true
end | [
"def",
"keep_description_and_icon_up_to_date",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@keep_description_and_icon_up_to_date",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be true or false'",
"unless",
"new_val",
".",
"jss_boole... | Set whether or not the jss should update info about this app from the app store
@param new_val[Boolean] The new value
@return [void] | [
"Set",
"whether",
"or",
"not",
"the",
"jss",
"should",
"update",
"info",
"about",
"this",
"app",
"from",
"the",
"app",
"store"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mobile_device_application.rb#L326-L331 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mobile_device_application.rb | JSS.MobileDeviceApplication.free= | def free=(new_val)
return nil if new_val == @free
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@free = new_val
@need_to_update = true
end | ruby | def free=(new_val)
return nil if new_val == @free
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@free = new_val
@need_to_update = true
end | [
"def",
"free",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@free",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be true or false'",
"unless",
"new_val",
".",
"jss_boolean?",
"@free",
"=",
"new_val",
"@need_to_update",
"=",... | Set whether or not this is a free app
@param new_val[Boolean] The new value
@return [void] | [
"Set",
"whether",
"or",
"not",
"this",
"is",
"a",
"free",
"app"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mobile_device_application.rb#L339-L344 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mobile_device_application.rb | JSS.MobileDeviceApplication.take_over_management= | def take_over_management=(new_val)
return nil if new_val == @take_over_management
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@take_over_management = new_val
@need_to_update = true
end | ruby | def take_over_management=(new_val)
return nil if new_val == @take_over_management
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@take_over_management = new_val
@need_to_update = true
end | [
"def",
"take_over_management",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@take_over_management",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be true or false'",
"unless",
"new_val",
".",
"jss_boolean?",
"@take_over_management",... | Set whether or not Jamf should manage this app even if the user installed
it on their own.
@param new_val[Boolean] The new value
@return [void] | [
"Set",
"whether",
"or",
"not",
"Jamf",
"should",
"manage",
"this",
"app",
"even",
"if",
"the",
"user",
"installed",
"it",
"on",
"their",
"own",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mobile_device_application.rb#L353-L358 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mobile_device_application.rb | JSS.MobileDeviceApplication.host_externally= | def host_externally=(new_val)
return nil if new_val == @host_externally
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@host_externally = new_val
@need_to_update = true
end | ruby | def host_externally=(new_val)
return nil if new_val == @host_externally
raise JSS::InvalidDataError, 'New value must be true or false' unless new_val.jss_boolean?
@host_externally = new_val
@need_to_update = true
end | [
"def",
"host_externally",
"=",
"(",
"new_val",
")",
"return",
"nil",
"if",
"new_val",
"==",
"@host_externally",
"raise",
"JSS",
"::",
"InvalidDataError",
",",
"'New value must be true or false'",
"unless",
"new_val",
".",
"jss_boolean?",
"@host_externally",
"=",
"new_... | Set whether or not this app's .ipa is hosted outside the Jamf server
@param new_val[Boolean] The new value
@return [void] | [
"Set",
"whether",
"or",
"not",
"this",
"app",
"s",
".",
"ipa",
"is",
"hosted",
"outside",
"the",
"Jamf",
"server"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mobile_device_application.rb#L390-L395 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/mobile_device_application.rb | JSS.MobileDeviceApplication.save_ipa | def save_ipa(path, overwrite = false)
return nil unless @ipa[:data]
path = Pathname.new path
path = path + @ipa[:name] if path.directory? && @ipa[:name]
raise JSS::AlreadyExistsError, "The file #{path} already exists" if path.exist? && !overwrite
path.delete if path.exist?
path.jss_... | ruby | def save_ipa(path, overwrite = false)
return nil unless @ipa[:data]
path = Pathname.new path
path = path + @ipa[:name] if path.directory? && @ipa[:name]
raise JSS::AlreadyExistsError, "The file #{path} already exists" if path.exist? && !overwrite
path.delete if path.exist?
path.jss_... | [
"def",
"save_ipa",
"(",
"path",
",",
"overwrite",
"=",
"false",
")",
"return",
"nil",
"unless",
"@ipa",
"[",
":data",
"]",
"path",
"=",
"Pathname",
".",
"new",
"path",
"path",
"=",
"path",
"+",
"@ipa",
"[",
":name",
"]",
"if",
"path",
".",
"directory... | Save the application to a file.
@param path[Pathname, String] The path to which the file should be saved.
If the path given is an existing directory, the ipa's current filename will
be used, if known.
@param overwrite[Boolean] Overwrite the file if it exists? Defaults to false
@return [void] | [
"Save",
"the",
"application",
"to",
"a",
"file",
"."
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/mobile_device_application.rb#L433-L441 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/computer.rb | JSS.Computer.management_data | def management_data(subset: nil, only: nil)
raise JSS::NoSuchItemError, 'Computer not yet saved in the JSS' unless @in_jss
JSS::Computer.management_data @id, subset: subset, only: only, api: @api
end | ruby | def management_data(subset: nil, only: nil)
raise JSS::NoSuchItemError, 'Computer not yet saved in the JSS' unless @in_jss
JSS::Computer.management_data @id, subset: subset, only: only, api: @api
end | [
"def",
"management_data",
"(",
"subset",
":",
"nil",
",",
"only",
":",
"nil",
")",
"raise",
"JSS",
"::",
"NoSuchItemError",
",",
"'Computer not yet saved in the JSS'",
"unless",
"@in_jss",
"JSS",
"::",
"Computer",
".",
"management_data",
"@id",
",",
"subset",
":... | app usage
The 'computer management' data for this computer
NOTE: the data isn't cached locally, and the API is queried every time
@see {JSS::Computer.management_data} for details | [
"app",
"usage",
"The",
"computer",
"management",
"data",
"for",
"this",
"computer"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/computer.rb#L886-L889 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/computer.rb | JSS.Computer.set_management_to | def set_management_to(name, password)
password = nil unless name
@management_username = name
@management_password = password
@managed = name ? true : false
@need_to_update = true
end | ruby | def set_management_to(name, password)
password = nil unless name
@management_username = name
@management_password = password
@managed = name ? true : false
@need_to_update = true
end | [
"def",
"set_management_to",
"(",
"name",
",",
"password",
")",
"password",
"=",
"nil",
"unless",
"name",
"@management_username",
"=",
"name",
"@management_password",
"=",
"password",
"@managed",
"=",
"name",
"?",
"true",
":",
"false",
"@need_to_update",
"=",
"tr... | Set or unset management acct and password for this computer
@param name[String] the name of the management acct.
@param password[String] the password of the management acct
@return [void]
The changes will need to be pushed to the server with {#update}
before they take effect.
CAUTION: this does nothing to co... | [
"Set",
"or",
"unset",
"management",
"acct",
"and",
"password",
"for",
"this",
"computer"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/computer.rb#L953-L959 | train |
PixarAnimationStudios/ruby-jss | lib/jss/api_object/computer.rb | JSS.Computer.rest_xml | def rest_xml
doc = REXML::Document.new APIConnection::XML_HEADER
computer = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
general = computer.add_element('general')
general.add_element('name').text = @name
general.add_element('alt_mac_address').text = @alt_mac_address
general.add_... | ruby | def rest_xml
doc = REXML::Document.new APIConnection::XML_HEADER
computer = doc.add_element self.class::RSRC_OBJECT_KEY.to_s
general = computer.add_element('general')
general.add_element('name').text = @name
general.add_element('alt_mac_address').text = @alt_mac_address
general.add_... | [
"def",
"rest_xml",
"doc",
"=",
"REXML",
"::",
"Document",
".",
"new",
"APIConnection",
"::",
"XML_HEADER",
"computer",
"=",
"doc",
".",
"add_element",
"self",
".",
"class",
"::",
"RSRC_OBJECT_KEY",
".",
"to_s",
"general",
"=",
"computer",
".",
"add_element",
... | Return a String with the XML Resource
for submitting changes to the JSS via
the API
For Computers, only some items can be changed via the API
In particular, any data gatherd by a Recon cannot be changed | [
"Return",
"a",
"String",
"with",
"the",
"XML",
"Resource",
"for",
"submitting",
"changes",
"to",
"the",
"JSS",
"via",
"the",
"API"
] | 4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9 | https://github.com/PixarAnimationStudios/ruby-jss/blob/4ab645bfaec8b2edb1ea146bfc2b10f0d62edee9/lib/jss/api_object/computer.rb#L1113-L1142 | train |
Subsets and Splits
SQL Console for semeru/code-text-ruby
Retrieves 20,000 non-null code samples labeled as Ruby, providing a basic overview of the dataset but without deeper analysis.