moki_ruby 0.0.3 → 0.0.4
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/README.md +4 -4
- data/lib/moki_ruby.rb +1 -1
- data/lib/moki_ruby/device.rb +15 -3
- data/lib/moki_ruby/device_iosprofile.rb +53 -0
- data/lib/moki_ruby/{iosprofile.rb → tenant_iosprofile.rb} +1 -1
- data/lib/moki_ruby/version.rb +1 -1
- data/spec/lib/device_iosprofile_spec.rb +74 -0
- data/spec/lib/device_spec.rb +37 -5
- data/spec/lib/{iosprofile_spec.rb → tenant_iosprofile_spec.rb} +6 -6
- data/spec/moki_ruby_spec.rb +2 -2
- data/spec/support/common_stubs.rb +87 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fd513abc6ab3619a13bb2a042f56ed7c33f8c0e
|
4
|
+
data.tar.gz: 4cd6b2286ea3489638c97716ea559a64fd15926a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0d22d0fb13a6d2b996ae352b3b6af9790a996b93a7baba7583e0ed5b89b0446cca4733c1326d87c7d469efb767fab119fa3924a8ca6f8e871101d48bc1b4159b
|
7
|
+
data.tar.gz: 62100c3be98b02b2c44bcb7cb3b64df22a56cb6cb0f5ecb54f3eb9af2ef3191233af26f7dad9a7c0f3b40e9d7717e2526b019630fc8aa36610e433a11a79f276
|
data/README.md
CHANGED
@@ -38,7 +38,7 @@ or at the individual device level.
|
|
38
38
|
The following methods have been built out:
|
39
39
|
|
40
40
|
- `MokiRuby.ios_profiles` asks for all current profiles associated with this
|
41
|
-
tenant. This will return an array of `
|
41
|
+
tenant. This will return an array of `TenantIOSProfile` objects.
|
42
42
|
- `MokiRuby.tenant_managed_apps` asks for all apps associaited with this
|
43
43
|
tenant. This will return an array of `TenantManagedApp` objects.
|
44
44
|
|
@@ -54,16 +54,16 @@ MokiRuby::Device.new(udid)
|
|
54
54
|
Using this device, there are several methods available:
|
55
55
|
|
56
56
|
- `device.profiles` returns all profiles currently installed on a
|
57
|
-
device. This will return an array of `
|
57
|
+
device. This will return an array of `DeviceIOSProfile` objects.
|
58
58
|
- `device.managed_apps` returns all managed applications installed on a
|
59
59
|
device. This will return an array of `DeviceManagedApp` objects.
|
60
60
|
- `device.install_app(app)` takes in a `TenantManagedApp` object, and
|
61
61
|
will install the given application on the device. Returns an
|
62
62
|
`Action` object, for tracking in the future.
|
63
|
-
- `device.add_profile(profile)` takes in an `
|
63
|
+
- `device.add_profile(profile)` takes in an `TenantIOSProfile` object, and
|
64
64
|
will install the given profile on the device. Returns an `Action`
|
65
65
|
object, for tracking in the future.
|
66
|
-
- `device.remove_profile(profile)` take in an `
|
66
|
+
- `device.remove_profile(profile)` take in an `DeviceIOSProfile` object, and
|
67
67
|
will remove the given profile from the device. Returns an `Action`
|
68
68
|
object, for tracking in the future.
|
69
69
|
- `device.get_action(action_id)` will take in an `id` from an `Action`
|
data/lib/moki_ruby.rb
CHANGED
data/lib/moki_ruby/device.rb
CHANGED
@@ -15,11 +15,15 @@ module MokiRuby
|
|
15
15
|
|
16
16
|
def profiles
|
17
17
|
data = MokiAPI.device_profile_list(device_id_param).value
|
18
|
-
|
18
|
+
return nil unless data.status == 200
|
19
|
+
|
20
|
+
data.body.map { |profile| DeviceIOSProfile.from_hash(profile) }
|
19
21
|
end
|
20
22
|
|
21
23
|
def managed_apps
|
22
24
|
data = MokiAPI.device_managed_app_list(device_id_param).value
|
25
|
+
return nil unless data.status == 200
|
26
|
+
|
23
27
|
data.body.map { |app| DeviceManagedApp.from_hash(app) }
|
24
28
|
end
|
25
29
|
|
@@ -27,25 +31,33 @@ module MokiRuby
|
|
27
31
|
raise "Tenant Managed App required" unless tenant_managed_app && tenant_managed_app.kind_of?(TenantManagedApp)
|
28
32
|
|
29
33
|
data = MokiAPI.perform_action(device_id_param, tenant_managed_app.install_hash).value
|
34
|
+
return nil unless data.status == 200
|
35
|
+
|
30
36
|
Action.from_hash(data.body)
|
31
37
|
end
|
32
38
|
|
33
39
|
def add_profile(profile)
|
34
|
-
raise "
|
40
|
+
raise "TenantIOSProfile required" unless profile && profile.is_a?(TenantIOSProfile)
|
35
41
|
|
36
42
|
data = MokiAPI.perform_action(device_id_param, profile.install_hash).value
|
43
|
+
return nil unless data.status == 200
|
44
|
+
|
37
45
|
Action.from_hash(data.body)
|
38
46
|
end
|
39
47
|
|
40
48
|
def remove_profile(profile)
|
41
|
-
raise "
|
49
|
+
raise "DeviceIOSProfile required" unless profile && profile.is_a?(DeviceIOSProfile)
|
42
50
|
|
43
51
|
data = MokiAPI.perform_action(device_id_param, profile.removal_hash).value
|
52
|
+
return nil unless data.status == 200
|
53
|
+
|
44
54
|
Action.from_hash(data.body)
|
45
55
|
end
|
46
56
|
|
47
57
|
def get_action(action_id)
|
48
58
|
data = MokiAPI.action(device_id_param, action_id).value
|
59
|
+
return nil unless data.status == 200
|
60
|
+
|
49
61
|
Action.from_hash(data.body)
|
50
62
|
end
|
51
63
|
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module MokiRuby
|
2
|
+
class DeviceIOSProfile
|
3
|
+
attr_accessor :display_name, :version, :organization,
|
4
|
+
:removal_disallowed, :description, :identifier, :content
|
5
|
+
|
6
|
+
def self.from_hash(input_hash)
|
7
|
+
new_profile = self.new
|
8
|
+
|
9
|
+
new_profile.display_name = input_hash["PayloadDisplayName"]
|
10
|
+
new_profile.version = input_hash["PayloadVersion"]
|
11
|
+
new_profile.organization = input_hash["PayloadOrganization"]
|
12
|
+
new_profile.removal_disallowed = input_hash["PayloadRemovalDisallowed"]
|
13
|
+
new_profile.description = input_hash["PayloadDescription"]
|
14
|
+
new_profile.identifier = input_hash["PayloadIdentifier"]
|
15
|
+
new_profile.content = input_hash["PayloadContent"]
|
16
|
+
|
17
|
+
new_profile
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_hash
|
21
|
+
{
|
22
|
+
"PayloadDisplayName" => self.display_name,
|
23
|
+
"PayloadVersion" => self.version,
|
24
|
+
"PayloadOrganization" => self.organization,
|
25
|
+
"PayloadRemovalDisallowed" => self.removal_disallowed,
|
26
|
+
"PayloadDescription" => self.description,
|
27
|
+
"PayloadIdentifier" => self.identifier,
|
28
|
+
"PayloadContent" => self.content
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
def install_hash
|
33
|
+
raise "under construction"
|
34
|
+
actionable_hash.merge({ "action" => "installprofile",
|
35
|
+
"payload" => "{#{ self.id }}" })
|
36
|
+
end
|
37
|
+
|
38
|
+
def removal_hash
|
39
|
+
actionable_hash.merge({ "action" => "removeprofile",
|
40
|
+
"payload" => "{#{ self.identifier }}" })
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
def actionable_hash
|
45
|
+
{
|
46
|
+
"thirdPartyUser" => "moki_ruby",
|
47
|
+
"clientName" => "MokiRuby",
|
48
|
+
"itemName" => self.display_name,
|
49
|
+
"notify" => true
|
50
|
+
}
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
data/lib/moki_ruby/version.rb
CHANGED
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'moki_ruby/device_iosprofile'
|
3
|
+
|
4
|
+
describe DeviceIOSProfile do
|
5
|
+
let(:response_hash) { { "PayloadDisplayName" => "Belly MDM Installation",
|
6
|
+
"PayloadVersion" => "1",
|
7
|
+
"PayloadOrganization" => "Belly Inc",
|
8
|
+
"PayloadRemovalDisallowed" => "false",
|
9
|
+
"PayloadDescription" => "Allow Belly Inc to track this device, including all apps.",
|
10
|
+
"PayloadIdentifier" => "com.belly.mdm",
|
11
|
+
"PayloadContent" => [
|
12
|
+
{
|
13
|
+
"PayloadDisplayName" => "Belly",
|
14
|
+
"PayloadVersion" => "1",
|
15
|
+
"PayloadOrganization" => "Belly Inc",
|
16
|
+
"PayloadIdentifier" => "com.belly.mdm.com.apple.security.pkcs12.00110334-abcd-efab-cdef-123412341234",
|
17
|
+
"PayloadDescription" => "Identifies the device to the MDM server using SSL client certificates",
|
18
|
+
"PayloadType" => "com.apple.security.pkcs12"
|
19
|
+
},
|
20
|
+
{
|
21
|
+
"PayloadDisplayName" => "Mobile Device Management",
|
22
|
+
"PayloadVersion" => "1",
|
23
|
+
"PayloadOrganization" => "Belly Inc",
|
24
|
+
"PayloadIdentifier" => "com.belly.mdm.com.apple.mdm.1a2b3c4d-5e6f-7a8b-9c0d-0987654321ba",
|
25
|
+
"PayloadDescription" => "Configuration for MDM",
|
26
|
+
"PayloadType" => "com.apple.mdm"
|
27
|
+
}
|
28
|
+
] } }
|
29
|
+
|
30
|
+
it "will load from a hash with string keys" do
|
31
|
+
profile = DeviceIOSProfile.from_hash(response_hash)
|
32
|
+
|
33
|
+
expect(profile.display_name).to eq(response_hash["PayloadDisplayName"])
|
34
|
+
expect(profile.version).to eq(response_hash["PayloadVersion"])
|
35
|
+
expect(profile.organization).to eq(response_hash["PayloadOrganization"])
|
36
|
+
expect(profile.removal_disallowed).to eq(response_hash["PayloadRemovalDisallowed"])
|
37
|
+
expect(profile.description).to eq(response_hash["PayloadDescription"])
|
38
|
+
expect(profile.identifier).to eq(response_hash["PayloadIdentifier"])
|
39
|
+
expect(profile.content).to eq(response_hash["PayloadContent"])
|
40
|
+
end
|
41
|
+
|
42
|
+
it "will convert the response to a hash" do
|
43
|
+
profile = DeviceIOSProfile.new
|
44
|
+
profile.display_name = response_hash["PayloadDisplayName"]
|
45
|
+
profile.version = response_hash["PayloadVersion"]
|
46
|
+
profile.organization = response_hash["PayloadOrganization"]
|
47
|
+
profile.removal_disallowed = response_hash["PayloadRemovalDisallowed"]
|
48
|
+
profile.description = response_hash["PayloadDescription"]
|
49
|
+
profile.identifier = response_hash["PayloadIdentifier"]
|
50
|
+
profile.content = response_hash["PayloadContent"]
|
51
|
+
|
52
|
+
expect(profile.to_hash).to eq(response_hash)
|
53
|
+
end
|
54
|
+
|
55
|
+
xit "will return a hash for installing" do
|
56
|
+
profile = DeviceIOSProfile.from_hash(response_hash)
|
57
|
+
expect(profile.install_hash).to eq({ "action" => "installprofile",
|
58
|
+
"thirdPartyUser" => "moki_ruby",
|
59
|
+
"clientName" => "MokiRuby",
|
60
|
+
"itemName" => "Profile Name",
|
61
|
+
"notify" => true,
|
62
|
+
"payload" => "{01234699-5767-8abc-d123-ffffffffffff}" })
|
63
|
+
end
|
64
|
+
|
65
|
+
it "will return a hash for removal" do
|
66
|
+
profile = DeviceIOSProfile.from_hash(response_hash)
|
67
|
+
expect(profile.removal_hash).to eq({ "action" => "removeprofile",
|
68
|
+
"thirdPartyUser" => "moki_ruby",
|
69
|
+
"clientName" => "MokiRuby",
|
70
|
+
"itemName" => "Belly MDM Installation",
|
71
|
+
"notify" => true,
|
72
|
+
"payload" => "{com.belly.mdm}" })
|
73
|
+
end
|
74
|
+
end
|
data/spec/lib/device_spec.rb
CHANGED
@@ -54,42 +54,59 @@ describe MokiRuby::Device do
|
|
54
54
|
it "returns an array of device profiles" do
|
55
55
|
load_good_stubs
|
56
56
|
profiles = device.profiles
|
57
|
-
expect(profiles.map { |p| p.class }.uniq).to eq [
|
57
|
+
expect(profiles.map { |p| p.class }.uniq).to eq [DeviceIOSProfile]
|
58
|
+
end
|
59
|
+
|
60
|
+
it "returns nil if the device can not be found" do
|
61
|
+
load_bad_stubs
|
62
|
+
expect(device.profiles).to be_nil
|
58
63
|
end
|
59
64
|
end
|
60
65
|
|
61
66
|
describe "#add_profile" do
|
62
|
-
it "requires
|
67
|
+
it "requires a TenantIOSProfile" do
|
63
68
|
expect { device.add_profile('erm') }.to raise_error
|
64
69
|
end
|
65
70
|
|
66
71
|
it "calls MokiAPI.perform with the profile's install parameters" do
|
67
72
|
load_good_stubs
|
68
73
|
|
69
|
-
iosprofile =
|
74
|
+
iosprofile = TenantIOSProfile.from_hash(@iosprofiles_stub_response.first)
|
70
75
|
|
71
76
|
expect(MokiAPI).to receive(:perform_action).with(udid, iosprofile.install_hash)
|
72
77
|
.and_return(Hashie::Mash.new(value: { body: @action_stub_response }))
|
73
78
|
|
74
79
|
device.add_profile(iosprofile)
|
75
80
|
end
|
81
|
+
|
82
|
+
it "returns nil if the device was not found" do
|
83
|
+
load_bad_stubs
|
84
|
+
iosprofile = TenantIOSProfile.from_hash(@iosprofiles_stub_response.first)
|
85
|
+
expect(device.add_profile(iosprofile)).to be_nil
|
86
|
+
end
|
76
87
|
end
|
77
88
|
|
78
89
|
describe "#remove_profile" do
|
79
|
-
it "requires an
|
90
|
+
it "requires an DeviceIOSProfile" do
|
80
91
|
expect { device.remove_profile('erm') }.to raise_error
|
81
92
|
end
|
82
93
|
|
83
94
|
it "calls MokiAPI.perform with the profile's install parameters" do
|
84
95
|
load_good_stubs
|
85
96
|
|
86
|
-
iosprofile =
|
97
|
+
iosprofile = DeviceIOSProfile.from_hash(@device_iosprofiles_stub_response.first)
|
87
98
|
|
88
99
|
expect(MokiAPI).to receive(:perform_action).with(udid, iosprofile.removal_hash)
|
89
100
|
.and_return(Hashie::Mash.new(value: { body: @action_stub_response }))
|
90
101
|
|
91
102
|
device.remove_profile(iosprofile)
|
92
103
|
end
|
104
|
+
|
105
|
+
it "returns nil if the device was not found" do
|
106
|
+
load_bad_stubs
|
107
|
+
iosprofile = TenantIOSProfile.from_hash(@iosprofiles_stub_response.first)
|
108
|
+
expect(device.add_profile(iosprofile)).to be_nil
|
109
|
+
end
|
93
110
|
end
|
94
111
|
|
95
112
|
describe "#install_app" do
|
@@ -110,6 +127,11 @@ describe MokiRuby::Device do
|
|
110
127
|
.and_return(Hashie::Mash.new(value: { body: @action_stub_response }))
|
111
128
|
device.install_app(tenant_managed_app)
|
112
129
|
end
|
130
|
+
|
131
|
+
it "returns nil if the device was not found" do
|
132
|
+
load_bad_stubs
|
133
|
+
expect(device.install_app(TenantManagedApp.new)).to be_nil
|
134
|
+
end
|
113
135
|
end
|
114
136
|
|
115
137
|
describe "#managed_apps" do
|
@@ -124,6 +146,11 @@ describe MokiRuby::Device do
|
|
124
146
|
apps = device.managed_apps
|
125
147
|
expect(apps.map { |app| app.class }.uniq).to eq [DeviceManagedApp]
|
126
148
|
end
|
149
|
+
|
150
|
+
it "returns nil if the device was not found" do
|
151
|
+
load_bad_stubs
|
152
|
+
expect(device.managed_apps).to be_nil
|
153
|
+
end
|
127
154
|
end
|
128
155
|
|
129
156
|
describe "#get_action" do
|
@@ -139,5 +166,10 @@ describe MokiRuby::Device do
|
|
139
166
|
action = device.get_action(action_id)
|
140
167
|
expect(action).to be_kind_of(Action)
|
141
168
|
end
|
169
|
+
|
170
|
+
it "returns nil if the device was not found" do
|
171
|
+
load_bad_stubs
|
172
|
+
expect(device.get_action(action_id)).to be_nil
|
173
|
+
end
|
142
174
|
end
|
143
175
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
-
require 'moki_ruby/
|
2
|
+
require 'moki_ruby/tenant_iosprofile'
|
3
3
|
|
4
|
-
describe
|
4
|
+
describe TenantIOSProfile do
|
5
5
|
let(:response_hash) { { "id" => "01234699-5767-8abc-d123-ffffffffffff",
|
6
6
|
"lastSeen" => 1413913980475,
|
7
7
|
"name" => "Profile Name",
|
@@ -10,7 +10,7 @@ describe IOSProfile do
|
|
10
10
|
"identifier" => "abcdef12345-abc-123-ffeea.test" } }
|
11
11
|
|
12
12
|
it "will load from a hash with string keys" do
|
13
|
-
profile =
|
13
|
+
profile = TenantIOSProfile.from_hash(response_hash)
|
14
14
|
|
15
15
|
expect(profile.id).to eq(response_hash["id"])
|
16
16
|
expect(profile.last_seen).to eq(response_hash["lastSeen"])
|
@@ -21,7 +21,7 @@ describe IOSProfile do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "will convert the response to a hash" do
|
24
|
-
profile =
|
24
|
+
profile = TenantIOSProfile.new
|
25
25
|
profile.id = response_hash["id"]
|
26
26
|
profile.last_seen = response_hash["lastSeen"]
|
27
27
|
profile.name = response_hash["name"]
|
@@ -33,7 +33,7 @@ describe IOSProfile do
|
|
33
33
|
end
|
34
34
|
|
35
35
|
it "will return a hash for installing" do
|
36
|
-
profile =
|
36
|
+
profile = TenantIOSProfile.from_hash(response_hash)
|
37
37
|
expect(profile.install_hash).to eq({ "action" => "installprofile",
|
38
38
|
"thirdPartyUser" => "moki_ruby",
|
39
39
|
"clientName" => "MokiRuby",
|
@@ -43,7 +43,7 @@ describe IOSProfile do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "will return a hash for removal" do
|
46
|
-
profile =
|
46
|
+
profile = TenantIOSProfile.from_hash(response_hash)
|
47
47
|
expect(profile.removal_hash).to eq({ "action" => "removeprofile",
|
48
48
|
"thirdPartyUser" => "moki_ruby",
|
49
49
|
"clientName" => "MokiRuby",
|
data/spec/moki_ruby_spec.rb
CHANGED
@@ -19,11 +19,11 @@ describe MokiRuby do
|
|
19
19
|
expect { MokiRuby.iosprofiles }.to raise_error
|
20
20
|
end
|
21
21
|
|
22
|
-
it "retuns an array of
|
22
|
+
it "retuns an array of TenantIOSProfile objects" do
|
23
23
|
load_good_stubs
|
24
24
|
data = MokiRuby.ios_profiles
|
25
25
|
expect(data.count).to eq(4)
|
26
|
-
expect(data.first).to be_kind_of(
|
26
|
+
expect(data.first).to be_kind_of(TenantIOSProfile)
|
27
27
|
expect(data.first.name).to eq("Test Profile 1")
|
28
28
|
end
|
29
29
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
def
|
1
|
+
def load_base_stubs
|
2
2
|
@iosprofiles_stub_response = [{"id"=>"093b57ba-face-0100-4321-abcdef123456", "lastSeen"=>1413913980475, "name"=>"Test Profile 1", "displayName"=>"Test Profile 1", "description"=>"Test Profile 1", "identifier"=>"com.belly.a9a4129f-other01.TestProfile1"},
|
3
3
|
{"id"=>"4023fb77-face-0200-4321-abcdef123456", "lastSeen"=>1423528420218, "name"=>"Custom Profile", "displayName"=>"Custom Profile", "description"=>"Custom Profile", "identifier"=>nil},
|
4
4
|
{"id"=>"462d3468-face-0300-4321-abcdef123456", "lastSeen"=>1415637997309, "name"=>"Test Profile 3", "displayName"=>"Test Profile 3", "description"=>"Test Profile 3", "identifier"=>"com.belly.1e968fa0-other03.TestProfile3"},
|
@@ -14,6 +14,71 @@ def load_good_stubs
|
|
14
14
|
"action" => "removeprofile", "status" => "completed", "clientName" => "Web", "itemName" => "Profile Name",
|
15
15
|
"thirdPartyUser" => "itsmebro", "payload" => "{profile Identifier}", "note" => "test" }
|
16
16
|
|
17
|
+
@device_iosprofiles_stub_response =
|
18
|
+
[
|
19
|
+
{
|
20
|
+
"PayloadDisplayName" => "Belly Wifi",
|
21
|
+
"PayloadVersion" => "1",
|
22
|
+
"PayloadRemovalDisallowed" => "false",
|
23
|
+
"PayloadIdentifier" => "openvpn-client.openvpn.bellycard.com.033ABCDE-1234-5678-9AAA-C134AAAAAAAA",
|
24
|
+
"PayloadContent" => [
|
25
|
+
{
|
26
|
+
"PayloadDisplayName" => "WiFi",
|
27
|
+
"PayloadVersion" => "1",
|
28
|
+
"PayloadIdentifier" => "openvpn-client.openvpn.bellycard.com.033ABCDE-1234-5678-9AAA-C134AAAAAAAA.com.apple.wifi.managed.099999EE-ABCD-EF12-3456-7890ABCDEF99",
|
29
|
+
"PayloadDescription" => "Configures Wi-Fi settings",
|
30
|
+
"PayloadType" => "com.apple.wifi.managed"
|
31
|
+
}
|
32
|
+
]
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"PayloadDisplayName" => "Belly MDM Installation",
|
36
|
+
"PayloadVersion" => "1",
|
37
|
+
"PayloadOrganization" => "Belly Inc",
|
38
|
+
"PayloadRemovalDisallowed" => "false",
|
39
|
+
"PayloadDescription" => "Allow Belly Inc to track this device, including all apps.",
|
40
|
+
"PayloadIdentifier" => "com.belly.mdm",
|
41
|
+
"PayloadContent" => [
|
42
|
+
{
|
43
|
+
"PayloadDisplayName" => "Belly",
|
44
|
+
"PayloadVersion" => "1",
|
45
|
+
"PayloadOrganization" => "Belly Inc",
|
46
|
+
"PayloadIdentifier" => "com.belly.mdm.com.apple.security.pkcs12.00110334-abcd-efab-cdef-123412341234",
|
47
|
+
"PayloadDescription" => "Identifies the device to the MDM server using SSL client certificates",
|
48
|
+
"PayloadType" => "com.apple.security.pkcs12"
|
49
|
+
},
|
50
|
+
{
|
51
|
+
"PayloadDisplayName" => "Mobile Device Management",
|
52
|
+
"PayloadVersion" => "1",
|
53
|
+
"PayloadOrganization" => "Belly Inc",
|
54
|
+
"PayloadIdentifier" => "com.belly.mdm.com.apple.mdm.1a2b3c4d-5e6f-7a8b-9c0d-0987654321ba",
|
55
|
+
"PayloadDescription" => "Configuration for MDM",
|
56
|
+
"PayloadType" => "com.apple.mdm"
|
57
|
+
}
|
58
|
+
]
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"PayloadDisplayName" => "Belly",
|
62
|
+
"PayloadVersion" => "1",
|
63
|
+
"PayloadRemovalDisallowed" => "false",
|
64
|
+
"PayloadDescription" => "Configurator generated profile for supervised devices",
|
65
|
+
"PayloadIdentifier" => "com.apple.configurator.chaperoneprofile",
|
66
|
+
"PayloadContent" => [
|
67
|
+
{
|
68
|
+
"PayloadDisplayName" => "Belly",
|
69
|
+
"PayloadVersion" => "1",
|
70
|
+
"PayloadIdentifier" => "com.apple.configurator.chaperoneprofile.com.apple.security.root.00ABCD00-3456-9876-DEF0-ABABAB090909",
|
71
|
+
"PayloadDescription" => "Configures certificate settings.",
|
72
|
+
"PayloadType" => "com.apple.security.root"
|
73
|
+
}
|
74
|
+
]
|
75
|
+
}
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
def load_good_stubs
|
80
|
+
load_base_stubs
|
81
|
+
|
17
82
|
allow(MokiAPI).to receive_message_chain(:ios_profiles, :value).
|
18
83
|
and_return(Hashie::Mash.new({ body: @iosprofiles_stub_response,
|
19
84
|
status: 200,
|
@@ -39,3 +104,24 @@ def load_good_stubs
|
|
39
104
|
status: 200,
|
40
105
|
headers: {}}))
|
41
106
|
end
|
107
|
+
|
108
|
+
def load_bad_stubs
|
109
|
+
load_base_stubs
|
110
|
+
|
111
|
+
allow(MokiAPI).to receive_message_chain(:device_profile_list, :value).
|
112
|
+
and_return(Hashie::Mash.new({ body: { msg: "Device Not Found", status: 404 },
|
113
|
+
status: 404,
|
114
|
+
headers: {}}))
|
115
|
+
allow(MokiAPI).to receive_message_chain(:device_managed_app_list, :value).
|
116
|
+
and_return(Hashie::Mash.new({ body: { msg: "Device Not Found", status: 404 },
|
117
|
+
status: 404,
|
118
|
+
headers: {}}))
|
119
|
+
allow(MokiAPI).to receive_message_chain(:action, :value).
|
120
|
+
and_return(Hashie::Mash.new({ body: { msg: "Device Not Found", status: 404 },
|
121
|
+
status: 404,
|
122
|
+
headers: {}}))
|
123
|
+
allow(MokiAPI).to receive_message_chain(:perform_action, :value).
|
124
|
+
and_return(Hashie::Mash.new({ body: { msg: "Device Not Found", status: 404 },
|
125
|
+
status: 404,
|
126
|
+
headers: {}}))
|
127
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moki_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trey Springer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -168,18 +168,20 @@ files:
|
|
168
168
|
- lib/moki_ruby.rb
|
169
169
|
- lib/moki_ruby/action.rb
|
170
170
|
- lib/moki_ruby/device.rb
|
171
|
+
- lib/moki_ruby/device_iosprofile.rb
|
171
172
|
- lib/moki_ruby/device_managed_app.rb
|
172
173
|
- lib/moki_ruby/future_wrapper.rb
|
173
|
-
- lib/moki_ruby/iosprofile.rb
|
174
174
|
- lib/moki_ruby/moki_api.rb
|
175
|
+
- lib/moki_ruby/tenant_iosprofile.rb
|
175
176
|
- lib/moki_ruby/tenant_managed_app.rb
|
176
177
|
- lib/moki_ruby/version.rb
|
177
178
|
- moki_ruby.gemspec
|
178
179
|
- spec/lib/action_spec.rb
|
180
|
+
- spec/lib/device_iosprofile_spec.rb
|
179
181
|
- spec/lib/device_managed_app_spec.rb
|
180
182
|
- spec/lib/device_spec.rb
|
181
|
-
- spec/lib/iosprofile_spec.rb
|
182
183
|
- spec/lib/moki_api_spec.rb
|
184
|
+
- spec/lib/tenant_iosprofile_spec.rb
|
183
185
|
- spec/lib/tenant_managed_app_spec.rb
|
184
186
|
- spec/moki_ruby_spec.rb
|
185
187
|
- spec/spec_helper.rb
|
@@ -210,10 +212,11 @@ specification_version: 4
|
|
210
212
|
summary: A gem for interacting with the Moki Total Control API.
|
211
213
|
test_files:
|
212
214
|
- spec/lib/action_spec.rb
|
215
|
+
- spec/lib/device_iosprofile_spec.rb
|
213
216
|
- spec/lib/device_managed_app_spec.rb
|
214
217
|
- spec/lib/device_spec.rb
|
215
|
-
- spec/lib/iosprofile_spec.rb
|
216
218
|
- spec/lib/moki_api_spec.rb
|
219
|
+
- spec/lib/tenant_iosprofile_spec.rb
|
217
220
|
- spec/lib/tenant_managed_app_spec.rb
|
218
221
|
- spec/moki_ruby_spec.rb
|
219
222
|
- spec/spec_helper.rb
|