ruby-jss 0.11.0a6 → 0.11.0b1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of ruby-jss might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 738e376502016631097bea927398750c1606a6f4
4
- data.tar.gz: 9a82556c928e8cca44b4e37cd663b5959f9c774b
3
+ metadata.gz: ad7f8bb660801869ee8f70a9ae78a872c7b99296
4
+ data.tar.gz: 9a06851981b20938d10811b002821bfff9e5fa4d
5
5
  SHA512:
6
- metadata.gz: 4b309bc27a8314a2b588678d056760acfcf68abc9b75c4044c0c53c669a57b9b20750acce2a5837dc37d838a9a3b6f28ed8966018a8df48394e5245672a2166f
7
- data.tar.gz: 0d5ba01aef444d7e3a24a877b6a9de341a01fce551f9362f850de49bf5a8e2691af8e610e9ae82b14be30e59c2112a882ba432b51fd19b8e94a1d70544650049
6
+ metadata.gz: a61ae7382fa4ff8eba62f55b6ac31d46b9f6950e221563bcbb9ffd33ec36cdde578000e6bf73ccda72ff069da60737d41adb274a9e5bb74b007f115d368ea6e9
7
+ data.tar.gz: 40500cab943728f7b057583cb62501f8049307a0b17afc774cf62c4f9ed1eb4e2b41fd72d912501588de0253f3981321b28f05d6b2ad4273ba73916f10caa4af
data/CHANGES.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Change History
2
2
 
3
- ## v 0.11.0, 2018-02-19
3
+ ## v 0.11.0b1, 2018-02-19
4
4
 
5
5
  - Improvement: Updated general attributes for computers and mobile devices
6
6
 
@@ -18,6 +18,8 @@
18
18
 
19
19
  - Improvement: All handling of MDM commands is in the JSS::MDM module, which is mixed in to Computer, ComputerGroup, MobileDevice, and MobileDeviceGroup
20
20
 
21
+ *WARNING* Due to the expanded functionality of MDM commands overall, the syntax for calling .send_mdm_command may have changed, depening on how you used it. Please test your code before updating.
22
+
21
23
  - Fix: Scope objects use the api connection of their container
22
24
 
23
25
  - Improvement: 'devmode', use `JSS.devmode \[:on|:off]`` to set, and `JSS.devmode?`` to query. Useful for developers, esp. in `irb` who want, e.g. to have a method output some state when in devmode, instead of/as well as behaving normally. This is currently the case for `JSS::MDM.send_mdm_command`. When devmode? is true, the XML sent to the API for the command is printed to stdout before the command is sent to the target machine.
@@ -37,7 +39,7 @@
37
39
 
38
40
  For example, the {JSS::MobileDevice.audit_history} method returns an Array of JSS::ManagementHistory::AuditEvent instances, and the
39
41
  {JSS::Computer.completed_policies} gives an Array of JSS::ManagementHistory::PolicyLog objects. These objects are read-only and
40
- provide access to their values via attribute-style methods.
42
+ provide access to their values via attribute-style methods, and hash-like keys, similar to how OpenStruct objects do.
41
43
 
42
44
  As with MDM command handling, and computer app usage and mgmt data, the work is done by class methods, so that the data is available without creating instances of the Computers or MobileDevices, and the instance methods just
43
45
  call the class methods.
@@ -45,6 +47,11 @@
45
47
  *WARNING* these changes mean that the methods returning Arrays of ManagementHistory class instances are not backward compatible,
46
48
  since the earlier versions returned Hashes
47
49
 
50
+ - Deprecated: The JSS::APIConnection convenience class methods .computer_history, .send_computer_mdm_command, and .send_computer_mdm_command.
51
+
52
+ These methods have been updated to work with the new methods in the MDM and ManagementHistory modules, but will be removed from JSS::APIConnection in a future release. Instead, call them directly from the JSS::Computer or JSS::MobileDevice classes, passing in the desired APIConnection if needed. Given the expansion of MDM commands and history details, maintaining the convenience methods in APIConnection is too prone to errors.
53
+
54
+
48
55
  ## v 0.10.2, 2018-02-16
49
56
 
50
57
  - *IMPORTANT BUG FIX*: Updating JSS::Extendable objects with no changes to ext. attribs will no longer erase all ext attrib values. (!)
@@ -253,13 +253,10 @@ module JSS
253
253
  # (if the object is {Matchable})
254
254
  # - {#fetch} retrieve an object from the JSS
255
255
  # - {#make} instantiate an object to be created in the JSS
