ruby-jss 1.0.4 → 1.1.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.

Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +26 -0
  3. data/lib/jss.rb +47 -24
  4. data/lib/jss/api_connection.rb +39 -7
  5. data/lib/jss/api_object.rb +651 -319
  6. data/lib/jss/api_object/account.rb +19 -5
  7. data/lib/jss/api_object/advanced_search/advanced_computer_search.rb +0 -3
  8. data/lib/jss/api_object/advanced_search/advanced_mobile_device_search.rb +0 -3
  9. data/lib/jss/api_object/advanced_search/advanced_user_search.rb +0 -3
  10. data/lib/jss/api_object/building.rb +0 -3
  11. data/lib/jss/api_object/category.rb +0 -3
  12. data/lib/jss/api_object/computer.rb +83 -28
  13. data/lib/jss/api_object/computer_invitation.rb +1 -11
  14. data/lib/jss/api_object/configuration_profile/osx_configuration_profile.rb +0 -3
  15. data/lib/jss/api_object/department.rb +0 -3
  16. data/lib/jss/api_object/distribution_point.rb +0 -3
  17. data/lib/jss/api_object/extendable.rb +113 -57
  18. data/lib/jss/api_object/extension_attribute.rb +46 -13
  19. data/lib/jss/api_object/extension_attribute/computer_extension_attribute.rb +0 -3
  20. data/lib/jss/api_object/extension_attribute/mobile_device_extension_attribute.rb +56 -19
  21. data/lib/jss/api_object/extension_attribute/user_extension_attribute.rb +0 -3
  22. data/lib/jss/api_object/group/computer_group.rb +0 -3
  23. data/lib/jss/api_object/group/mobile_device_group.rb +0 -3
  24. data/lib/jss/api_object/group/user_group.rb +0 -3
  25. data/lib/jss/api_object/ldap_server.rb +0 -3
  26. data/lib/jss/api_object/mobile_device.rb +25 -29
  27. data/lib/jss/api_object/mobile_device_application.rb +1 -9
  28. data/lib/jss/api_object/netboot_server.rb +0 -3
  29. data/lib/jss/api_object/network_segment.rb +0 -3
  30. data/lib/jss/api_object/package.rb +0 -3
  31. data/lib/jss/api_object/patch_source/patch_external_source.rb +0 -2
  32. data/lib/jss/api_object/patch_source/patch_internal_source.rb +0 -3
  33. data/lib/jss/api_object/patch_title.rb +1 -2
  34. data/lib/jss/api_object/peripheral.rb +0 -3
  35. data/lib/jss/api_object/peripheral_type.rb +0 -2
  36. data/lib/jss/api_object/policy.rb +20 -2
  37. data/lib/jss/api_object/removable_macaddr.rb +0 -3
  38. data/lib/jss/api_object/restricted_software.rb +0 -3
  39. data/lib/jss/api_object/scopable.rb +0 -12
  40. data/lib/jss/api_object/scopable/scope.rb +1 -1
  41. data/lib/jss/api_object/script.rb +0 -3
  42. data/lib/jss/api_object/self_servable.rb +3 -1
  43. data/lib/jss/api_object/site.rb +0 -3
  44. data/lib/jss/api_object/software_update_server.rb +0 -3
  45. data/lib/jss/api_object/user.rb +0 -3
  46. data/lib/jss/api_object/webhook.rb +0 -3
  47. data/lib/jss/compatibility.rb +74 -53
  48. data/lib/jss/exceptions.rb +5 -0
  49. data/lib/jss/ruby_extensions/string.rb +4 -48
  50. data/lib/jss/ruby_extensions/string/conversions.rb +69 -0
  51. data/lib/jss/ruby_extensions/string/predicates.rb +47 -0
  52. data/lib/jss/version.rb +1 -1
  53. data/test/README.md +2 -4
  54. metadata +6 -4
