axm 0.1.0 → 0.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 647f814737c960878d73525988b5478ba70806d283e52384e8e511483a2410ae
4
- data.tar.gz: d1825207bf7ecf99a24bb62da4dc6c15aba43e110f2b4a63462e4a794a21d2cf
3
+ metadata.gz: 2b9cf51eb8d1e42d2ee6112d4bf1bc8d38408a56581f0ed0fcaafcb4358692a7
4
+ data.tar.gz: 48a58959848c13ff47d37dd9eb9cd104291bd66e422fc00ba8b3bfbdd3eea3b7
5
5
  SHA512:
6
- metadata.gz: '019c72d25c2de0cbfd4996ed555c1cb58507be75548ce7df1dbcf9dc99a737371c34728532013599428ee7316aa2f69a1a0c3a829729be6a2f37d8ce172f5dae'
7
- data.tar.gz: 46f9235329a51fccf772b3b8d8403f7e9ccb8f20e5d046f42e3e1a79f9ef160583164e806339451b1d3fbc039bcbc36589947cf8e05e0b8160c8d909ca693fbd
6
+ metadata.gz: bd809519957cc388dff7f4c62ce718de7f0c3990c85056a24964de019b2c77338db9078c56b488a583e289ecde0378f40e965682bcd11beaa329bbab625dccbb
7
+ data.tar.gz: 8d4db509e738fe69a17265e718f8371a7c8c2d1e9a1ad7ca3c8471a5eebec62262c5d7f071c5040614fefc1568b75b47f59cd1bc331dae063b9f4ae5073812d1
data/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  ## [Unreleased]
2
2
 
3
- ## [0.1.0] - 2025-06-16
3
+ ## 0.1.2 - 2025-07-14
4
+
5
+ ### Added
6
+
7
+ - Get information about a specific device
8
+
9
+ ### Fixed
10
+
11
+ - Fixed issue with incorrect endpoints being included
12
+
13
+ ## [0.1.1] - 2025-07-14
14
+
15
+ - Updated README with more detailed usage instructions
16
+
17
+ ## [0.1.0] - 2025-07-14
4
18
 
5
19
  - Initial release
20
+
21
+ ### Added
22
+
23
+ - Exchange credentials for an access token
24
+ - List all devices in an organisation
data/README.md CHANGED
@@ -4,10 +4,60 @@ 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
+ client_id = 'your_client_id'
30
+ key_id = 'your_key_id'
31
+
32
+ client = Axm::Client.new(private_key:, client_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.
10
50
 
51
+ If the credentials are stored in the `secrets/` directory, you can use the `Secret.read` method to load them:
52
+
53
+ ```ruby
54
+ private_key = Secret.read('private_key.pem')
55
+ client_id = Secret.read('client_id')
56
+ key_id = Secret.read('key_id')
57
+
58
+ client = Axm::Client.new(private_key:, client_id:, key_id:)
59
+ ```
60
+
11
61
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
12
62
 
13
63
  ## Contributing
@@ -11,7 +11,19 @@ module Axm
11
11
  # See: https://developer.apple.com/documentation/applebusinessmanagerapi/get-org-devices
12
12
  # See: https://developer.apple.com/documentation/appleschoolmanagerapi/get-org-devices
13
13
  def list_org_devices(options = {})
14
- get('/v1/organization/devices', options)
14
+ get("v1/orgDevices", options)
15
+ end
16
+
17
+ # Retrieves information about a specific device in the organization.
18
+ #
19
+ # @param options [Hash] Optional query parameters to filter or paginate results.
20
+ # - fields: (Array) Array of fields to include in the response.
21
+ # @return [<Hash>] A device and its selected attributes.
22
+ #
23
+ # See: https://developer.apple.com/documentation/applebusinessmanagerapi/get-orgdevice-information
24
+ # See: https://developer.apple.com/documentation/appleschoolmanagerapi/get-orgdevice-information
25
+ def device(id, options = {})
26
+ get("/v1/orgDevices/#{id}", options)
15
27
  end
16
28
  end
17
29
  end
data/lib/axm/client.rb CHANGED
@@ -8,6 +8,8 @@ require 'axm/client/organization_devices'
8
8
 
9
9
  module Axm
10
10
  class Client
11
+ include OrganizationDevices
12
+
11
13
  # Initializes a new instance of the AXM client.
12
14
  #
13
15
  # @param private_key [String] The private key used for authentication.
@@ -95,7 +97,6 @@ module Axm
95
97
 
96
98
  response_body = response.first if response.last.to_i == 200
97
99
 
98
- require 'pry'; binding.pry
99
100
  token = response_body.merge!({ 'expires_at' => Time.now.utc + response_body['expires_in'] })
100
101
 
101
102
  Secret.write('stub_access_token', token.to_json)
@@ -153,22 +154,9 @@ module Axm
153
154
 
154
155
  response_json = JSON.parse(response.body)
155
156
 
156
- require 'pry'; binding.pry
157
157
  raise 'Invalid request' if response_json['error'] == 'invalid_request'
158
158
 
159
159
  [response_json, response.code]
160
160
  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
161
  end
174
162
  end
data/lib/axm/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Axm
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.2"
5
5
  end
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.0
4
+ version: 0.1.2
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.5.22
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