256
- # - {#send_computer_mdm_command} same as {Computer.send_mdm_command}
257
256
  # - {#computer_checkin_settings} same as {Computer.checkin_settings}
258
257
  # - {#computer_inventory_collection_settings} same as {Computer.inventory_collection_settings}
259
258
  # - {#computer_application_usage} same as {Computer.application_usage}
260
259
  # - {#computer_management_data} same as {Computer.management_data}
261
- # - {#computer_history} same as {Computer.history}
262
- # - {#send_mobiledevice_mdm_command} same as {MobileDevice.send_mdm_command}
263
260
  # - {#master_distribution_point} same as {DistributionPoint.master_distribution_point}
264
261
  # - {#my_distribution_point} same as {DistributionPoint.my_distribution_point}
265
262
  # - {#network_ranges} same as {NetworkSegment.network_ranges}
@@ -781,15 +778,22 @@ module JSS
781
778
  # Call {JSS::Computer.history} q.v., passing this API
782
779
  # connection
783
780
  #
781
+ # @deprecated Please use JSS::Computer.management_history or its
782
+ # convenience methods. @see JSS::ManagementHistory
783
+ #
784
784
  def computer_history(ident, subset: nil)
785
- JSS::Computer.history ident, subset: subset, api: self
785
+ JSS::Computer.history ident, subset, api: self
786
786
  end
787
787
 
788
788
  # Call {JSS::Computer.send_mdm_command} q.v., passing this API
789
789
  # connection
790
790
  #
791
+ # @deprecated Please use JSS::Computer.send_mdm_command or its
792
+ # convenience methods. @see JSS::MDM
793
+ #
791
794
  def send_computer_mdm_command(targets, command, passcode = nil)
792
- JSS::Computer.send_mdm_command targets, command, passcode, api: self
795
+ opts = passcode ? { passcode: passcode } : {}
796
+ JSS::Computer.send_mdm_command targets, command, opts: opts, api: self
793
797
  end
794
798
 
795
799
  # Get the DistributionPoint instance for the master
@@ -888,8 +892,11 @@ module JSS
888
892
  #
889
893
  # see {JSS::MobileDevice.send_mdm_command}
890
894
  #
891
- def send_mobiledevice_mdm_command(targets, command, data = nil)
892
- JSS::MobileDevice.send_mdm_command(targets, command, data, api: self)
895
+ # @deprecated Please use JSS::MobileDevice.send_mdm_command or its
896
+ # convenience methods. @see JSS::MDM
897
+ #
898
+ def send_mobiledevice_mdm_command(targets, command, data = {})
899
+ JSS::MobileDevice.send_mdm_command(targets, command, opts: data, api: self)
893
900
  end
894
901
 
895
902
  # Remove the various cached data
@@ -6,15 +6,15 @@ module JSS
6
6
 
7
7
  # This is mixed in to the history event classes to
8
8
  # provide hash-like access to their attributes, so that
9
- # `some_event[:date_time]`
9
+ # some_event[:date_time]
10
10
  # works the same as
11
- # `some_event.date_time`
11
+ # some_event.date_time
12
12
  # just as with OpenStruct objects
13
13
  #
14
14
  module HashLike
15
15
 
16
16
  def [](attr)
17
- self.send attr.to_sym
17
+ send attr.to_sym
18
18
  end
19
19
 
20
20
  end # HashLike
@@ -450,6 +450,15 @@ module JSS
450
450
  targets.each { |group_id| target_ids += fetch(id: group_id).member_ids }
451
451
  targets = target_ids
452
452
  end
453
+
454
+ # make sure all of them are managed, or else the API will raise a 400
455
+ # 'Bad Request' when sending the command to an unmanaged target
456
+ all_mgd = self.map_all_ids_to(:managed).select { |_id, mgd| mgd }.keys
457
+
458
+ targets.each do |target_id|
459
+ raise JSS::UnmanagedError, "#{self} with id #{target_id} is not managed. Cannot send command." unless all_mgd.include? target_id
460
+ end
461
+
453
462
  targets
454
463
  end
455
464
 
@@ -27,6 +27,6 @@
27
27
  module JSS
28
28
 
29
29
  ### The version of the JSS ruby gem
30
- VERSION = '0.11.0a6'.freeze
30
+ VERSION = '0.11.0b1'.freeze
31
31
 
32
32
  end # module
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-jss
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0a6
4
+ version: 0.11.0b1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Lasell
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-02-16 00:00:00.000000000 Z
12
+ date: 2018-02-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plist