simplemdm 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ff715d54ff2744ebdbf620dc677ac39b6fb38b0
4
- data.tar.gz: 0a061ac1832772b2bf00a7e6219a406ca0cc1d50
3
+ metadata.gz: de59962356b55faa25bc1d8393f21592f182bebc
4
+ data.tar.gz: 213c0d915c20f2f88ef560ebe0a5a22f258f707d
5
5
  SHA512:
6
- metadata.gz: d18c80f0f50495cbfdc54d249747ae7f036c1f22be53b435d4fa706dfbc994a21cc320657d72e3950e1daced09dd54bf2079362ca4b787a701dcde973b4c8559
7
- data.tar.gz: 55d393d7d50bd70efc3905d8c736985aa2e48c8664d2b5943e4450f3c2305c91824e077d0a4c7c729196ddeff1d76e05a3b34ff3ba85d23cc42c615fc5b6dc0d
6
+ metadata.gz: 3cf2f52c57b12329639b67eedcbbbb0e4ddacbb6f9f842bff35be534e709fac8a2611293b1e90c166e5526ff6a7257fe293ca0a113f2b733ce3bbeadbfffeeb0
7
+ data.tar.gz: a4939f9f2a11fdd798ef24846526887b982ea4e01aaf3c859beba4a81c4d84bc375b43f8fd3c524bc3f1f3332d17a40668d16a17e3d9c4d6484ccd035c801910
@@ -0,0 +1,11 @@
1
+ # Change Log
2
+
3
+ ## [0.1.1] - 2016-05-03
4
+ ### Added
5
+ - Add and remove devices from app groups.
6
+
7
+ ### Fixed
8
+ - Gem properly declares 'Hashie' gem dependency now.
9
+
10
+ ## 0.1.0 - 2015-10-20
11
+ - Initial release
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- # Specify your gem's dependencies in simplemdm-ruby.gemspec
3
+ # Specify your gem's dependencies in simplemdm.gemspec
4
4
  gemspec
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # SimpleMDM Ruby bindings
2
2
 
3
- This is a lightweight SDK that acts as a launching point for integrating ruby-based applications with SimpleMDM. The native API is a RESTful JSON implementation. These bindings wrap the API.
3
+ This is a lightweight SDK that acts as a launching point for integrating ruby-based applications with [SimpleMDM](http://www.simplemdm.com/). The native API is a RESTful JSON implementation. These bindings wrap the API.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
9
  ```ruby
10
- gem 'simplemdm-ruby'
10
+ gem 'simplemdm'
11
11
  ```
12
12
 
13
13
  And then execute:
@@ -16,11 +16,38 @@ And then execute:
16
16
 
17
17
  Or install it yourself as:
18
18
 
19
- $ gem install simplemdm-ruby
19
+ $ gem install simplemdm
20
20
 
21
21
  ## Usage
22
22
 
23
- Full documentation is available here: (http://www.simplemdm.com/docs/api/)[http://www.simplemdm.com/docs/api/]
23
+ Full documentation is available here: [http://www.simplemdm.com/docs/api/](http://www.simplemdm.com/docs/api/)
24
+
25
+ ```ruby
26
+ require 'simplemdm'
27
+
28
+ # provide your api key for access
29
+
30
+ SimpleMDM::api_key = 'j75m8YtUGEaEO5TysjzAXihE07nKoUm9'
31
+
32
+ # lock a device
33
+
34
+ device = SimpleMDM::Device.find(23)
35
+ device.lock message: "This device has been locked. Please call the number provided.",
36
+ phone_number: "5035555847"
37
+
38
+
39
+ # upload an enterprise app and deploy it to a group of devices
40
+
41
+ app_data = IO.binread('surfreport2.2.ipa')
42
+ app = SimpleMDM::App.new name: "Surf Report",
43
+ binary: data
44
+ app.save
45
+
46
+ app_group = SimpleMDM::AppGroup.find(37)
47
+ app_group.add_app(app)
48
+ app_group.push_apps
49
+ ```
50
+
24
51
 
25
52
  ## Development
26
53
 
@@ -124,6 +124,36 @@ module SimpleMDM
124
124
  end
125
125
  end
126
126
 
127
+ def add_device(device)
128
+ raise "You must save this app group before changing associations." if new?
129
+ raise "The object you provided is not a device" unless device.kind_of?(SimpleMDM::Device)
130
+ raise "You must save the device before associating it" if device.id.nil?
131
+
132
+ hash, code = fetch("app_groups/#{self.id}/devices/#{device.id}", :post)
133
+
134
+ if code == 204
135
+ self['device_ids'] = self['device_ids'] | [device.id]
136
+ true
137
+ else
138
+ false
139
+ end
140
+ end
141
+
142
+ def remove_device(device)
143
+ raise "You must save this app group before changing associations" if new?
144
+ raise "The object you provided is not a device" unless device.kind_of?(SimpleMDM::Device)
145
+ raise "The device you provided doesn't exist" if device.id.nil?
146
+
147
+ hash, code = fetch("app_groups/#{self.id}/devices/#{device.id}", :delete)
148
+
149
+ if code == 204
150
+ self['device_ids'].delete(device.id)
151
+ true
152
+ else
153
+ false
154
+ end
155
+ end
156
+
127
157
  def push_apps
128
158
  raise "You cannot push apps for an app group that hasn't been created yet" if new?
129
159
 
@@ -26,6 +26,10 @@ module SimpleMDM
26
26
  attrs['device_group_ids'] = hash['relationships']['device_groups']['data'].collect { |o| o['id'] }
27
27
  end
28
28
 
29
+ if hash['relationships']['devices']
30
+ attrs['device_ids'] = hash['relationships']['devices']['data'].collect { |o| o['id'] }
31
+ end
32
+
29
33
  if hash['relationships']['apps']
30
34
  attrs['app_ids'] = hash['relationships']['apps']['data'].collect { |o| o['id'] }
31
35
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleMDM
2
- VERSION = "0.1.0".freeze
2
+ VERSION = "0.1.1".freeze
3
3
  end
@@ -21,4 +21,5 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.8"
22
22
  spec.add_development_dependency "rake", "~> 10.0"
23
23
  spec.add_dependency "rest-client", "~> 1.8"
24
+ spec.add_dependency "hashie", "~> 3.4.4"
24
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplemdm
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taylor Boyko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-20 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.8'
55
+ - !ruby/object:Gem::Dependency
56
+ name: hashie
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 3.4.4
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 3.4.4
55
69
  description:
56
70
  email:
57
71
  - taylor@wrprojects.com
@@ -60,6 +74,7 @@ extensions: []
60
74
  extra_rdoc_files: []
61
75
  files:
62
76
  - ".gitignore"
77
+ - CHANGELOG.md
63
78
  - CODE_OF_CONDUCT.md
64
79
  - Gemfile
65
80
  - LICENSE.txt