@@ -0,0 +1,69 @@
1
+ # Copyright 2019 Pixar
2
+
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "Apache License")
5
+ # with the following modification; you may not use this file except in
6
+ # compliance with the Apache License and the following modification to it:
7
+ # Section 6. Trademarks. is deleted and replaced with:
8
+ #
9
+ # 6. Trademarks. This License does not grant permission to use the trade
10
+ # names, trademarks, service marks, or product names of the Licensor
11
+ # and its affiliates, except as required to comply with Section 4(c) of
12
+ # the License and to reproduce the content of the NOTICE file.
13
+ #
14
+ # You may obtain a copy of the Apache License at
15
+ #
16
+ # http://www.apache.org/licenses/LICENSE-2.0
17
+ #
18
+ # Unless required by applicable law or agreed to in writing, software
19
+ # distributed under the Apache License with the above modification is
20
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
+ # KIND, either express or implied. See the Apache License for the specific
22
+ # language governing permissions and limitations under the Apache License.
23
+
24
+ module JSSRubyExtensions
25
+
26
+ module String
27
+
28
+ module Conversions
29
+
30
+ # Convert the strings "true" and "false"
31
+ # (after stripping whitespace and downcasing)
32
+ # to TrueClass and FalseClass respectively
33
+ #
34
+ # Return nil if any other string.
35
+ #
36
+ # @return [Boolean,nil] the boolean value
37
+ #
38
+ def jss_to_bool
39
+ case strip.downcase
40
+ when 'true' then true
41
+ when 'false' then false
42
+ end # case
43
+ end # to bool
44
+
45
+ # Convert a string to a Time object
46
+ #
47
+ # returns nil if not parsable by JSS::parse_datetime
48
+ #
49
+ # @return [Time] the time represented by the string.
50
+ #
51
+ def jss_to_time
52
+ JSS.parse_time self
53
+ rescue
54
+ nil
55
+ end
56
+
57
+ # Convert a String to a Pathname object
58
+ #
59
+ # @return [Pathname]
60
+ #
61
+ def jss_to_pathname
62
+ Pathname.new self
63
+ end
64
+
65
+ end # module
66
+
67
+ end # module
68
+
69
+ end # module
@@ -0,0 +1,47 @@
1
+ # Copyright 2019 Pixar
2
+
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "Apache License")
5
+ # with the following modification; you may not use this file except in
6
+ # compliance with the Apache License and the following modification to it:
7
+ # Section 6. Trademarks. is deleted and replaced with:
8
+ #
9
+ # 6. Trademarks. This License does not grant permission to use the trade
10
+ # names, trademarks, service marks, or product names of the Licensor
11
+ # and its affiliates, except as required to comply with Section 4(c) of
12
+ # the License and to reproduce the content of the NOTICE file.
13
+ #
14
+ # You may obtain a copy of the Apache License at
15
+ #
16
+ # http://www.apache.org/licenses/LICENSE-2.0
17
+ #
18
+ # Unless required by applicable law or agreed to in writing, software
19
+ # distributed under the Apache License with the above modification is
20
+ # distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
+ # KIND, either express or implied. See the Apache License for the specific
22
+ # language governing permissions and limitations under the Apache License.
23
+ #
24
+ #
25
+
26
+ module JSSRubyExtensions
27
+
28
+ module String
29
+
30
+ module Predicates
31
+
32
+ INTEGER_RE = /\A[0-9]+\Z/.freeze
33
+
34
+ # Is this string also a positive integer?
35
+ # (i.e. it consists only of numberic digits)
36
+ #
37
+ # @return [Boolean]
38
+ #
39
+ def jss_integer?
40
+ self =~ INTEGER_RE ? true : false
41
+ end
42
+
43
+ end # module
44
+
45
+ end # module
46
+
47
+ end # module
@@ -27,6 +27,6 @@
27
27
  module JSS
28
28
 
29
29
  ### The version of the JSS ruby gem
30
- VERSION = '1.0.4'.freeze
30
+ VERSION = '1.1.0b1'.freeze
31
31
 
32
32
  end # module
@@ -9,7 +9,7 @@ For example, the tests *must* be very interactive from the start - you have to t
9
9
 
10
10
  Once connected, objects have to be created before they can be listed, fetched, updated, or deleted - so test order matters.
11
11
 
12
- Also, you need to be able to have later tests refer to the same objects you created in earlier tests. Once I've tested that I can create an object on the server and re-fetch it once, I shuold be able to use that object for all future tests without fetching every time.
12
+ Also, you need to be able to have later tests refer to the same objects you created in earlier tests. Once I've tested that I can create an object on the server and re-fetch it once, I should be able to use that object for all future tests without fetching every time, much less re-creating it every time!
13
13
 
14
14
  Reading most tutorials about ruby testing just leads you in circles when you consider needs such as these.
15
15
 
@@ -56,11 +56,9 @@ WARNING: **Be very careful about running these tests on your production JSS !!!*
56
56
 
57
57
  These tests create and delete objects in the JSS. While they _shouldn't_ hurt any of the existing data - we cannot make any guarantees that they won't hurt something you care about.
58
58
 
59
- As the license text for ruby-jss states:
59
+ As the license text for ruby-jss states, ruby-jss is...
60
60
 
61
61
  ```
62
- Unless required by applicable law or agreed to in writing, software
63
- distributed under the Apache License with the above modification is
64
62
  distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
65
63
  KIND, either express or implied.
66
64
  ```
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.0.4
4
+ version: 1.1.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: 2019-05-06 00:00:00.000000000 Z
12
+ date: 2019-06-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: plist
@@ -245,6 +245,8 @@ files:
245
245
  - lib/jss/ruby_extensions/object.rb
246
246
  - lib/jss/ruby_extensions/pathname.rb
247
247
  - lib/jss/ruby_extensions/string.rb
248
+ - lib/jss/ruby_extensions/string/conversions.rb
249
+ - lib/jss/ruby_extensions/string/predicates.rb
248
250
  - lib/jss/ruby_extensions/time.rb
249
251
  - lib/jss/server.rb
250
252
  - lib/jss/utility.rb
@@ -285,9 +287,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
285
287
  version: 2.0.0
286
288
  required_rubygems_version: !ruby/object:Gem::Requirement
287
289
  requirements:
288
- - - ">="
290
+ - - ">"
289
291
  - !ruby/object:Gem::Version
290
- version: '0'
292
+ version: 1.3.1
291
293
  requirements: []
292
294
  rubyforge_project:
293
295
  rubygems_version: 2.7.8