applocate 0.2.1 → 0.3.0

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: a71d67f06a560b39468263f5bef0b698582a625c
4
- data.tar.gz: d8e6257fce9eac558219e21433554c23a0090bbf
3
+ metadata.gz: 26110a46d64209afb62d2ab020de175f037d69a2
4
+ data.tar.gz: 64f9e8f21bb86ef57d438eeb5cb2c508afc0e2de
5
5
  SHA512:
6
- metadata.gz: fbbae04b6230adfee865be9dd1e5a6347a543d9d1890433888b640b45f9419678c9e18319018a664e145119a09399fc0839066398c1540b0b875f68c8fe86e00
7
- data.tar.gz: 86da3a771f93ab3b50d855e7647774dad3232934da51f0c563e2a3d62a0cc5bf78861f5a8716e5f5050653929a25f661262c3a90217cef47b49ef84666e685a0
6
+ metadata.gz: 730a3fa861f34474fee1b137121912ad133cb4b63d9cb99bf53f3f57cf316efb4a67c428e3349f4b005240d29ec8e64a77f0dd2b5a65f8ae617642b65719a5d3
7
+ data.tar.gz: 3083019f86a08ef2fe042428d6b3794ec145f14cc8935950ec491c0b9b3c3e63721861499ade36127a42ee86f4905e28d55f06aa88bb6f97b545914fb0d61fae
@@ -5,6 +5,12 @@ AllCops:
5
5
  - db/**/*
6
6
  - Guardfile
7
7
  - applocate.gemspec
8
+
9
+ Style/MultilineMethodCallIndentation:
10
+ Enabled: false
11
+
12
+ Style/MutableConstant:
13
+ Enabled: false
8
14
 
9
15
  Style/RescueModifier:
10
16
  Enabled: false
@@ -0,0 +1,27 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2016-02-04 12:43:41 -0700 using RuboCop version 0.37.0.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
12
+ Style/ExtraSpacing:
13
+ Exclude:
14
+ - 'spec/applocate/api_spec.rb'
15
+
16
+ # Offense count: 8
17
+ # Cop supports --auto-correct.
18
+ # Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
19
+ # SupportedStyles: aligned, indented
20
+ Style/MultilineMethodCallIndentation:
21
+ Enabled: false
22
+
23
+ # Offense count: 1
24
+ # Cop supports --auto-correct.
25
+ Style/MutableConstant:
26
+ Exclude:
27
+ - 'lib/applocate/version.rb'
data/README.md CHANGED
@@ -80,6 +80,29 @@ Applocate::API.list_devices
80
80
  Applocate::API.delete_device(options)
81
81
  # delete a device with a given id
82
82
 
83
+
84
+ # expected params, udid = "ABCD-DCCDDC-12394812389-CDC"
85
+ Applocate::API.profile_list(udid)
86
+ # returns a list (Array) of install profiles. **excluding any provisioning profiles.**
87
+
88
+ # expected params: udid = "ABCD-DCCDDC-12394812389-CDC", name = "me.example.restrictions" options { ... Apple MDM Restrictions Profile ... }
89
+ Applocate::API.apply_named_restrictions(udid, name, options)
90
+ # returns the udid and the status of the command as JSON
91
+
92
+ # expected params, udid = "ABCD-DCCDDC-12394812389-CDC", name = "me.example.restrictions"
93
+ Applocate::API.remove_named_restrictions(udid, name)
94
+ # returns the udid and the status of the command as JSON
95
+
96
+ ```
97
+
98
+ If you need to change which server you are connecting to, Applocate provides
99
+ access to its internal config options for the secret and the token. For the URL
100
+ it provides the same options as a standard HTTParty connection:
101
+
102
+ ```ruby
103
+ Applocate.configuration.token = "xxx-xxxxxxx"
104
+ Applocate.configuration.secret = "shhh... secret"
105
+ Applocate.base_uri "https://www.applocate.com"
83
106
  ```
84
107
 
85
108
  ## Contributing
@@ -7,6 +7,24 @@ module Applocate
7
7
  headers 'Content-Type' => "application/json"
8
8
  format :plain
9
9
 
10
+ # expected params, udid = "ABCD-DCCDDC-12394812389-CDC"
11
+ def self.profile_list(udid)
12
+ response = self.get("/api/devices/#{udid}/profiles", { headers: authentication })
13
+ JSON.parse response.body rescue []
14
+ end
15
+
16
+ # expected params: udid = "ABCD-DCCDDC-12394812389-CDC", name = "me.example.restrictions" options { ... Apple MDM Restrictions Profile ... }
17
+ def self.apply_named_restrictions(udid, name, options = {})
18
+ response = self.post("/api/devices/#{udid}/profiles/#{name}", { body: options.to_json, headers: authentication })
19
+ JSON.parse response.body rescue {}
20
+ end
21
+
22
+ # expected params, udid = "ABCD-DCCDDC-12394812389-CDC", name = "me.example.restrictions"
23
+ def self.remove_named_restrictions(udid, name)
24
+ response = self.delete("/api/devices/#{udid}/profiles/#{name}", { headers: authentication })
25
+ JSON.parse response.body rescue {}
26
+ end
27
+
10
28
  # expected options { udid: "ABCD-DCCDDC-12394812389-CDC" }
11
29
  def self.restrict(options = {})
12
30
  response = self.post('/deploy/profile', { body: options.to_json, headers: authentication })
@@ -1,3 +1,3 @@
1
1
  module Applocate
2
- VERSION = "0.2.1"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -27,7 +27,7 @@ describe Applocate::API do
27
27
  results = []
28
28
 
29
29
  Applocate::API.should_receive(:post)
30
- .with('/deploy/profile', { body: device_list.to_json, headers: Applocate::API.authentication })
30
+ .with('/deploy/profile', { body: device_list.to_json, headers: Applocate::API.authentication })
31
31
  .and_return(results)
32
32
 
33
33
  Applocate::API.restrict device_list
@@ -39,7 +39,7 @@ describe Applocate::API do
39
39
  results = []
40
40
 
41
41
  Applocate::API.should_receive(:delete)
42
- .with('/deploy/profile', { body: device_list.to_json, headers: Applocate::API.authentication })
42
+ .with('/deploy/profile', { body: device_list.to_json, headers: Applocate::API.authentication })
43
43
  .and_return(results)
44
44
 
45
45
  Applocate::API.unrestrict device_list
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: applocate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Madsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-10 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -90,6 +90,7 @@ files:
90
90
  - ".gitignore"
91
91
  - ".rspec"
92
92
  - ".rubocop.yml"
93
+ - ".rubocop_todo.yml"
93
94
  - ".travis.yml"
94
95
  - Gemfile
95
96
  - Guardfile
@@ -125,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
126
  version: '0'
126
127
  requirements: []
127
128
  rubyforge_project:
128
- rubygems_version: 2.4.5
129
+ rubygems_version: 2.4.5.1
129
130
  signing_key:
130
131
  specification_version: 4
131
132
  summary: Server API client for Applocate