apple_vpp 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +31 -0
- data/LICENSE +20 -0
- data/LICENSE.txt +22 -0
- data/README.md +138 -0
- data/Rakefile +1 -0
- data/apple_vpp.gemspec +25 -0
- data/lib/apple_vpp/apple_serializer.rb +19 -0
- data/lib/apple_vpp/client.rb +187 -0
- data/lib/apple_vpp/error.rb +14 -0
- data/lib/apple_vpp/request.rb +23 -0
- data/lib/apple_vpp/url_service.rb +56 -0
- data/lib/apple_vpp/version.rb +3 -0
- data/lib/apple_vpp.rb +3 -0
- data/lib/core_ext/string.rb +9 -0
- data/spec/apple_vpp/api_spec.rb +5 -0
- data/spec/spec_helper.rb +22 -0
- metadata +121 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Njk4MWU4NzhlZWMwM2M2MTNjNDYxNDUxYjhiNWQwMDg0OTVmNDliZA==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZGY5YWEwZTIzM2UwODY3NGM5NjIyYzk1MTE4NWFjMGI0ZWExNDFiMw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZmJjNjNlNTZmYzBhNWIyZWM1NmZhM2M3ZDM0NDY1NTk2MTkzNGY1MTIyNWY4
|
10
|
+
MzFjNmFmYTVmNDViNzQ0ZjUxYzY2NGRmMmJjMTRiNzdlYWQ0M2JlZDBkNmVj
|
11
|
+
OWNlNWQyYjVjYzM5MDAzYzU1OTc3NDU5OWZjM2QzNmZiNjcyNmU=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NDZiNmYxMzdmYWE0MWNiNTY2ZDEyNWVlM2IyOTkxODMzYmZmNWI5Y2ViZGIx
|
14
|
+
ZTRkZDMxMTVlY2VlZDZkOGVkODgxMTY4Njc0Mzc4NDUzNDEwNTgxYjI0NzMx
|
15
|
+
Mjc3YWY4M2E5MWFjZWZiNzYwNGI1NGMzOTJjZTI1MzU5NzZkMTQ=
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
apple_vpp (1.0.0)
|
5
|
+
rest-client (~> 1.6.7)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.2.4)
|
11
|
+
mime-types (1.25)
|
12
|
+
rake (10.1.0)
|
13
|
+
rest-client (1.6.7)
|
14
|
+
mime-types (>= 1.16)
|
15
|
+
rspec (2.14.1)
|
16
|
+
rspec-core (~> 2.14.0)
|
17
|
+
rspec-expectations (~> 2.14.0)
|
18
|
+
rspec-mocks (~> 2.14.0)
|
19
|
+
rspec-core (2.14.4)
|
20
|
+
rspec-expectations (2.14.0)
|
21
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
22
|
+
rspec-mocks (2.14.1)
|
23
|
+
|
24
|
+
PLATFORMS
|
25
|
+
ruby
|
26
|
+
|
27
|
+
DEPENDENCIES
|
28
|
+
apple_vpp!
|
29
|
+
bundler (~> 1.3)
|
30
|
+
rake
|
31
|
+
rspec
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2013 tboyko
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
6
|
+
this software and associated documentation files (the "Software"), to deal in
|
7
|
+
the Software without restriction, including without limitation the rights to
|
8
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
9
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
10
|
+
subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
17
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
18
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
19
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
20
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 TODO: Write your name
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
apple_vpp
|
2
|
+
=========
|
3
|
+
|
4
|
+
Ruby bindings for the Apple VPP Managed App License Distribution API.
|
5
|
+
|
6
|
+
# Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'apple_vpp'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install apple_vpp
|
19
|
+
|
20
|
+
# Usage
|
21
|
+
|
22
|
+
Use the library like this:
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
s_token = File.read './from_apple_portal.vpptoken'
|
26
|
+
|
27
|
+
c = AppleVPP::Client.new s_token
|
28
|
+
|
29
|
+
users_json = c.get_users
|
30
|
+
|
31
|
+
c.edit_user user_id: users_json.first[:user_id],
|
32
|
+
email: 'youremail@example.org'
|
33
|
+
```
|
34
|
+
|
35
|
+
# Methods
|
36
|
+
|
37
|
+
For information beyond what is included here, refer to the "Mobile Device Management Protocol Reference" documentation on Apple's Developer site.
|
38
|
+
|
39
|
+
## associate_license_with_user
|
40
|
+
|
41
|
+
One of these is required:
|
42
|
+
|
43
|
+
* user_id
|
44
|
+
* client_user_id_str
|
45
|
+
|
46
|
+
One of these is required:
|
47
|
+
|
48
|
+
* adam_id
|
49
|
+
* license_id
|
50
|
+
|
51
|
+
Optional:
|
52
|
+
|
53
|
+
* pricing_param
|
54
|
+
|
55
|
+
## client_config
|
56
|
+
|
57
|
+
Optional:
|
58
|
+
|
59
|
+
* client_context
|
60
|
+
* apn_token
|
61
|
+
|
62
|
+
## disassociate_license_from_user
|
63
|
+
|
64
|
+
Required:
|
65
|
+
|
66
|
+
* license_id
|
67
|
+
|
68
|
+
## edit_user
|
69
|
+
|
70
|
+
One of these is required:
|
71
|
+
|
72
|
+
* user_id
|
73
|
+
* client_user_id_str
|
74
|
+
|
75
|
+
Optional:
|
76
|
+
|
77
|
+
* email
|
78
|
+
|
79
|
+
## get_licenses
|
80
|
+
|
81
|
+
Optional:
|
82
|
+
|
83
|
+
* since_modified_token
|
84
|
+
* adam_id
|
85
|
+
* pricing_param
|
86
|
+
|
87
|
+
## get_user
|
88
|
+
|
89
|
+
One of these is required:
|
90
|
+
|
91
|
+
* user_id
|
92
|
+
* client_user_id_str
|
93
|
+
|
94
|
+
Optional:
|
95
|
+
|
96
|
+
* its_id_hash
|
97
|
+
|
98
|
+
## get_users
|
99
|
+
|
100
|
+
Optional:
|
101
|
+
|
102
|
+
* since_modified_token
|
103
|
+
* include_retired
|
104
|
+
|
105
|
+
## register_user
|
106
|
+
|
107
|
+
Required:
|
108
|
+
|
109
|
+
* client_user_id_str
|
110
|
+
|
111
|
+
Optional:
|
112
|
+
|
113
|
+
* email
|
114
|
+
|
115
|
+
## retire_user
|
116
|
+
|
117
|
+
One of these is required:
|
118
|
+
|
119
|
+
* user_id
|
120
|
+
* client_user_id_str
|
121
|
+
|
122
|
+
# Error Handling
|
123
|
+
|
124
|
+
Should an error be reported by the Apple API service, the library will raise a custom error class that will correspond to the Apple error code like so:
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
AppleVPP::Error::Code#{error_code}
|
128
|
+
```
|
129
|
+
|
130
|
+
A message will also be provided with the error.
|
131
|
+
|
132
|
+
## Contributing
|
133
|
+
|
134
|
+
1. Fork it
|
135
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
136
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
137
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
138
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/apple_vpp.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'apple_vpp/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "apple_vpp"
|
8
|
+
spec.version = AppleVPP::VERSION
|
9
|
+
spec.authors = ["Taylor Boyko"]
|
10
|
+
spec.email = ["taylorboyko@gmail.com"]
|
11
|
+
spec.description = %q{Ruby bindings for the Apple VPP App Assignment API}
|
12
|
+
spec.summary = %q{Ruby bindings for the Apple VPP App Assignment API}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_dependency 'rest-client', '~> 1.6.7'
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec"
|
25
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module AppleVPP
|
2
|
+
class AppleSerializer
|
3
|
+
|
4
|
+
def self.to_ruby(apple_hash)
|
5
|
+
if apple_hash.kind_of?( Array )
|
6
|
+
return apple_hash.collect { |i| to_ruby i }
|
7
|
+
end
|
8
|
+
|
9
|
+
keys_with_hashes = apple_hash.select { | _k, v | v.kind_of?( Hash ) }
|
10
|
+
|
11
|
+
if keys_with_hashes.count > 0
|
12
|
+
keys_with_hashes.each { |k, v| apple_hash[k] = to_ruby v }
|
13
|
+
end
|
14
|
+
|
15
|
+
Hash[ apple_hash.map { | k, v | [ k.underscore.to_sym, v ] } ]
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require 'rest_client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module AppleVPP
|
5
|
+
class Client
|
6
|
+
|
7
|
+
attr_accessor :s_token
|
8
|
+
|
9
|
+
def initialize(s_token)
|
10
|
+
@s_token = s_token
|
11
|
+
@url_service = UrlService.new
|
12
|
+
end
|
13
|
+
|
14
|
+
def associate_license_with_user(params = {})
|
15
|
+
require_params [[:user_id, :client_user_id_str], [:adam_id, :license_id]], params
|
16
|
+
|
17
|
+
body = {
|
18
|
+
'userId' => params[:user_id],
|
19
|
+
'clientUserIdStr' => params[:client_user_id_str],
|
20
|
+
'adamId' => params[:adam_id],
|
21
|
+
'licenseId' => params[:license_id],
|
22
|
+
'pricingParam' => params[:pricing_param]
|
23
|
+
}
|
24
|
+
|
25
|
+
resp = request :associate_license_srv_url, body
|
26
|
+
|
27
|
+
AppleSerializer.to_ruby [ resp['license'], resp['user'] ]
|
28
|
+
end
|
29
|
+
|
30
|
+
def disassociate_license_from_user(params = {})
|
31
|
+
require_params :license_id, params
|
32
|
+
|
33
|
+
body = {
|
34
|
+
'licenseId' => params[:license_id]
|
35
|
+
}
|
36
|
+
|
37
|
+
resp = request :disassociate_license_srv_url, body
|
38
|
+
|
39
|
+
AppleSerializer.to_ruby [ resp['license'], resp['user'] ]
|
40
|
+
end
|
41
|
+
|
42
|
+
def client_config(params = {})
|
43
|
+
body = {
|
44
|
+
'clientContext' => params[:client_context],
|
45
|
+
'apnToken' => params[:apn_token]
|
46
|
+
}
|
47
|
+
|
48
|
+
resp = request :client_config_srv_url, body
|
49
|
+
|
50
|
+
AppleSerializer.to_ruby resp['clientContext']
|
51
|
+
end
|
52
|
+
|
53
|
+
def edit_user(params = {})
|
54
|
+
require_params [[:user_id, :client_user_id_str]], params
|
55
|
+
|
56
|
+
body = {
|
57
|
+
'userId' => params[:user_id],
|
58
|
+
'clientUserIdStr' => params[:client_user_id_str],
|
59
|
+
'email' => params[:email]
|
60
|
+
}
|
61
|
+
|
62
|
+
resp = request :edit_user_srv_url, body
|
63
|
+
|
64
|
+
AppleSerializer.to_ruby resp['user']
|
65
|
+
end
|
66
|
+
|
67
|
+
def get_licenses(params = {})
|
68
|
+
licenses = []
|
69
|
+
batch_token = nil
|
70
|
+
|
71
|
+
begin
|
72
|
+
|
73
|
+
body = {
|
74
|
+
'batchToken' => batch_token,
|
75
|
+
'sinceModifiedToken' => params[:since_modified_token],
|
76
|
+
'adamId' => params[:adam_id],
|
77
|
+
'pricingParam' => params[:pricing_param]
|
78
|
+
}
|
79
|
+
|
80
|
+
resp = request :get_licenses_srv_url, body
|
81
|
+
|
82
|
+
licenses.concat( resp['licenses'] ) if resp['licenses']
|
83
|
+
|
84
|
+
batch_token = resp['batchToken']
|
85
|
+
|
86
|
+
end while batch_token
|
87
|
+
|
88
|
+
AppleSerializer.to_ruby licenses
|
89
|
+
end
|
90
|
+
|
91
|
+
def get_user(params = {})
|
92
|
+
require_params [[:user_id, :client_user_id_str]], params
|
93
|
+
|
94
|
+
body = {
|
95
|
+
'userId' => params[:user_id],
|
96
|
+
'clientUserIdStr' => params[:client_user_id_str],
|
97
|
+
'itsIdHash' => params[:its_id_hash]
|
98
|
+
}
|
99
|
+
|
100
|
+
resp = request :get_user_srv_url, body
|
101
|
+
|
102
|
+
AppleSerializer.to_ruby resp['user']
|
103
|
+
end
|
104
|
+
|
105
|
+
def register_user(params = {})
|
106
|
+
require_params :client_user_id_str, params
|
107
|
+
|
108
|
+
body = {
|
109
|
+
'clientUserIdStr' => params[:client_user_id_str],
|
110
|
+
'email' => params[:email]
|
111
|
+
}
|
112
|
+
|
113
|
+
resp = request :register_user_srv_url, body
|
114
|
+
|
115
|
+
AppleSerializer.to_ruby resp['user']
|
116
|
+
end
|
117
|
+
|
118
|
+
def retire_user(params = {})
|
119
|
+
require_params [[:user_id, :client_user_id_str]], params
|
120
|
+
|
121
|
+
body = {
|
122
|
+
'userId' => params[:user_id],
|
123
|
+
'clientUserIdStr' => params[:client_user_id_str]
|
124
|
+
}
|
125
|
+
|
126
|
+
resp = request :retire_user_srv_url, body
|
127
|
+
|
128
|
+
AppleSerializer.to_ruby resp['user']
|
129
|
+
end
|
130
|
+
|
131
|
+
def get_users(params = {})
|
132
|
+
users = []
|
133
|
+
batch_token = nil
|
134
|
+
|
135
|
+
begin
|
136
|
+
|
137
|
+
body = {
|
138
|
+
'batchToken' => batch_token,
|
139
|
+
'sinceModifiedToken' => params[:since_modified_token],
|
140
|
+
'includeRetired' => params[:include_retired] ? 1 : nil
|
141
|
+
}
|
142
|
+
|
143
|
+
resp = request :get_users_srv_url, body
|
144
|
+
|
145
|
+
users.concat( resp['users'] ) if resp['users']
|
146
|
+
|
147
|
+
batch_token = resp['batchToken']
|
148
|
+
|
149
|
+
end while batch_token
|
150
|
+
|
151
|
+
AppleSerializer.to_ruby users
|
152
|
+
end
|
153
|
+
|
154
|
+
private
|
155
|
+
|
156
|
+
# param_name_array is an array of required parameters. Include a sub-array of parameters for || requirement.
|
157
|
+
|
158
|
+
def require_params param_name_array, params
|
159
|
+
param_name_array = [param_name_array] unless param_name_array.kind_of? Array
|
160
|
+
|
161
|
+
param_name_array.each do |param_names|
|
162
|
+
param_names = [param_names] unless param_names.kind_of?(Array)
|
163
|
+
|
164
|
+
param_found = false
|
165
|
+
param_names.each do |param_name|
|
166
|
+
if params[param_name]
|
167
|
+
param_found = true
|
168
|
+
break
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
unless param_found
|
173
|
+
raise ArgumentError, "#{param_names.join(' or ')} must be provided"
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def request url_service_url, body
|
179
|
+
@url_service.refresh unless @url_service.ready?
|
180
|
+
|
181
|
+
url = @url_service.send( url_service_url )
|
182
|
+
|
183
|
+
Request.submit url, @s_token, body
|
184
|
+
end
|
185
|
+
|
186
|
+
end
|
187
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rest-client'
|
2
|
+
require 'json'
|
3
|
+
|
4
|
+
module AppleVPP
|
5
|
+
class Request
|
6
|
+
|
7
|
+
def self.submit( url, s_token = nil, body = {} )
|
8
|
+
body['sToken'] = s_token
|
9
|
+
body.delete_if { |_k, v| v.nil? }
|
10
|
+
|
11
|
+
resp = RestClient.post url, body, content_type: :json
|
12
|
+
json = JSON.parse(resp)
|
13
|
+
|
14
|
+
if json['status'] == -1
|
15
|
+
raise (eval "AppleVPP::Error::Code#{json['errorNumber']}"), json['errorMessage']
|
16
|
+
end
|
17
|
+
|
18
|
+
json
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module AppleVPP
|
2
|
+
class UrlService
|
3
|
+
|
4
|
+
SERVICE_URL = 'https://vpp.itunes.apple.com/WebObjects/MZFinance.woa/wa/'
|
5
|
+
|
6
|
+
attr_reader :associate_license_srv_url,
|
7
|
+
:client_config_srv_url,
|
8
|
+
:disassociate_license_srv_url,
|
9
|
+
:edit_user_srv_url,
|
10
|
+
:get_licenses_srv_url,
|
11
|
+
:get_user_srv_url,
|
12
|
+
:get_users_srv_url,
|
13
|
+
:invitation_email_url,
|
14
|
+
:register_user_srv_url,
|
15
|
+
:retire_user_srv_url,
|
16
|
+
:vpp_website_url,
|
17
|
+
:errors
|
18
|
+
|
19
|
+
def initialize
|
20
|
+
@errors = {}
|
21
|
+
@ready = false
|
22
|
+
end
|
23
|
+
|
24
|
+
def refresh
|
25
|
+
url = "#{SERVICE_URL}VPPServiceConfigSrv"
|
26
|
+
resp = Request.submit url
|
27
|
+
|
28
|
+
@associate_license_srv_url = resp['associateLicenseSrvUrl']
|
29
|
+
@client_config_srv_url = resp['clientConfigSrvUrl']
|
30
|
+
@disassociate_license_srv_url = resp['disassociateLicenseSrvUrl']
|
31
|
+
@edit_user_srv_url = resp['editUserSrvUrl']
|
32
|
+
@get_licenses_srv_url = resp['getLicensesSrvUrl']
|
33
|
+
@get_user_srv_url = resp['getUserSrvUrl']
|
34
|
+
@get_users_srv_url = resp['getUsersSrvUrl']
|
35
|
+
@invitation_email_url = resp['invitationEmailUrl']
|
36
|
+
@register_user_srv_url = resp['registerUserSrvUrl']
|
37
|
+
@retire_user_srv_url = resp['retireUserSrvUrl']
|
38
|
+
@vpp_website_url = resp['vppWebsiteUrl']
|
39
|
+
|
40
|
+
resp['errorCodes'].each do |i|
|
41
|
+
@errors[ i['errorNumber'] ] = i['errorMessage']
|
42
|
+
end
|
43
|
+
|
44
|
+
@errors.each do | number, _message|
|
45
|
+
AppleVPP::Error.create_error_class( number )
|
46
|
+
end
|
47
|
+
|
48
|
+
@ready = true
|
49
|
+
end
|
50
|
+
|
51
|
+
def ready?
|
52
|
+
@ready
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
data/lib/apple_vpp.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
|
4
|
+
require 'apple_vpp'
|
5
|
+
|
6
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
7
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
8
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
9
|
+
# loaded once.
|
10
|
+
#
|
11
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
14
|
+
config.run_all_when_everything_filtered = true
|
15
|
+
config.filter_run :focus
|
16
|
+
|
17
|
+
# Run specs in random order to surface order dependencies. If you find an
|
18
|
+
# order dependency and want to debug it, you can fix the order by providing
|
19
|
+
# the seed, which is printed after each run.
|
20
|
+
# --seed 1234
|
21
|
+
#config.order = 'random'
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: apple_vpp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Taylor Boyko
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-11-21 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rest-client
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 1.6.7
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 1.6.7
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.3'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.3'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rake
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ! '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ! '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
description: Ruby bindings for the Apple VPP App Assignment API
|
70
|
+
email:
|
71
|
+
- taylorboyko@gmail.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- .gitignore
|
77
|
+
- .rspec
|
78
|
+
- Gemfile
|
79
|
+
- Gemfile.lock
|
80
|
+
- LICENSE
|
81
|
+
- LICENSE.txt
|
82
|
+
- README.md
|
83
|
+
- Rakefile
|
84
|
+
- apple_vpp.gemspec
|
85
|
+
- lib/apple_vpp.rb
|
86
|
+
- lib/apple_vpp/apple_serializer.rb
|
87
|
+
- lib/apple_vpp/client.rb
|
88
|
+
- lib/apple_vpp/error.rb
|
89
|
+
- lib/apple_vpp/request.rb
|
90
|
+
- lib/apple_vpp/url_service.rb
|
91
|
+
- lib/apple_vpp/version.rb
|
92
|
+
- lib/core_ext/string.rb
|
93
|
+
- spec/apple_vpp/api_spec.rb
|
94
|
+
- spec/spec_helper.rb
|
95
|
+
homepage: ''
|
96
|
+
licenses:
|
97
|
+
- MIT
|
98
|
+
metadata: {}
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - ! '>='
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '0'
|
108
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ! '>='
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
requirements: []
|
114
|
+
rubyforge_project:
|
115
|
+
rubygems_version: 2.1.10
|
116
|
+
signing_key:
|
117
|
+
specification_version: 4
|
118
|
+
summary: Ruby bindings for the Apple VPP App Assignment API
|
119
|
+
test_files:
|
120
|
+
- spec/apple_vpp/api_spec.rb
|
121
|
+
- spec/spec_helper.rb
|