moki_ruby 0.0.1 → 0.0.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.
- checksums.yaml +4 -4
- data/README.md +40 -8
- data/lib/moki_api.rb +15 -16
- data/lib/moki_ruby.rb +3 -8
- data/lib/moki_ruby/action.rb +33 -0
- data/lib/moki_ruby/device.rb +70 -0
- data/lib/moki_ruby/device_managed_app.rb +5 -5
- data/lib/moki_ruby/iosprofile.rb +35 -9
- data/lib/moki_ruby/tenant_managed_app.rb +56 -0
- data/lib/moki_ruby/version.rb +1 -1
- data/spec/lib/action_spec.rb +48 -0
- data/spec/lib/device_managed_app_spec.rb +4 -7
- data/spec/lib/device_spec.rb +143 -0
- data/spec/lib/iosprofile_spec.rb +34 -8
- data/spec/lib/moki_api_spec.rb +30 -20
- data/spec/lib/tenant_managed_app_spec.rb +86 -0
- data/spec/moki_ruby_spec.rb +6 -50
- data/spec/support/common_stubs.rb +17 -0
- metadata +11 -5
- data/lib/moki_ruby/device_identifier.rb +0 -9
- data/spec/lib/device_identifier_spec.rb +0 -19
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0a94a38cb0b659e29af3ca6bc390e3b9cb78dd4
|
4
|
+
data.tar.gz: 0209ee2b6262b17e228d0ba671672c92400af57a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82bc152c026cfe0a9fe5333c2a7b58da1ff675d73c787c84ea2a48b4eb7afabff579797057fdf51db81b07b38df11b9e57306602b5850b4cb01a016ab167dd7e
|
7
|
+
data.tar.gz: ca891aa084ef3673b5b34275228ac2b8424550d3dca0112468ef2e2f3197de0514b1d448f87e8802fd039df15dc2378296a8c679479225c93aed6fbed44fad2a
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# MokiRuby
|
2
2
|
|
3
|
-
[](https://travis-ci.org/bellycard/moki_ruby)
|
3
|
+
[](https://travis-ci.org/bellycard/moki_ruby) [](http://badge.fury.io/rb/moki_ruby)
|
4
5
|
|
5
6
|
A ruby gem for interacting with the Moki API, as a part of Moki Total
|
6
7
|
Control and Moki Management.
|
@@ -19,8 +20,6 @@ Or install it yourself as:
|
|
19
20
|
|
20
21
|
$ gem install moki_ruby
|
21
22
|
|
22
|
-
## Usage
|
23
|
-
|
24
23
|
Make sure to set the following environment variables:
|
25
24
|
|
26
25
|
```
|
@@ -29,13 +28,46 @@ ENV['MOKI_TENANT_ID']
|
|
29
28
|
ENV['MOKI_API_KEY']
|
30
29
|
```
|
31
30
|
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
Device management can be done at the Tenant Level (across all devices)
|
34
|
+
or at the individual device level.
|
35
|
+
|
36
|
+
### Tenant Methods
|
37
|
+
|
32
38
|
The following methods have been built out:
|
33
39
|
|
34
|
-
- `MokiRuby.ios_profiles` asks for all current profiles associated with this
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
40
|
+
- `MokiRuby.ios_profiles` asks for all current profiles associated with this
|
41
|
+
tenant. This will return an array of `IOSProfile` objects.
|
42
|
+
- `MokiRuby.tenant_managed_apps` asks for all apps associaited with this
|
43
|
+
tenant. This will return an array of `TenantManagedApp` objects.
|
44
|
+
|
45
|
+
### Device Methods
|
46
|
+
|
47
|
+
First, create a device through one of the following approaches:
|
48
|
+
|
49
|
+
```
|
50
|
+
MokiRuby::Device.new(serial_number)
|
51
|
+
MokiRuby::Device.new(udid)
|
52
|
+
```
|
53
|
+
|
54
|
+
Using this device, there are several methods available:
|
55
|
+
|
56
|
+
- `device.profiles` returns all profiles currently installed on a
|
57
|
+
device. This will return an array of `IOSProfile` objects.
|
58
|
+
- `device.managed_apps` returns all managed applications installed on a
|
59
|
+
device. This will return an array of `DeviceManagedApp` objects.
|
60
|
+
- `device.install_app(app)` takes in a `TenantManagedApp` object, and
|
61
|
+
will install the given application on the device. Returns an
|
62
|
+
`Action` object, for tracking in the future.
|
63
|
+
- `device.add_profile(profile)` takes in an `IOSProfile` object, and
|
64
|
+
will install the given profile on the device. Returns an `Action`
|
65
|
+
object, for tracking in the future.
|
66
|
+
- `device.remove_profile(profile)` take in an `IOSProfile` object, and
|
67
|
+
will remove the given profile from the device. Returns an `Action`
|
68
|
+
object, for tracking in the future.
|
69
|
+
- `device.get_action(action_id)` will take in an `id` from an `Action`
|
70
|
+
object, and return an updated `Action` object.
|
39
71
|
|
40
72
|
## Contributing
|
41
73
|
|
data/lib/moki_api.rb
CHANGED
@@ -3,7 +3,6 @@ require 'faraday_middleware'
|
|
3
3
|
require 'celluloid/io'
|
4
4
|
require 'future_wrapper'
|
5
5
|
require 'hashie'
|
6
|
-
require 'moki_ruby/device_identifier'
|
7
6
|
|
8
7
|
class MokiAPI
|
9
8
|
include Celluloid::IO
|
@@ -14,23 +13,23 @@ class MokiAPI
|
|
14
13
|
end
|
15
14
|
|
16
15
|
def self.device_profile_list(device_id)
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
raise "Must pass a serial number or UDID to get device profile list"
|
23
|
-
end
|
16
|
+
issue_request(:get, full_url("/devices/#{ device_id }/profiles"), {})
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.tenant_managed_app_list
|
20
|
+
issue_request(:get, full_url('/iosmanagedapps'), {})
|
24
21
|
end
|
25
22
|
|
26
23
|
def self.device_managed_app_list(device_id)
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
24
|
+
issue_request(:get, full_url("/devices/#{ device_id }/managedapps"), {})
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.perform_action(device_id, body_hash)
|
28
|
+
issue_request(:put, full_url("/devices/#{ device_id }/actions"), body_hash)
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.action(device_id, action_id)
|
32
|
+
issue_request(:get, full_url("/devices/#{ device_id }/actions/#{ action_id }"), {})
|
34
33
|
end
|
35
34
|
|
36
35
|
def self.full_url(path)
|
@@ -74,7 +73,7 @@ private
|
|
74
73
|
status: response.status,
|
75
74
|
headers: response.headers
|
76
75
|
})
|
77
|
-
rescue
|
76
|
+
rescue
|
78
77
|
response
|
79
78
|
end
|
80
79
|
end
|
data/lib/moki_ruby.rb
CHANGED
@@ -6,13 +6,8 @@ module MokiRuby
|
|
6
6
|
data.body.map { |profile| IOSProfile.from_hash(profile) }
|
7
7
|
end
|
8
8
|
|
9
|
-
def self.
|
10
|
-
data = MokiAPI.
|
11
|
-
data.body.map { |profile|
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.device_managed_apps(device_id)
|
15
|
-
data = MokiAPI.device_managed_app_list(device_id).value
|
16
|
-
data.body.map { |app| DeviceManagedApp.from_hash(app) }
|
9
|
+
def self.tenant_managed_apps
|
10
|
+
data = MokiAPI.tenant_managed_app_list.value
|
11
|
+
data.body.map { |profile| TenantManagedApp.from_hash(profile) }
|
17
12
|
end
|
18
13
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
class Action
|
2
|
+
attr_accessor :id, :last_seen, :action, :status, :client_name, :item_name, :third_party_user, :payload, :note
|
3
|
+
|
4
|
+
def self.from_hash(input_hash)
|
5
|
+
new_action = self.new
|
6
|
+
|
7
|
+
new_action.id = input_hash["id"]
|
8
|
+
new_action.last_seen = input_hash["lastSeen"]
|
9
|
+
new_action.action = input_hash["action"]
|
10
|
+
new_action.status = input_hash["status"]
|
11
|
+
new_action.client_name = input_hash["clientName"]
|
12
|
+
new_action.item_name = input_hash["itemName"]
|
13
|
+
new_action.third_party_user = input_hash["thirdPartyUser"]
|
14
|
+
new_action.payload = input_hash["payload"]
|
15
|
+
new_action.note = input_hash["note"]
|
16
|
+
|
17
|
+
new_action
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_hash
|
21
|
+
{
|
22
|
+
"id" => self.id,
|
23
|
+
"lastSeen" => self.last_seen,
|
24
|
+
"action" => self.action,
|
25
|
+
"status" => self.status,
|
26
|
+
"clientName" => self.client_name,
|
27
|
+
"itemName" => self.item_name,
|
28
|
+
"thirdPartyUser" => self.third_party_user,
|
29
|
+
"payload" => self.payload,
|
30
|
+
"note" => self.note
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module MokiRuby
|
2
|
+
class Device
|
3
|
+
attr :id, :identifier_type
|
4
|
+
|
5
|
+
def initialize(identifier)
|
6
|
+
if is_serial?(identifier)
|
7
|
+
@identifier_type = :serial
|
8
|
+
elsif is_udid?(identifier)
|
9
|
+
@identifier_type = :udid
|
10
|
+
else
|
11
|
+
raise "Valid UDID or Serial Number required"
|
12
|
+
end
|
13
|
+
@id = identifier
|
14
|
+
end
|
15
|
+
|
16
|
+
def profiles
|
17
|
+
data = MokiAPI.device_profile_list(device_id_param).value
|
18
|
+
data.body.map { |profile| IOSProfile.from_hash(profile) }
|
19
|
+
end
|
20
|
+
|
21
|
+
def managed_apps
|
22
|
+
data = MokiAPI.device_managed_app_list(device_id_param).value
|
23
|
+
data.body.map { |app| DeviceManagedApp.from_hash(app) }
|
24
|
+
end
|
25
|
+
|
26
|
+
def install_app(tenant_managed_app)
|
27
|
+
raise "Tenant Managed App required" unless tenant_managed_app && tenant_managed_app.kind_of?(TenantManagedApp)
|
28
|
+
|
29
|
+
data = MokiAPI.perform_action(device_id_param, tenant_managed_app.install_hash).value
|
30
|
+
Action.from_hash(data.body)
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_profile(profile)
|
34
|
+
raise "IOSProfile required" unless profile && profile.is_a?(IOSProfile)
|
35
|
+
|
36
|
+
data = MokiAPI.perform_action(device_id_param, profile.install_hash).value
|
37
|
+
Action.from_hash(data.body)
|
38
|
+
end
|
39
|
+
|
40
|
+
def remove_profile(profile)
|
41
|
+
raise "IOSProfile required" unless profile && profile.is_a?(IOSProfile)
|
42
|
+
|
43
|
+
data = MokiAPI.perform_action(device_id_param, profile.removal_hash).value
|
44
|
+
Action.from_hash(data.body)
|
45
|
+
end
|
46
|
+
|
47
|
+
def get_action(action_id)
|
48
|
+
data = MokiAPI.action(device_id_param, action_id).value
|
49
|
+
Action.from_hash(data.body)
|
50
|
+
end
|
51
|
+
|
52
|
+
def device_id_param
|
53
|
+
if identifier_type == :serial
|
54
|
+
"sn-!-#{ id }"
|
55
|
+
else
|
56
|
+
id
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def is_serial?(id)
|
63
|
+
(!id.nil? && id.length == 12)
|
64
|
+
end
|
65
|
+
|
66
|
+
def is_udid?(id)
|
67
|
+
!(/\A[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\Z/.match(id)).nil?
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -2,12 +2,12 @@ class DeviceManagedApp
|
|
2
2
|
attr_accessor :status, :app_identifier, :management_flags
|
3
3
|
|
4
4
|
def self.from_hash(input_hash)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
new_app = self.new
|
6
|
+
new_app.status = input_hash['Status']
|
7
|
+
new_app.app_identifier = input_hash['appIdentifier']
|
8
|
+
new_app.management_flags = input_hash['ManagementFlags']
|
9
9
|
|
10
|
-
|
10
|
+
new_app
|
11
11
|
end
|
12
12
|
|
13
13
|
def to_hash
|
data/lib/moki_ruby/iosprofile.rb
CHANGED
@@ -1,20 +1,46 @@
|
|
1
1
|
class IOSProfile
|
2
|
-
attr_accessor :id, :
|
2
|
+
attr_accessor :id, :last_seen, :name, :display_name, :description, :identifier
|
3
3
|
|
4
4
|
def self.from_hash(input_hash)
|
5
5
|
new_profile = self.new
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
new_profile.id = input_hash["id"]
|
7
|
+
new_profile.last_seen = input_hash["lastSeen"]
|
8
|
+
new_profile.name = input_hash["name"]
|
9
|
+
new_profile.display_name = input_hash["displayName"]
|
10
|
+
new_profile.description = input_hash["description"]
|
11
|
+
new_profile.identifier = input_hash["identifier"]
|
9
12
|
|
10
13
|
new_profile
|
11
14
|
end
|
12
15
|
|
13
16
|
def to_hash
|
14
|
-
{
|
15
|
-
self.
|
16
|
-
|
17
|
-
|
18
|
-
|
17
|
+
{
|
18
|
+
"id" => self.id,
|
19
|
+
"lastSeen" => self.last_seen,
|
20
|
+
"name" => self.name,
|
21
|
+
"displayName" => self.display_name,
|
22
|
+
"description" => self.description,
|
23
|
+
"identifier" => self.identifier
|
24
|
+
}
|
25
|
+
end
|
26
|
+
|
27
|
+
def install_hash
|
28
|
+
actionable_hash.merge({ "action" => "installprofile",
|
29
|
+
"payload" => "{#{ self.id }}" })
|
30
|
+
end
|
31
|
+
|
32
|
+
def removal_hash
|
33
|
+
actionable_hash.merge({ "action" => "removeprofile",
|
34
|
+
"payload" => "{#{ self.identifier }}" })
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
def actionable_hash
|
39
|
+
{
|
40
|
+
"thirdPartyUser" => "moki_ruby",
|
41
|
+
"clientName" => "MokiRuby",
|
42
|
+
"itemName" => self.name,
|
43
|
+
"notify" => true
|
44
|
+
}
|
19
45
|
end
|
20
46
|
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
class TenantManagedApp
|
2
|
+
attr_accessor :id, :last_seen, :name, :identifier, :version,
|
3
|
+
:management_flags, :itunes_store_id, :manifest_url
|
4
|
+
|
5
|
+
def self.from_hash(input_hash)
|
6
|
+
new_app = self.new
|
7
|
+
new_app.id = input_hash["id"]
|
8
|
+
new_app.last_seen = input_hash["lastSeen"]
|
9
|
+
new_app.name = input_hash["name"]
|
10
|
+
new_app.identifier = input_hash["identifier"]
|
11
|
+
new_app.version = input_hash["version"]
|
12
|
+
new_app.management_flags = input_hash["ManagementFlags"]
|
13
|
+
new_app.itunes_store_id = input_hash["iTunesStoreID"]
|
14
|
+
new_app.manifest_url = input_hash["ManifestURL"]
|
15
|
+
|
16
|
+
new_app
|
17
|
+
end
|
18
|
+
|
19
|
+
def to_hash
|
20
|
+
{ "id" => self.id,
|
21
|
+
"lastSeen" => self.last_seen,
|
22
|
+
"name" => self.name,
|
23
|
+
"identifier" => self.identifier,
|
24
|
+
"version" => self.version,
|
25
|
+
"ManagementFlags" => self.management_flags,
|
26
|
+
"iTunesStoreID" => self.itunes_store_id,
|
27
|
+
"ManifestURL" => self.manifest_url }
|
28
|
+
end
|
29
|
+
|
30
|
+
def install_hash
|
31
|
+
{
|
32
|
+
"action" => "install_app",
|
33
|
+
"thirdPartyUser" => "moki_ruby",
|
34
|
+
"clientName" => "MokiRuby",
|
35
|
+
"itemName" => self.name,
|
36
|
+
"notify" => true,
|
37
|
+
"payload" => {
|
38
|
+
"ManagementFlags" => self.management_flag,
|
39
|
+
"identifier" => self.identifier,
|
40
|
+
"version" => self.version
|
41
|
+
}.merge(self.external_locator_hash)
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
45
|
+
def management_flag
|
46
|
+
(!manifest_url.nil? && manifest_url != "") ? 1 : 0
|
47
|
+
end
|
48
|
+
|
49
|
+
def external_locator_hash
|
50
|
+
if manifest_url && manifest_url != ""
|
51
|
+
{ "ManifestURL" => manifest_url }
|
52
|
+
else
|
53
|
+
{ "iTunesStoreID" => itunes_store_id }
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
data/lib/moki_ruby/version.rb
CHANGED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'moki_ruby/action'
|
3
|
+
|
4
|
+
describe Action do
|
5
|
+
let(:response_hash) {
|
6
|
+
{
|
7
|
+
"id" => "b4d71a15183b4971a3bdd139754a40fe",
|
8
|
+
"lastSeen" => 1420583405416,
|
9
|
+
"action" => "removeprofile",
|
10
|
+
"status" => "completed",
|
11
|
+
"clientName" => "Web",
|
12
|
+
"itemName" => "Profile Name",
|
13
|
+
"thirdPartyUser" => "itsmebro",
|
14
|
+
"payload" => "{profile Identifier}",
|
15
|
+
"note" => "test"
|
16
|
+
}
|
17
|
+
}
|
18
|
+
|
19
|
+
it "will load from a hash with string keys" do
|
20
|
+
action = Action.from_hash(response_hash)
|
21
|
+
|
22
|
+
expect(action.id).to eq response_hash["id"]
|
23
|
+
expect(action.last_seen).to eq response_hash["lastSeen"]
|
24
|
+
expect(action.action).to eq response_hash["action"]
|
25
|
+
expect(action.status).to eq response_hash["status"]
|
26
|
+
expect(action.client_name).to eq response_hash["clientName"]
|
27
|
+
expect(action.item_name).to eq response_hash["itemName"]
|
28
|
+
expect(action.third_party_user).to eq response_hash["thirdPartyUser"]
|
29
|
+
expect(action.payload).to eq response_hash["payload"]
|
30
|
+
expect(action.note).to eq response_hash["note"]
|
31
|
+
end
|
32
|
+
|
33
|
+
it "will convert the response to a hash" do
|
34
|
+
action = Action.new
|
35
|
+
|
36
|
+
action.id = response_hash["id"]
|
37
|
+
action.last_seen = response_hash["lastSeen"]
|
38
|
+
action.action = response_hash["action"]
|
39
|
+
action.status = response_hash["status"]
|
40
|
+
action.client_name = response_hash["clientName"]
|
41
|
+
action.item_name = response_hash["itemName"]
|
42
|
+
action.third_party_user = response_hash["thirdPartyUser"]
|
43
|
+
action.payload = response_hash["payload"]
|
44
|
+
action.note = response_hash["note"]
|
45
|
+
|
46
|
+
expect(action.to_hash).to eq(response_hash)
|
47
|
+
end
|
48
|
+
end
|
@@ -6,8 +6,6 @@ describe DeviceManagedApp do
|
|
6
6
|
"appIdentifier" => "com.belly.gem.moki.enterprise",
|
7
7
|
"ManagementFlags" => 0 } }
|
8
8
|
|
9
|
-
let(:attrs) { %w(Status appIdentifier ManagementFlags) }
|
10
|
-
|
11
9
|
it "will load from a hash with string keys" do
|
12
10
|
profile = DeviceManagedApp.from_hash(response_hash)
|
13
11
|
expect(profile.status).to eq(response_hash["Status"])
|
@@ -17,11 +15,10 @@ describe DeviceManagedApp do
|
|
17
15
|
|
18
16
|
it "will convert the response to a hash" do
|
19
17
|
profile = DeviceManagedApp.new
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
end
|
18
|
+
profile.status = "Managed"
|
19
|
+
profile.app_identifier = "com.belly.gem.moki.enterprise"
|
20
|
+
profile.management_flags = 0
|
21
|
+
|
25
22
|
expect(profile.to_hash).to eq(response_hash)
|
26
23
|
end
|
27
24
|
end
|
@@ -0,0 +1,143 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'moki_ruby/device'
|
3
|
+
|
4
|
+
describe MokiRuby::Device do
|
5
|
+
let(:sn) { "ABCDEFGHIJ12" }
|
6
|
+
let(:udid) { "abcd1234-1234-1234-1234-abcdef123456" }
|
7
|
+
let(:device) { MokiRuby::Device.new(udid) }
|
8
|
+
|
9
|
+
describe 'initialization' do
|
10
|
+
context "with serial number" do
|
11
|
+
it "is valid" do
|
12
|
+
device = MokiRuby::Device.new(sn)
|
13
|
+
expect(device.id).to eq sn
|
14
|
+
expect(device.identifier_type).to eq :serial
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context "with UDID" do
|
19
|
+
it "is valid" do
|
20
|
+
device = MokiRuby::Device.new(udid)
|
21
|
+
expect(device.id).to eq udid
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
context "with invalid identifier" do
|
26
|
+
it "is invalid" do
|
27
|
+
expect{ MokiRuby::Device.new() }.to raise_error
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "#device_id_param" do
|
33
|
+
describe "Serial Number" do
|
34
|
+
it "prepends serial number data" do
|
35
|
+
device = MokiRuby::Device.new(sn)
|
36
|
+
expect(device.device_id_param).to eq "sn-!-#{ sn }"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "UDID" do
|
41
|
+
it "prepends serial number data" do
|
42
|
+
device = MokiRuby::Device.new(udid)
|
43
|
+
expect(device.device_id_param).to eq udid
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
describe "#profiles" do
|
49
|
+
it "calls MokiAPI.device_profile_list with correct params" do
|
50
|
+
expect(MokiAPI).to receive_message_chain(:device_profile_list, :value).and_return(Hashie::Mash.new({ body: [] }))
|
51
|
+
device.profiles
|
52
|
+
end
|
53
|
+
|
54
|
+
it "returns an array of device profiles" do
|
55
|
+
load_good_stubs
|
56
|
+
profiles = device.profiles
|
57
|
+
expect(profiles.map { |p| p.class }.uniq).to eq [IOSProfile]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe "#add_profile" do
|
62
|
+
it "requires an IOSProfile" do
|
63
|
+
expect { device.add_profile('erm') }.to raise_error
|
64
|
+
end
|
65
|
+
|
66
|
+
it "calls MokiAPI.perform with the profile's install parameters" do
|
67
|
+
load_good_stubs
|
68
|
+
|
69
|
+
iosprofile = IOSProfile.from_hash(@iosprofiles_stub_response.first)
|
70
|
+
|
71
|
+
expect(MokiAPI).to receive(:perform_action).with(udid, iosprofile.install_hash)
|
72
|
+
.and_return(Hashie::Mash.new(value: { body: @action_stub_response }))
|
73
|
+
|
74
|
+
device.add_profile(iosprofile)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
describe "#remove_profile" do
|
79
|
+
it "requires an IOSProfile" do
|
80
|
+
expect { device.remove_profile('erm') }.to raise_error
|
81
|
+
end
|
82
|
+
|
83
|
+
it "calls MokiAPI.perform with the profile's install parameters" do
|
84
|
+
load_good_stubs
|
85
|
+
|
86
|
+
iosprofile = IOSProfile.from_hash(@iosprofiles_stub_response.first)
|
87
|
+
|
88
|
+
expect(MokiAPI).to receive(:perform_action).with(udid, iosprofile.removal_hash)
|
89
|
+
.and_return(Hashie::Mash.new(value: { body: @action_stub_response }))
|
90
|
+
|
91
|
+
device.remove_profile(iosprofile)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "#install_app" do
|
96
|
+
it "requires a TenantManagedApp" do
|
97
|
+
expect { device.install_app('foo') }.to raise_error
|
98
|
+
end
|
99
|
+
|
100
|
+
it "calls MokiAPI.perform with store app parameters" do
|
101
|
+
load_good_stubs
|
102
|
+
|
103
|
+
tenant_managed_app = TenantManagedApp.from_hash({ "name" => "MokiTouch 2.0",
|
104
|
+
"identifier" => "com.mokimobility.mokitouch2",
|
105
|
+
"version" => "1.1.1",
|
106
|
+
"ManagementFlags" => 0,
|
107
|
+
"ManifestURL" => "some url" })
|
108
|
+
|
109
|
+
expect(MokiAPI).to receive(:perform_action).with(udid, tenant_managed_app.install_hash)
|
110
|
+
.and_return(Hashie::Mash.new(value: { body: @action_stub_response }))
|
111
|
+
device.install_app(tenant_managed_app)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
|
115
|
+
describe "#managed_apps" do
|
116
|
+
it "calls MokiAPI.device_managed_app_list" do
|
117
|
+
response = []
|
118
|
+
expect(MokiAPI).to receive_message_chain(:device_managed_app_list, :value).and_return(Hashie::Mash.new({ body: response, status: 200, headers: {} }))
|
119
|
+
device.managed_apps
|
120
|
+
end
|
121
|
+
|
122
|
+
it "returns an array of managed_apps" do
|
123
|
+
load_good_stubs
|
124
|
+
apps = device.managed_apps
|
125
|
+
expect(apps.map { |app| app.class }.uniq).to eq [DeviceManagedApp]
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
describe "#get_action" do
|
130
|
+
let(:action_id) { "b4d71a15183b4971a3bdd139754a40fe" }
|
131
|
+
|
132
|
+
it "calls MokiAPI.action" do
|
133
|
+
expect(MokiAPI).to receive_message_chain(:action, :value).and_return(Hashie::Mash.new({ body: {}, status: 200, headers: {} }))
|
134
|
+
device.get_action(action_id)
|
135
|
+
end
|
136
|
+
|
137
|
+
it "returns an Action object" do
|
138
|
+
load_good_stubs
|
139
|
+
action = device.get_action(action_id)
|
140
|
+
expect(action).to be_kind_of(Action)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
end
|
data/spec/lib/iosprofile_spec.rb
CHANGED
@@ -9,20 +9,46 @@ describe IOSProfile do
|
|
9
9
|
"description" => "Profile Description",
|
10
10
|
"identifier" => "abcdef12345-abc-123-ffeea.test" } }
|
11
11
|
|
12
|
-
let(:attrs) { %w(id lastSeen name displayName description identifier) }
|
13
|
-
|
14
12
|
it "will load from a hash with string keys" do
|
15
13
|
profile = IOSProfile.from_hash(response_hash)
|
16
|
-
|
17
|
-
|
18
|
-
|
14
|
+
|
15
|
+
expect(profile.id).to eq(response_hash["id"])
|
16
|
+
expect(profile.last_seen).to eq(response_hash["lastSeen"])
|
17
|
+
expect(profile.name).to eq(response_hash["name"])
|
18
|
+
expect(profile.display_name).to eq(response_hash["displayName"])
|
19
|
+
expect(profile.description).to eq(response_hash["description"])
|
20
|
+
expect(profile.identifier).to eq(response_hash["identifier"])
|
19
21
|
end
|
20
22
|
|
21
23
|
it "will convert the response to a hash" do
|
22
24
|
profile = IOSProfile.new
|
23
|
-
|
24
|
-
|
25
|
-
|
25
|
+
profile.id = response_hash["id"]
|
26
|
+
profile.last_seen = response_hash["lastSeen"]
|
27
|
+
profile.name = response_hash["name"]
|
28
|
+
profile.display_name = response_hash["displayName"]
|
29
|
+
profile.description = response_hash["description"]
|
30
|
+
profile.identifier = response_hash["identifier"]
|
31
|
+
|
26
32
|
expect(profile.to_hash).to eq(response_hash)
|
27
33
|
end
|
34
|
+
|
35
|
+
it "will return a hash for installing" do
|
36
|
+
profile = IOSProfile.from_hash(response_hash)
|
37
|
+
expect(profile.install_hash).to eq({ "action" => "installprofile",
|
38
|
+
"thirdPartyUser" => "moki_ruby",
|
39
|
+
"clientName" => "MokiRuby",
|
40
|
+
"itemName" => "Profile Name",
|
41
|
+
"notify" => true,
|
42
|
+
"payload" => "{01234699-5767-8abc-d123-ffffffffffff}" })
|
43
|
+
end
|
44
|
+
|
45
|
+
it "will return a hash for removal" do
|
46
|
+
profile = IOSProfile.from_hash(response_hash)
|
47
|
+
expect(profile.removal_hash).to eq({ "action" => "removeprofile",
|
48
|
+
"thirdPartyUser" => "moki_ruby",
|
49
|
+
"clientName" => "MokiRuby",
|
50
|
+
"itemName" => "Profile Name",
|
51
|
+
"notify" => true,
|
52
|
+
"payload" => "{abcdef12345-abc-123-ffeea.test}" })
|
53
|
+
end
|
28
54
|
end
|
data/spec/lib/moki_api_spec.rb
CHANGED
@@ -41,24 +41,13 @@ describe MokiAPI do
|
|
41
41
|
end
|
42
42
|
|
43
43
|
describe "device profile list" do
|
44
|
-
it '
|
45
|
-
|
46
|
-
expect(method).to eq(:get)
|
47
|
-
expect(url).to eq("http://localhost:9292/rest/v1/api/tenants/#{ ENV['MOKI_TENANT_ID'] }/devices/abcd1234-1234-1234-1234-abcdef123456/profiles")
|
48
|
-
}.and_return('{}')
|
49
|
-
MokiAPI.device_profile_list("abcd1234-1234-1234-1234-abcdef123456")
|
50
|
-
end
|
51
|
-
|
52
|
-
it 'hits the endpoint correctly with a serial number' do
|
44
|
+
it 'issues a get request using device parameter' do
|
45
|
+
param = "sn-!-ABCDEFGHIJ12"
|
53
46
|
expect(MokiAPI).to receive(:issue_request) { |method, url, options|
|
54
47
|
expect(method).to eq(:get)
|
55
|
-
expect(url).to eq("http://localhost:9292/rest/v1/api/tenants/#{ ENV['MOKI_TENANT_ID'] }/devices/
|
48
|
+
expect(url).to eq("http://localhost:9292/rest/v1/api/tenants/#{ ENV['MOKI_TENANT_ID'] }/devices/#{ param }/profiles")
|
56
49
|
}.and_return('{}')
|
57
|
-
MokiAPI.device_profile_list(
|
58
|
-
end
|
59
|
-
|
60
|
-
it 'raises an error if not given a serial or udid' do
|
61
|
-
expect { MokiAPI.device_profile_list("ermishness-nope") }.to raise_error
|
50
|
+
MokiAPI.device_profile_list(param)
|
62
51
|
end
|
63
52
|
end
|
64
53
|
|
@@ -70,17 +59,38 @@ describe MokiAPI do
|
|
70
59
|
}.and_return('{}')
|
71
60
|
MokiAPI.device_managed_app_list("abcd1234-1234-1234-1234-abcdef123456")
|
72
61
|
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "action" do
|
65
|
+
let(:action_id) { "b4d71a15183b4971a3bdd139754a40fe" }
|
73
66
|
|
74
|
-
it 'hits the endpoint correctly with a
|
67
|
+
it 'hits the endpoint correctly with a Device ID and Action id' do
|
75
68
|
expect(MokiAPI).to receive(:issue_request) { |method, url, options|
|
76
69
|
expect(method).to eq(:get)
|
77
|
-
expect(url).to eq("http://localhost:9292/rest/v1/api/tenants/#{ ENV['MOKI_TENANT_ID'] }/devices/
|
70
|
+
expect(url).to eq("http://localhost:9292/rest/v1/api/tenants/#{ ENV['MOKI_TENANT_ID'] }/devices/abcd1234-1234-1234-1234-abcdef123456/actions/#{action_id}")
|
78
71
|
}.and_return('{}')
|
79
|
-
MokiAPI.
|
72
|
+
MokiAPI.action("abcd1234-1234-1234-1234-abcdef123456", "b4d71a15183b4971a3bdd139754a40fe")
|
80
73
|
end
|
74
|
+
end
|
75
|
+
|
76
|
+
it 'hits the iosprofiles endpoint correctly' do
|
77
|
+
expect(MokiAPI).to receive(:issue_request) { |method, url, options|
|
78
|
+
expect(method).to eq(:get)
|
79
|
+
expect(url).to eq("http://localhost:9292/rest/v1/api/tenants/#{ ENV['MOKI_TENANT_ID'] }/iosmanagedapps")
|
80
|
+
}.and_return('{}')
|
81
|
+
MokiAPI.tenant_managed_app_list
|
82
|
+
end
|
83
|
+
|
84
|
+
describe "perform action" do
|
85
|
+
it 'performs put request to action endpoint with provided parameters' do
|
86
|
+
body_hash = { foo: 'bar' }
|
87
|
+
expect(MokiAPI).to receive(:issue_request) { |method, url, options|
|
88
|
+
expect(method).to eq(:put)
|
89
|
+
expect(url).to eq("http://localhost:9292/rest/v1/api/tenants/#{ ENV['MOKI_TENANT_ID'] }/devices/abcd1234-1234-1234-1234-abcdef123456/actions")
|
90
|
+
expect(options).to eq body_hash
|
91
|
+
}.and_return('{}')
|
81
92
|
|
82
|
-
|
83
|
-
expect { MokiAPI.device_managed_app_list("ermishness-nope") }.to raise_error
|
93
|
+
MokiAPI.perform_action('abcd1234-1234-1234-1234-abcdef123456', body_hash)
|
84
94
|
end
|
85
95
|
end
|
86
96
|
end
|
@@ -0,0 +1,86 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'moki_ruby/tenant_managed_app'
|
3
|
+
|
4
|
+
describe TenantManagedApp do
|
5
|
+
let(:response_hash) { { "id" => "30dedb7062a941b8b5f0c960d7d8f79a",
|
6
|
+
"lastSeen" => 1384278494336,
|
7
|
+
"name" => "MokiTouch 2.0",
|
8
|
+
"identifier" => "com.mokimobility.mokitouch2",
|
9
|
+
"version" => "1.1.1",
|
10
|
+
"ManagementFlags" => 0,
|
11
|
+
"iTunesStoreID" => "733151730",
|
12
|
+
"ManifestURL" => "http://www.mokimanage.com/app" } }
|
13
|
+
|
14
|
+
it "will load from a hash with string keys" do
|
15
|
+
app = TenantManagedApp.from_hash(response_hash)
|
16
|
+
expect(app.id).to eq(response_hash["id"])
|
17
|
+
expect(app.last_seen).to eq(response_hash["lastSeen"])
|
18
|
+
expect(app.name).to eq(response_hash["name"])
|
19
|
+
expect(app.identifier).to eq(response_hash["identifier"])
|
20
|
+
expect(app.version).to eq(response_hash["version"])
|
21
|
+
expect(app.management_flags).to eq(response_hash["ManagementFlags"])
|
22
|
+
expect(app.itunes_store_id).to eq(response_hash["iTunesStoreID"])
|
23
|
+
expect(app.manifest_url).to eq(response_hash["ManifestURL"])
|
24
|
+
end
|
25
|
+
|
26
|
+
it "will convert the response to a hash" do
|
27
|
+
app = TenantManagedApp.new
|
28
|
+
app.id = "30dedb7062a941b8b5f0c960d7d8f79a"
|
29
|
+
app.last_seen = 1384278494336
|
30
|
+
app.name = "MokiTouch 2.0"
|
31
|
+
app.identifier = "com.mokimobility.mokitouch2"
|
32
|
+
app.version = "1.1.1"
|
33
|
+
app.management_flags = 0
|
34
|
+
app.itunes_store_id = "733151730"
|
35
|
+
app.manifest_url = "http://www.mokimanage.com/app"
|
36
|
+
|
37
|
+
expect(app.to_hash).to eq(response_hash)
|
38
|
+
end
|
39
|
+
|
40
|
+
describe "management_flag" do
|
41
|
+
it "returns 1 if the device has a manifest url" do
|
42
|
+
app = TenantManagedApp.from_hash({"ManifestURL" => "https://www.mokimanage.com"})
|
43
|
+
expect(app.management_flag).to eq(1)
|
44
|
+
end
|
45
|
+
|
46
|
+
it "returns 0 if the device has an iTunesStoreID" do
|
47
|
+
app = TenantManagedApp.from_hash({"iTunesStoreID" => "733151730"})
|
48
|
+
expect(app.management_flag).to eq(0)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe "external_locator_hash" do
|
53
|
+
it "returns a hash with the manifest url if it has one" do
|
54
|
+
app = TenantManagedApp.from_hash({"ManifestURL" => "https://www.mokimanage.com"})
|
55
|
+
expect(app.external_locator_hash).to eq({"ManifestURL" => "https://www.mokimanage.com"})
|
56
|
+
end
|
57
|
+
|
58
|
+
it "returns a hash with the itunes store id if it does not have a manifest url" do
|
59
|
+
app = TenantManagedApp.from_hash({"iTunesStoreID" => "733151730"})
|
60
|
+
expect(app.external_locator_hash).to eq({"iTunesStoreID" => "733151730"})
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
describe "install_hash" do
|
65
|
+
it "returns a specially crafted action hash for installing the app" do
|
66
|
+
app = TenantManagedApp.from_hash(response_hash)
|
67
|
+
expect(app.install_hash).to eq({ "action" => "install_app",
|
68
|
+
"thirdPartyUser" => "moki_ruby",
|
69
|
+
"clientName" => "MokiRuby",
|
70
|
+
"itemName" => "MokiTouch 2.0",
|
71
|
+
"notify" => true,
|
72
|
+
"payload" => {
|
73
|
+
"ManagementFlags" => 1,
|
74
|
+
"identifier" => "com.mokimobility.mokitouch2",
|
75
|
+
"version" => "1.1.1",
|
76
|
+
"ManifestURL" => "http://www.mokimanage.com/app" }})
|
77
|
+
end
|
78
|
+
|
79
|
+
it "will send the itunes store id if missing the manifest url" do
|
80
|
+
response_hash.delete("ManifestURL")
|
81
|
+
app = TenantManagedApp.from_hash(response_hash)
|
82
|
+
expect(app.install_hash["payload"]["ManifestURL"]).to be_nil
|
83
|
+
expect(app.install_hash["payload"]["iTunesStoreID"]).to eq(response_hash["iTunesStoreID"])
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
data/spec/moki_ruby_spec.rb
CHANGED
@@ -28,13 +28,13 @@ describe MokiRuby do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
-
describe ".
|
31
|
+
describe ".tenant_managed_apps" do
|
32
32
|
it "raises an error if no tenant ID is provided" do
|
33
33
|
ENV['MOKI_API_URL'] = 'http://localhost:9292'
|
34
34
|
ENV['MOKI_TENANT_ID'] = ''
|
35
35
|
ENV['MOKI_API_KEY'] = 'secret-key'
|
36
36
|
|
37
|
-
expect { MokiRuby.
|
37
|
+
expect { MokiRuby.tenant_managed_apps }.to raise_error
|
38
38
|
end
|
39
39
|
|
40
40
|
it "raises an error if no API key is provided" do
|
@@ -42,59 +42,15 @@ describe MokiRuby do
|
|
42
42
|
ENV['MOKI_TENANT_ID'] = 'abcd123-test'
|
43
43
|
ENV['MOKI_API_KEY'] = ''
|
44
44
|
|
45
|
-
expect { MokiRuby.
|
46
|
-
end
|
47
|
-
|
48
|
-
it "raises an error if the device id is bad" do
|
49
|
-
ENV['MOKI_API_URL'] = 'http://localhost:9292'
|
50
|
-
ENV['MOKI_TENANT_ID'] = 'abcd123-test'
|
51
|
-
ENV['MOKI_API_KEY'] = 'secret-key'
|
52
|
-
|
53
|
-
expect(MokiAPI).to_not receive(:issue_request)
|
54
|
-
expect { MokiRuby.device_profiles('BADSERIAL') }.to raise_error
|
55
|
-
end
|
56
|
-
|
57
|
-
it "retuns an array of IOSProfile objects" do
|
58
|
-
load_good_stubs
|
59
|
-
data = MokiRuby.device_profiles('ABC123DEF456')
|
60
|
-
expect(data.count).to eq(4)
|
61
|
-
expect(data.first).to be_kind_of(IOSProfile)
|
62
|
-
expect(data.first.name).to eq("Test Profile 1")
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
describe ".device_managed_apps" do
|
67
|
-
it "raises an error if no tenant ID is provided" do
|
68
|
-
ENV['MOKI_API_URL'] = 'http://localhost:9292'
|
69
|
-
ENV['MOKI_TENANT_ID'] = ''
|
70
|
-
ENV['MOKI_API_KEY'] = 'secret-key'
|
71
|
-
|
72
|
-
expect { MokiRuby.device_managed_apps('ABC123DEF456') }.to raise_error
|
73
|
-
end
|
74
|
-
|
75
|
-
it "raises an error if no API key is provided" do
|
76
|
-
ENV['MOKI_API_URL'] = 'http://localhost:9292'
|
77
|
-
ENV['MOKI_TENANT_ID'] = 'abcd123-test'
|
78
|
-
ENV['MOKI_API_KEY'] = ''
|
79
|
-
|
80
|
-
expect { MokiRuby.device_managed_apps('ABC123DEF456') }.to raise_error
|
81
|
-
end
|
82
|
-
|
83
|
-
it "raises an error if the device id is bad" do
|
84
|
-
ENV['MOKI_API_URL'] = 'http://localhost:9292'
|
85
|
-
ENV['MOKI_TENANT_ID'] = 'abcd123-test'
|
86
|
-
ENV['MOKI_API_KEY'] = 'secret-key'
|
87
|
-
|
88
|
-
expect(MokiAPI).to_not receive(:issue_request)
|
89
|
-
expect { MokiRuby.device_managed_apps('BADSERIAL') }.to raise_error
|
45
|
+
expect { MokiRuby.tenant_managed_apps }.to raise_error
|
90
46
|
end
|
91
47
|
|
92
48
|
it "retuns an array of IOSProfile objects" do
|
93
49
|
load_good_stubs
|
94
|
-
data = MokiRuby.
|
50
|
+
data = MokiRuby.tenant_managed_apps
|
95
51
|
expect(data.count).to eq(2)
|
96
|
-
expect(data.first).to be_kind_of(
|
97
|
-
expect(data.first.
|
52
|
+
expect(data.first).to be_kind_of(TenantManagedApp)
|
53
|
+
expect(data.first.name).to eq("MokiTouch 2.0")
|
98
54
|
end
|
99
55
|
end
|
100
56
|
end
|
@@ -7,6 +7,13 @@ def load_good_stubs
|
|
7
7
|
@device_managed_app_stub_response = [{ "Status" => "Managed", "appIdentifier" => "com.belly.moki.gem.enterprise", "ManagementFlags" => 1 },
|
8
8
|
{ "Status" => "Managed", "appIdentifier" => "com.belly.flop.html.enterprise", "ManagementFlags" => 0 }]
|
9
9
|
|
10
|
+
@tenant_managed_app_stub_response = [{ "id" => "30dedb7062a941b8b5f0c960d7d8f79a", "lastSeen" => 1384278494336, "name" => "MokiTouch 2.0", "identifier" => "com.mokimobility.mokitouch2", "version" => "1.1.1", "ManagementFlags" => 0, "iTunesStoreID" => "733151730" },
|
11
|
+
{ "id" => "30dedb7162b941b8b5f0c960d7d8f79a", "lastSeen" => 1423524426266, "name" => "Belly Merchant App", "identifier" => "com.belly.flop.html.enterprise", "version" => "3.0", "ManagementFlags" => 1, "ManifestURL" => "https://www.bellycard.com/" }]
|
12
|
+
|
13
|
+
@action_stub_response = { "id" => "b4d71a15183b4971a3bdd139754a40fe", "lastSeen" => 1420583405416,
|
14
|
+
"action" => "removeprofile", "status" => "completed", "clientName" => "Web", "itemName" => "Profile Name",
|
15
|
+
"thirdPartyUser" => "itsmebro", "payload" => "{profile Identifier}", "note" => "test" }
|
16
|
+
|
10
17
|
allow(MokiAPI).to receive_message_chain(:ios_profiles, :value).
|
11
18
|
and_return(Hashie::Mash.new({ body: @iosprofiles_stub_response,
|
12
19
|
status: 200,
|
@@ -21,4 +28,14 @@ def load_good_stubs
|
|
21
28
|
and_return(Hashie::Mash.new({ body: @device_managed_app_stub_response,
|
22
29
|
status: 200,
|
23
30
|
headers: {}}))
|
31
|
+
|
32
|
+
allow(MokiAPI).to receive_message_chain(:tenant_managed_app_list, :value).
|
33
|
+
and_return(Hashie::Mash.new({ body: @tenant_managed_app_stub_response,
|
34
|
+
status: 200,
|
35
|
+
headers: {}}))
|
36
|
+
|
37
|
+
allow(MokiAPI).to receive_message_chain(:action, :value).
|
38
|
+
and_return(Hashie::Mash.new({ body: @action_stub_response,
|
39
|
+
status: 200,
|
40
|
+
headers: {}}))
|
24
41
|
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.2
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -154,15 +154,19 @@ files:
|
|
154
154
|
- lib/future_wrapper.rb
|
155
155
|
- lib/moki_api.rb
|
156
156
|
- lib/moki_ruby.rb
|
157
|
-
- lib/moki_ruby/
|
157
|
+
- lib/moki_ruby/action.rb
|
158
|
+
- lib/moki_ruby/device.rb
|
158
159
|
- lib/moki_ruby/device_managed_app.rb
|
159
160
|
- lib/moki_ruby/iosprofile.rb
|
161
|
+
- lib/moki_ruby/tenant_managed_app.rb
|
160
162
|
- lib/moki_ruby/version.rb
|
161
163
|
- moki_ruby.gemspec
|
162
|
-
- spec/lib/
|
164
|
+
- spec/lib/action_spec.rb
|
163
165
|
- spec/lib/device_managed_app_spec.rb
|
166
|
+
- spec/lib/device_spec.rb
|
164
167
|
- spec/lib/iosprofile_spec.rb
|
165
168
|
- spec/lib/moki_api_spec.rb
|
169
|
+
- spec/lib/tenant_managed_app_spec.rb
|
166
170
|
- spec/moki_ruby_spec.rb
|
167
171
|
- spec/spec_helper.rb
|
168
172
|
- spec/support/common_stubs.rb
|
@@ -191,10 +195,12 @@ signing_key:
|
|
191
195
|
specification_version: 4
|
192
196
|
summary: A gem for interacting with the Moki Total Control API.
|
193
197
|
test_files:
|
194
|
-
- spec/lib/
|
198
|
+
- spec/lib/action_spec.rb
|
195
199
|
- spec/lib/device_managed_app_spec.rb
|
200
|
+
- spec/lib/device_spec.rb
|
196
201
|
- spec/lib/iosprofile_spec.rb
|
197
202
|
- spec/lib/moki_api_spec.rb
|
203
|
+
- spec/lib/tenant_managed_app_spec.rb
|
198
204
|
- spec/moki_ruby_spec.rb
|
199
205
|
- spec/spec_helper.rb
|
200
206
|
- spec/support/common_stubs.rb
|
@@ -1,19 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
require 'moki_ruby/device_identifier'
|
3
|
-
|
4
|
-
describe DeviceIdentifier do
|
5
|
-
it "picks out a serial number as a 12-character string" do
|
6
|
-
expect(DeviceIdentifier.is_serial?("ABC123DEF456")).to eq(true)
|
7
|
-
expect(DeviceIdentifier.is_serial?("123456789012")).to eq(true)
|
8
|
-
expect(DeviceIdentifier.is_serial?("F55VM3KK9G5F")).to eq(true)
|
9
|
-
expect(DeviceIdentifier.is_serial?("ABC123DE56")).to eq(false)
|
10
|
-
expect(DeviceIdentifier.is_serial?("123456789012123")).to eq(false)
|
11
|
-
end
|
12
|
-
|
13
|
-
it "identifies a UDID" do
|
14
|
-
expect(DeviceIdentifier.is_udid?("ABC123DEF456")).to eq(false)
|
15
|
-
expect(DeviceIdentifier.is_udid?("abc12345-de12-abd5-7777-abcdefghijkl")).to eq(false)
|
16
|
-
expect(DeviceIdentifier.is_udid?("abc12345-de12-abd5-1234-abcdef123456")).to eq(true)
|
17
|
-
expect(DeviceIdentifier.is_udid?("abc1235-def125-hjm-erm")).to eq(false)
|
18
|
-
end
|
19
|
-
end
|