ruby-jss 0.6.5 → 0.6.6
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.
- checksums.yaml +4 -4
- data/CHANGES.md +57 -5
- data/lib/jss.rb +78 -94
- data/lib/jss/api_connection.rb +8 -0
- data/lib/jss/api_object.rb +126 -102
- data/lib/jss/api_object/creatable.rb +33 -15
- data/lib/jss/api_object/distribution_point.rb +4 -1
- data/lib/jss/api_object/extension_attribute.rb +1 -1
- data/lib/jss/api_object/package.rb +121 -187
- data/lib/jss/api_object/policy.rb +590 -251
- data/lib/jss/api_object/script.rb +92 -128
- data/lib/jss/api_object/self_servable.rb +93 -117
- data/lib/jss/api_object/updatable.rb +12 -27
- data/lib/jss/api_object/uploadable.rb +12 -15
- data/lib/jss/client.rb +178 -156
- data/lib/jss/db_connection.rb +34 -49
- data/lib/jss/ruby_extensions/string.rb +25 -21
- data/lib/jss/version.rb +1 -1
- data/lib/jss/webhooks.rb +52 -0
- data/lib/jss/webhooks/README.md +269 -0
- data/lib/jss/webhooks/configuration.rb +212 -0
- data/lib/jss/webhooks/data/sample_handlers/RestAPIOperation-executable +90 -0
- data/lib/jss/webhooks/data/sample_handlers/RestAPIOperation.rb +44 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerAdded.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerCheckIn.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerInventoryCompleted.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerPolicyFinished.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/ComputerPushCapabilityChanged.json +27 -0
- data/lib/jss/webhooks/data/sample_jsons/JSSShutdown.json +14 -0
- data/lib/jss/webhooks/data/sample_jsons/JSSStartup.json +14 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceCheckIn.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceCommandCompleted.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceEnrolled.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDevicePushSent.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/MobileDeviceUnEnrolled.json +26 -0
- data/lib/jss/webhooks/data/sample_jsons/PatchSoftwareTitleUpdated.json +14 -0
- data/lib/jss/webhooks/data/sample_jsons/PushSent.json +11 -0
- data/lib/jss/webhooks/data/sample_jsons/RestAPIOperation.json +15 -0
- data/lib/jss/webhooks/data/sample_jsons/SCEPChallenge.json +10 -0
- data/lib/jss/webhooks/data/sample_jsons/SmartGroupComputerMembershipChange.json +13 -0
- data/lib/jss/webhooks/data/sample_jsons/SmartGroupMobileDeviceMembershipChange.json +13 -0
- data/lib/jss/webhooks/event.rb +138 -0
- data/lib/jss/webhooks/event/computer_added.rb +37 -0
- data/lib/jss/webhooks/event/computer_check_in.rb +37 -0
- data/lib/jss/webhooks/event/computer_inventory_completed.rb +37 -0
- data/lib/jss/webhooks/event/computer_policy_finished.rb +37 -0
- data/lib/jss/webhooks/event/computer_push_capability_changed.rb +37 -0
- data/lib/jss/webhooks/event/handlers.rb +191 -0
- data/lib/jss/webhooks/event/jss_shutdown.rb +37 -0
- data/lib/jss/webhooks/event/jss_startup.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_check_in.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_command_completed.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_enrolled.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_push_sent.rb +37 -0
- data/lib/jss/webhooks/event/mobile_device_unenrolled.rb +37 -0
- data/lib/jss/webhooks/event/patch_software_title_updated.rb +37 -0
- data/lib/jss/webhooks/event/push_sent.rb +37 -0
- data/lib/jss/webhooks/event/rest_api_operation.rb +37 -0
- data/lib/jss/webhooks/event/scep_challenge.rb +37 -0
- data/lib/jss/webhooks/event/smart_group_computer_membership_change.rb +37 -0
- data/lib/jss/webhooks/event/smart_group_mobile_device_membership_change.rb +37 -0
- data/lib/jss/webhooks/event/webhook.rb +39 -0
- data/lib/jss/webhooks/event_objects.rb +111 -0
- data/lib/jss/webhooks/event_objects/computer.rb +48 -0
- data/lib/jss/webhooks/event_objects/jss.rb +35 -0
- data/lib/jss/webhooks/event_objects/mobile_device.rb +47 -0
- data/lib/jss/webhooks/event_objects/patch_software_title_update.rb +37 -0
- data/lib/jss/webhooks/event_objects/push.rb +32 -0
- data/lib/jss/webhooks/event_objects/rest_api_operation.rb +36 -0
- data/lib/jss/webhooks/event_objects/scep_challenge.rb +31 -0
- data/lib/jss/webhooks/event_objects/smart_group.rb +34 -0
- data/lib/jss/webhooks/server_app.rb +36 -0
- data/lib/jss/webhooks/server_app/routes.rb +26 -0
- data/lib/jss/webhooks/server_app/routes/handle_webhook_event.rb +38 -0
- data/lib/jss/webhooks/server_app/routes/home.rb +36 -0
- data/lib/jss/webhooks/server_app/self_signed_cert.rb +64 -0
- data/lib/jss/webhooks/server_app/server.rb +59 -0
- data/lib/jss/webhooks/version.rb +31 -0
- metadata +63 -4
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
JSSWebHooks::EventObjects.object_definitions[:computer] = {
|
|
26
|
+
class_name: 'Computer',
|
|
27
|
+
attributes: [
|
|
28
|
+
:udid,
|
|
29
|
+
:deviceName,
|
|
30
|
+
:model,
|
|
31
|
+
:macAddress,
|
|
32
|
+
:alternateMacAddress,
|
|
33
|
+
:serialNumber,
|
|
34
|
+
:osVersion,
|
|
35
|
+
:osBuild,
|
|
36
|
+
:userDirectoryID,
|
|
37
|
+
:username,
|
|
38
|
+
:realName,
|
|
39
|
+
:emailAddress,
|
|
40
|
+
:phone,
|
|
41
|
+
:position,
|
|
42
|
+
:department,
|
|
43
|
+
:building,
|
|
44
|
+
:room,
|
|
45
|
+
:jssID
|
|
46
|
+
],
|
|
47
|
+
methods: []
|
|
48
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
JSSWebHooks::EventObjects.object_definitions[:jss] = {
|
|
26
|
+
class_name: 'JSS',
|
|
27
|
+
attributes: [
|
|
28
|
+
:institution,
|
|
29
|
+
:hostAddress,
|
|
30
|
+
:webApplicationPath,
|
|
31
|
+
:isClusterMaster,
|
|
32
|
+
:jssUrl
|
|
33
|
+
],
|
|
34
|
+
methods: []
|
|
35
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
JSSWebHooks::EventObjects.object_definitions[:mobile_device] = {
|
|
26
|
+
class_name: 'MobileDevice',
|
|
27
|
+
attributes: [
|
|
28
|
+
:udid,
|
|
29
|
+
:deviceName,
|
|
30
|
+
:version,
|
|
31
|
+
:model,
|
|
32
|
+
:bluetoothMacAddress,
|
|
33
|
+
:wifiMacAddress,
|
|
34
|
+
:imei,
|
|
35
|
+
:icciID,
|
|
36
|
+
:product,
|
|
37
|
+
:serialNumber,
|
|
38
|
+
:userDirectoryID,
|
|
39
|
+
:room,
|
|
40
|
+
:osVersion,
|
|
41
|
+
:osBuild,
|
|
42
|
+
:modelDisplay,
|
|
43
|
+
:username,
|
|
44
|
+
:jssID
|
|
45
|
+
],
|
|
46
|
+
methods: []
|
|
47
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
JSSWebHooks::EventObjects.object_definitions[:patch_software_title_update] = {
|
|
26
|
+
class_name: 'PatchSoftwareTitleUpdate',
|
|
27
|
+
attributes: [
|
|
28
|
+
:name,
|
|
29
|
+
:latestVersion,
|
|
30
|
+
:lastUpdate,
|
|
31
|
+
:reportUrl,
|
|
32
|
+
:jssID
|
|
33
|
+
],
|
|
34
|
+
methods: [
|
|
35
|
+
{ name: :timestamp, proc: proc { Time.strptime lastUpdate.to_s[0..-4], '%s' } }
|
|
36
|
+
]
|
|
37
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
JSSWebHooks::EventObjects.object_definitions[:push] = {
|
|
26
|
+
class_name: 'Push',
|
|
27
|
+
attributes: [
|
|
28
|
+
:type,
|
|
29
|
+
:jssID
|
|
30
|
+
],
|
|
31
|
+
methods: []
|
|
32
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
JSSWebHooks::EventObjects.object_definitions[:rest_api_operation] = {
|
|
26
|
+
class_name: 'RestAPIOperation',
|
|
27
|
+
attributes: [
|
|
28
|
+
:operationSuccessful,
|
|
29
|
+
:objectID,
|
|
30
|
+
:objectName,
|
|
31
|
+
:objectTypeName,
|
|
32
|
+
:authorizedUsername,
|
|
33
|
+
:restAPIOperationType
|
|
34
|
+
],
|
|
35
|
+
methods: []
|
|
36
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
JSSWebHooks::EventObjects.object_definitions[:scep_challenge] = {
|
|
26
|
+
class_name: 'SCEPChallenge',
|
|
27
|
+
attributes: [
|
|
28
|
+
:targetDevice
|
|
29
|
+
],
|
|
30
|
+
methods: []
|
|
31
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
JSSWebHooks::EventObjects.object_definitions[:smart_group] = {
|
|
26
|
+
class_name: 'SmartGroup',
|
|
27
|
+
attributes: [
|
|
28
|
+
:name,
|
|
29
|
+
:smartGroup,
|
|
30
|
+
:jssid,
|
|
31
|
+
:computer
|
|
32
|
+
],
|
|
33
|
+
methods: []
|
|
34
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
require 'jss/webhooks'
|
|
26
|
+
require 'sinatra/base'
|
|
27
|
+
|
|
28
|
+
module JSSWebHooks
|
|
29
|
+
|
|
30
|
+
# the class has to be defined first for some reason
|
|
31
|
+
class Server < Sinatra::Base ; end
|
|
32
|
+
|
|
33
|
+
end # module
|
|
34
|
+
|
|
35
|
+
require 'jss/webhooks/server_app/server'
|
|
36
|
+
require 'jss/webhooks/server_app/routes'
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
require 'jss/webhooks/server_app/routes/home'
|
|
26
|
+
require 'jss/webhooks/server_app/routes/handle_webhook_event'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
module JSSWebHooks
|
|
26
|
+
|
|
27
|
+
# see server.rb
|
|
28
|
+
class Server < Sinatra::Base
|
|
29
|
+
|
|
30
|
+
post '/handle_webhook_event' do
|
|
31
|
+
request.body.rewind # in case someone already read it
|
|
32
|
+
event = JSSWebHooks::Event.parse_event request.body.read
|
|
33
|
+
event.handle
|
|
34
|
+
end # post
|
|
35
|
+
|
|
36
|
+
end # class
|
|
37
|
+
|
|
38
|
+
end # module
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
### Copyright 2016 Pixar
|
|
2
|
+
###
|
|
3
|
+
### Licensed under the Apache License, Version 2.0 (the "Apache License")
|
|
4
|
+
### with the following modification; you may not use this file except in
|
|
5
|
+
### compliance with the Apache License and the following modification to it:
|
|
6
|
+
### Section 6. Trademarks. is deleted and replaced with:
|
|
7
|
+
###
|
|
8
|
+
### 6. Trademarks. This License does not grant permission to use the trade
|
|
9
|
+
### names, trademarks, service marks, or product names of the Licensor
|
|
10
|
+
### and its affiliates, except as required to comply with Section 4(c) of
|
|
11
|
+
### the License and to reproduce the content of the NOTICE file.
|
|
12
|
+
###
|
|
13
|
+
### You may obtain a copy of the Apache License at
|
|
14
|
+
###
|
|
15
|
+
### http://www.apache.org/licenses/LICENSE-2.0
|
|
16
|
+
###
|
|
17
|
+
### Unless required by applicable law or agreed to in writing, software
|
|
18
|
+
### distributed under the Apache License with the above modification is
|
|
19
|
+
### distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
20
|
+
### KIND, either express or implied. See the Apache License for the specific
|
|
21
|
+
### language governing permissions and limitations under the Apache License.
|
|
22
|
+
###
|
|
23
|
+
###
|
|
24
|
+
|
|
25
|
+
module JSSWebHooks
|
|
26
|
+
|
|
27
|
+
# see server.rb
|
|
28
|
+
class Server < Sinatra::Base
|
|
29
|
+
|
|
30
|
+
get '/' do
|
|
31
|
+
body 'Hello, - this is the JSS WebHook handling service'
|
|
32
|
+
end # get /
|
|
33
|
+
|
|
34
|
+
end # class
|
|
35
|
+
|
|
36
|
+
end # module
|