Class: Jess::Computers
- Inherits:
-
Object
- Object
- Jess::Computers
- Defined in:
- lib/jess/computers.rb
Overview
Computer-related JSS API operations
Instance Attribute Summary collapse
-
#http_client ⇒ Object
readonly
Returns the value of attribute http_client.
Instance Method Summary collapse
-
#all_ids ⇒ Object
Get all computer IDs.
-
#find(id) ⇒ Object
Retrieve a computer by ID.
-
#initialize(http_client) ⇒ Computers
constructor
A new instance of Computers.
Constructor Details
#initialize(http_client) ⇒ Computers
Returns a new instance of Computers.
8 9 10 |
# File 'lib/jess/computers.rb', line 8 def initialize(http_client) @http_client = http_client end |
Instance Attribute Details
#http_client ⇒ Object (readonly)
Returns the value of attribute http_client.
6 7 8 |
# File 'lib/jess/computers.rb', line 6 def http_client @http_client end |
Instance Method Details
#all_ids ⇒ Object
Get all computer IDs.
19 20 21 22 |
# File 'lib/jess/computers.rb', line 19 def all_ids json = JSON.parse(http_client.get("computers")) json["computers"].map { |c| c["id"] } end |