ruby-jss 1.2.0 → 1.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

@@ -293,6 +293,27 @@ module JSS
293
293
  end # completed_mdm_commands
294
294
  alias completed_commands completed_mdm_commands
295
295
 
296
+ # The time of the most recently completed MDM command.
297
+ #
298
+ # For Mobile Devices, this seems to be the best indicator of the real
299
+ # last-contact time, since the last_inventory_update is changed when
300
+ # changes are made via the API.
301
+ #
302
+ # @param ident [Type] The identifier for the object - id, name, sn, udid, etc.
303
+ #
304
+ # @param api [JSS::APIConnection] The API connection to use for the query
305
+ # defaults to the currently active connection
306
+ #
307
+ # @return [Time, nil] An array of completed MDMCommands
308
+ #
309
+ def last_mdm_contact(ident, api: JSS.api)
310
+ cmds = completed_mdm_commands(ident, api: api)
311
+ return nil if cmds.empty?
312
+
313
+ JSS.epoch_to_time cmds.map{|cmd| cmd.completed_epoch }.max
314
+ end
315
+
316
+
296
317
  # The history of pending mdm commands for a target
297
318
  #
298
319
  # @param ident [Type] The identifier for the object - id, name, sn, udid, etc.
@@ -696,6 +717,14 @@ module JSS
696
717
  end # completed_mdm_commands
697
718
  alias completed_commands completed_mdm_commands
698
719
 
720
+ # The time of the last completed mdm command for this object
721
+ #
722
+ # @see the matching method in {JSS::ManagementHistory::ClassMethods}
723
+ #
724
+ def last_mdm_contact
725
+ self.class.last_mdm_contact(@id, api: @api)
726
+ end # completed_mdm_commands
727
+
699
728
  # The pending_mdm_commands for this object
700
729
  #
701
730
  # @see the matching method in {JSS::ManagementHistory::ClassMethods}
@@ -240,6 +240,7 @@ module JSS
240
240
  def valid_server?(server, port = DFT_PORT)
241
241
  mysql = Mysql.init
242
242
  mysql.options Mysql::OPT_CONNECT_TIMEOUT, 5
243
+ mysql.charset = DFT_CHARSET
243
244
 
244
245
  begin
245
246
  # this connection should get an access denied error if there is
data/lib/jss/version.rb CHANGED
@@ -27,6 +27,6 @@
27
27
  module JSS
28
28
 
29
29
  ### The version of ruby-jss
30
- VERSION = '1.2.0'.freeze
30
+ VERSION = '1.2.2'.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: 1.2.0
4
+ version: 1.2.2
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: 2019-10-17 00:00:00.000000000 Z
12
+ date: 2019-10-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plist
@@ -51,7 +51,7 @@ dependencies:
51
51
  requirements:
52
52
  - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: 1.8.0
54
+ version: 2.0.0
55
55
  - - "<"
56
56
  - !ruby/object:Gem::Version
57
57
  version: '2.1'
@@ -61,7 +61,7 @@ dependencies:
61
61
  requirements:
62
62
  - - ">="
63
63
  - !ruby/object:Gem::Version
64
- version: 1.8.0
64
+ version: 2.0.0
65
65
  - - "<"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '2.1'