kandji 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b139dcc224da457e0570035886561f9a16445dcceb5eb87cd777f673897c0ad5
4
- data.tar.gz: 290e44ba2e0e871ef2d9a8d33958e355208bbd65a5752b56f561bd1a757c7d03
3
+ metadata.gz: 528755a882fcf3d4e1f739f3d5aeb050eeccb82078925308eaae01fe47cdf041
4
+ data.tar.gz: 5ade57831d6f73d679f03ef2f8ea3dcc4b8512a2d5ea7fa4d456f19b308ef395
5
5
  SHA512:
6
- metadata.gz: 122742faf6495903b7174a671c781dc9ec310f83b6763c073e1d65defc2a7f239b861edc69fb42530bc1ef4b3bae6a506a0d0ab933b560d428a5e68269a6ba38
7
- data.tar.gz: 7471b5ddfd673a942f19369aa8be1ff3cf55fb5b222ee2bbbbd1cd89af24e2d541f65c6228fc7b0dc6c86f66303a6f55b6042664f411123b008aabe739a5c75c
6
+ metadata.gz: cf06423f2138261895b74dc7c17c7407783c2a9a739fa013b32cd69d248657709a918bc14441b993db6af9ecbc31b987d57ff05874abbe5cbf52e050971b5243
7
+ data.tar.gz: cac4df83de21b0b546bd5960456992d250de0a5844d85b658c70015cd6ad67e6de21723cd560ed46b03b5e7043bd04bcf27f1e8a7735273e803c69a927ba820a
data/CHANGELOG.md CHANGED
@@ -1,11 +1,16 @@
1
- ## [Unreleased]
1
+ ## [0.1.1]
2
2
 
3
- - Setup configuration
4
3
  - Implement endpoints:
5
- - Devices.all
6
- - Devices.find(device_id)
7
- - Device::Applications.all
4
+ - Devices::Activities.all
5
+ - Logs.all
6
+ - Users.all
7
+ - Users.find(id)
8
8
 
9
9
  ## [0.1.0] - 2025-05-06
10
10
 
11
11
  - Initial release
12
+ - Setup configuration
13
+ - Implement endpoints:
14
+ - Devices.all
15
+ - Devices.find(device_id)
16
+ - Device::Applications.all
data/README.md CHANGED
@@ -1,28 +1,36 @@
1
1
  # Kandji
2
2
 
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/kandji`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
3
  ## Installation
8
4
 
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
5
  Install the gem and add to the application's Gemfile by executing:
12
6
 
13
7
  ```bash
14
- bundle add UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
8
+ bundle add kandji
15
9
  ```
16
10
 
17
11
  If bundler is not being used to manage dependencies, install the gem by executing:
18
12
 
19
13
  ```bash
20
- gem install UPDATE_WITH_YOUR_GEM_NAME_IMMEDIATELY_AFTER_RELEASE_TO_RUBYGEMS_ORG
14
+ gem install kandji
21
15
  ```
22
16
 
23
17
  ## Usage
24
18
 
25
- TODO: Write usage instructions here
19
+ First you will have to confige the gem. You need to setup an API key on Kandji. Once you've retrieved that, you are ready:
20
+
21
+ ```ruby
22
+ Kandji.configure do |config|
23
+ config.api_token = 'your-api-token'
24
+ config.organization_url = 'your-kanjdi-api-url'
25
+ end
26
+ ```
27
+
28
+ Then once you have the client setup, you can call the API. Some examples:
29
+
30
+ ```ruby
31
+ Kandji::Applications.all
32
+ Kandji::Users.find(user_id)
33
+ ```
26
34
 
27
35
  ## Development
28
36
 
@@ -32,7 +40,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
40
 
33
41
  ## Contributing
34
42
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/kandji. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/kandji/blob/main/CODE_OF_CONDUCT.md).
43
+ Bug reports and pull requests are welcome on GitHub at https://github.com/monarchmoney/kandji. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/monarchmoney/kandji/blob/main/CODE_OF_CONDUCT.md).
36
44
 
37
45
  ## License
38
46
 
@@ -40,4 +48,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
40
48
 
41
49
  ## Code of Conduct
42
50
 
43
- Everyone interacting in the Kandji project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/kandji/blob/main/CODE_OF_CONDUCT.md).
51
+ Everyone interacting in the Kandji project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/monarchmoney/kandji/blob/main/CODE_OF_CONDUCT.md).
data/lib/kandji/client.rb CHANGED
@@ -27,6 +27,20 @@ module Kandji
27
27
  all_results
28
28
  end
29
29
 
30
+ def self.paginated_cursor_get(path, params = {})
31
+ params[:limit] = params[:limit] || 500
32
+ url = build_url(path, params)
33
+
34
+ all_results = []
35
+ loop do
36
+ response = JSON.parse(RestClient.get(url, headers))
37
+ all_results.concat(response["results"])
38
+ url = response["next"]
39
+ break unless url
40
+ end
41
+ all_results
42
+ end
43
+
30
44
  def self.build_url(path, params)
31
45
  url = "#{Kandji.organization_url}/api/#{API_VERSION}/#{path}"
32
46
  url += "?#{URI.encode_www_form(params)}" unless params.empty?
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kandji
4
+ module Device
5
+ class Activities < Client
6
+ def self.all(device_id)
7
+ paginated_get("devices/#{device_id}/activity")
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kandji
4
+ class Logs < Client
5
+ def self.all(params = {})
6
+ paginated_cursor_get("audit/events", params)
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Kandji
4
+ class Users < Client
5
+ def self.all(params = {})
6
+ paginated_cursor_get("users", params)
7
+ end
8
+
9
+ def self.find(id)
10
+ get("users/#{id}")
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kandji
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
data/lib/kandji.rb CHANGED
@@ -3,7 +3,11 @@
3
3
  require_relative "kandji/version"
4
4
  require_relative "kandji/configuration"
5
5
  require_relative "kandji/client"
6
- require_relative "kandji/api"
6
+ require_relative "kandji/devices"
7
+ require_relative "kandji/device/applications"
8
+ require_relative "kandji/logs"
9
+ require_relative "kandji/device/activities"
10
+ require_relative "kandji/users"
7
11
 
8
12
  module Kandji
9
13
  extend Configuration
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kandji
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
  - Lien Van Den Steen
@@ -52,11 +52,13 @@ files:
52
52
  - README.md
53
53
  - Rakefile
54
54
  - lib/kandji.rb
55
- - lib/kandji/api.rb
56
- - lib/kandji/api/device/applications.rb
57
- - lib/kandji/api/devices.rb
58
55
  - lib/kandji/client.rb
59
56
  - lib/kandji/configuration.rb
57
+ - lib/kandji/device/activities.rb
58
+ - lib/kandji/device/applications.rb
59
+ - lib/kandji/devices.rb
60
+ - lib/kandji/logs.rb
61
+ - lib/kandji/users.rb
60
62
  - lib/kandji/version.rb
61
63
  - sig/kandji.rbs
62
64
  homepage: https://github.com/monarchmoney/kandji
data/lib/kandji/api.rb DELETED
@@ -1,4 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative "api/devices"
4
- require_relative "api/device/applications"
File without changes
File without changes