axm 0.1.0 → 0.1.1
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 -0
- data/lib/axm/client.rb +0 -14
- data/lib/axm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 02ec17dcd1e6762bebf731dd97394f9fe87c75be604baed827f34106482d0caf
|
|
4
|
+
data.tar.gz: 4b480339114ab452ed36ce63ae9b843a95e548f5ccc38de034c4d85eb331e674
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28c69e287d78e9b120a75a3092294b1a7526d9b41301869c04c96921066dc34440423e28f06ccca208396dd24f98a5d460c5ab0c1e32e89ccbebb4f4ded09317
|
|
7
|
+
data.tar.gz: 0bfd98852076b669c53f02c3ddbcbdc3e60a1958125e2ef9d66af2ab8ec11207451245fd9fabe123583c24996703bb977990cba1e001950b5323696db38820d9
|
data/README.md
CHANGED
|
@@ -4,6 +4,46 @@ A Ruby wrapper around the Apple Business Manager (ABM) and Apple School Manager
|
|
|
4
4
|
|
|
5
5
|
This gem is heavily inspired by [Octokit](https://github.com/octokit/octokit.rb) and [Oktakit](https://github.com/Shopify/oktakit). If you're familiar with those libraries, you should feel right at home.
|
|
6
6
|
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Install the gem and add to the application's Gemfile by executing:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
bundle add axm
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
If bundler is not being used to manage dependencies, install the gem by executing:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
gem install axm
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
First, generate API credentials from the Apple Business Manager or Apple School Manager portal and store the credentials in a secure location accessible to your app.
|
|
24
|
+
|
|
25
|
+
With the credentials handy, you can create an instance of the client:
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
private_key = File.read('path/to/your/private_key.pem')
|
|
29
|
+
issuer_id = 'your_issuer_id'
|
|
30
|
+
key_id = 'your_key_id'
|
|
31
|
+
|
|
32
|
+
client = Axm::Client.new(private_key:, issuer_id:, key_id:)
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
You're now ready to make API requests.
|
|
36
|
+
|
|
37
|
+
```ruby
|
|
38
|
+
client.list_org_devices
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
For any endpoints that don't currently exist in the gem, you can use the `get` or `post` method directly to make API requests
|
|
42
|
+
|
|
43
|
+
```ruby
|
|
44
|
+
client.get('/v1/some/endpoint', { limit: 10 })
|
|
45
|
+
```
|
|
46
|
+
|
|
7
47
|
## Development
|
|
8
48
|
|
|
9
49
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/axm/client.rb
CHANGED
|
@@ -95,7 +95,6 @@ module Axm
|
|
|
95
95
|
|
|
96
96
|
response_body = response.first if response.last.to_i == 200
|
|
97
97
|
|
|
98
|
-
require 'pry'; binding.pry
|
|
99
98
|
token = response_body.merge!({ 'expires_at' => Time.now.utc + response_body['expires_in'] })
|
|
100
99
|
|
|
101
100
|
Secret.write('stub_access_token', token.to_json)
|
|
@@ -153,22 +152,9 @@ module Axm
|
|
|
153
152
|
|
|
154
153
|
response_json = JSON.parse(response.body)
|
|
155
154
|
|
|
156
|
-
require 'pry'; binding.pry
|
|
157
155
|
raise 'Invalid request' if response_json['error'] == 'invalid_request'
|
|
158
156
|
|
|
159
157
|
[response_json, response.code]
|
|
160
158
|
end
|
|
161
|
-
|
|
162
|
-
# Fetches a list of organization devices from Apple Business Manager.
|
|
163
|
-
#
|
|
164
|
-
# @param limit [Integer] Maximum number of devices to return (default: 100).
|
|
165
|
-
# @param paginate [Boolean] Whether to paginate through all results (default: false).
|
|
166
|
-
# @param fields [Array<String>] Optional fields to include in the response. (default: all fields are returned)
|
|
167
|
-
# @return [Hash] The API response containing organization devices.
|
|
168
|
-
#
|
|
169
|
-
# See: https://developer.apple.com/documentation/applebusinessmanagerapi/get-org-devices
|
|
170
|
-
def org_devices(limit: 100, paginate: false, fields: [])
|
|
171
|
-
get('v1/orgDevices', limit:, paginate:, fields:)
|
|
172
|
-
end
|
|
173
159
|
end
|
|
174
160
|
end
|
data/lib/axm/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: axm
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.1.
|
|
4
|
+
version: 0.1.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- nick-f
|
|
@@ -66,7 +66,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
66
66
|
- !ruby/object:Gem::Version
|
|
67
67
|
version: '0'
|
|
68
68
|
requirements: []
|
|
69
|
-
rubygems_version: 3.
|
|
69
|
+
rubygems_version: 3.4.19
|
|
70
70
|
signing_key:
|
|
71
71
|
specification_version: 4
|
|
72
72
|
summary: Gem to interact with the Apple Business Manager/Apple School Manager API
|