sophos_central_api 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 04451b9de1b30bc8215d2ba53c65dc525e8d26e1ab0c9029aee862226af6f51b
4
+ data.tar.gz: 4cf4dbe623d1938faeaf5b53287726276b64dd5cc81b3911dfb0ec033498c31b
5
+ SHA512:
6
+ metadata.gz: 5bd33c2679d91ad9735a9b6e8ed28720da5f630a532ca8437449e4270b8dc9b89ead74f7d328403835d64ca070e37b524665637bb5171150a90e6613d8545116
7
+ data.tar.gz: 8cb69af1e71db88d60772dd6b3d3a2112bb2787a8333913e4e86b2e25130c03ad3620b167c17ceedabd58b89db931c895c36e203d16b4d8d32ae0976e2d1ef65
data/.env.template ADDED
@@ -0,0 +1,2 @@
1
+ SOPHOS_CLIENT_ID=<SOPHOS_CLIENT_ID>
2
+ SOPHOS_CLIENT_SECRET=<SOPHOS_CLIENT_SECRET>
data/.gitignore ADDED
@@ -0,0 +1,44 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+ /data/
13
+ *.log
14
+ *.txt
15
+ *.json
16
+ *.yml
17
+
18
+ # Used by dotenv library to load environment variables.
19
+ .env
20
+
21
+
22
+ ## Documentation cache and generated files:
23
+ /.yardoc/
24
+ /_yardoc/
25
+ /doc/
26
+ /rdoc/
27
+
28
+ ## Environment normalization:
29
+ /.bundle/
30
+ /vendor/bundle
31
+ /lib/bundler/man/
32
+
33
+ # for a library or gem, you might want to ignore these files since the code is
34
+ # intended to run in multiple environments; otherwise, check them in:
35
+ # Gemfile.lock
36
+ # .ruby-version
37
+ # .ruby-gemset
38
+
39
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
40
+ .rvmrc
41
+
42
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
43
+ # .rubocop-https?--*
44
+ Gemfile.lock
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-02-14
4
+ - Initial release
5
+
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in cloudally.gemspec
6
+ gemspec
7
+
8
+ gem 'rake', '~> 13.0'
9
+ gem 'rubocop', '~> 1.7'
10
+ gem 'wrapi'
data/README.md ADDED
@@ -0,0 +1,102 @@
1
+ # Sophos Central Partner API
2
+
3
+ This is a wrapper for the Sophos Central Partner API. You can see the API endpoints here https://developer.sophos.com/getting-started
4
+
5
+ Currently only the GET requests to customers, endpoints and alerts are implemented (readonly).
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'sophos_partner_api'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install sophos_partner_api
22
+
23
+ ## Usage
24
+
25
+ Before you start making the requests to API provide the client id and client secret and email/password using the configuration wrapping.
26
+
27
+ ```
28
+ require 'sophos_partner_api'
29
+
30
+ Sophos.configure do |config|
31
+ config.client_id = ENV["SOPHOS_CLIENT_ID"]
32
+ config.client_secret = ENV["SOPHOS_CLIENT_SECRET"]
33
+ end
34
+ @client = Sophos.client()
35
+ @client.login
36
+
37
+ tenants = @client.tenants
38
+
39
+ tenants.each do |t|
40
+ puts "#{t.name}"
41
+ end
42
+ ```
43
+
44
+ ## Resources
45
+ ### Authentication
46
+ ```
47
+ # setup configuration
48
+ #
49
+ client.login
50
+ ```
51
+ |Resource|API endpoint|Description|
52
+ |:--|:--|:--|
53
+ |.login||
54
+
55
+
56
+ ### Partner
57
+ Endpoint for partner related requests
58
+ ```
59
+ roles = client.roles
60
+ ```
61
+
62
+ |Resource|API endpoint|
63
+ |:--|:--|
64
+ |.tenants, .tenant(id) |/partner/v1/tenants/{id}|
65
+ |.roles, .role(id) |/partner/v1/roles/{id}|
66
+ |.admins, .admin(id) |/partner/v1/admins/{id}|
67
+ |.admin_role_assignments(admin_id)|/partner/v1/admins/{admin_id}/role-assignments|
68
+ |.admin_role_assignment(admin_id,assignment_id)|/partner/v1/admins/{admin_id}/role-assignments/{assignment_id}|
69
+ |.permission_sets |/partner/v1/roles/permission-sets|
70
+ |.billing_usage(year, month) |/partner/v1/billing-usage/{year}/{month}|
71
+
72
+
73
+ ### Endpoints
74
+ Returns endpoint for a provided tenant
75
+ ```
76
+ @client = Sophos.client()
77
+ @client.login
78
+ :
79
+ tenant = @client.tenant(id)
80
+ @client.tenant(tenant).endpoints
81
+
82
+ ```
83
+
84
+ |Resource|API endpoint|
85
+ |:--|:--|
86
+
87
+ |.downloads |.../downloads/|
88
+ |.endpoint_groups, .endpoint_group(id) |.../endpoint-groupss/|
89
+ |.migrations, .migration(id) |.../migrations|
90
+ |.migration_endpoints(migration_id) |.../migrations/{migration_id}/endpoints|
91
+ |.policies, .policy(id) |.../policies/{id}|
92
+ |.endpoints |.../endpoints|
93
+ |.endpoint_isolation(endpoint_id) |.../endpoints/{id}/isolation|
94
+ |.endpoint_tamper_protection(endpoint_id)|.../endpoints/{id}/tamper-protection|
95
+
96
+ ## Contributing
97
+
98
+ Bug reports and pull requests are welcome on GitHub at https://github.com/jancotanis/sophos.
99
+
100
+ ## License
101
+
102
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rake/testtask'
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << 'test'
8
+ t.libs << 'lib'
9
+ t.test_files = FileList['test/**/*_test.rb']
10
+ end
11
+
12
+ require 'rubocop/rake_task'
13
+ RuboCop::RakeTask.new
14
+ task default: %i[test rubocop]
data/lib/sophos/api.rb ADDED
@@ -0,0 +1,33 @@
1
+ require "wrapi"
2
+ require File.expand_path('configuration', __dir__)
3
+ require File.expand_path('authentication', __dir__)
4
+
5
+ module Sophos
6
+ # @private
7
+
8
+ class API
9
+ # @private
10
+ attr_accessor *Configuration::VALID_OPTIONS_KEYS
11
+
12
+ # Creates a new API and copies settings from singleton
13
+ def initialize(options = {})
14
+ options = Sophos.options.merge(options)
15
+ Configuration::VALID_OPTIONS_KEYS.each do |key|
16
+ send("#{key}=", options[key])
17
+ end
18
+ end
19
+
20
+ def config
21
+ conf = {}
22
+ Configuration::VALID_OPTIONS_KEYS.each do |key|
23
+ conf[key] = send key
24
+ end
25
+ conf
26
+ end
27
+
28
+ include Configuration
29
+ include WrAPI::Connection
30
+ include WrAPI::Request
31
+ include Authentication
32
+ end
33
+ end
@@ -0,0 +1,51 @@
1
+ require 'json'
2
+ require 'uri'
3
+
4
+ module Sophos
5
+ # Deals with authentication flow and stores it within global configuration
6
+ module Authentication
7
+
8
+ # Authorize to the Sophos portal and return access_token
9
+ # @see https://developer.sophos.com/getting-started
10
+ def auth_token(options = {})
11
+ # use id endpoint instead of global api
12
+ response = connection.post(id_endpoint+'/api/v2/oauth2/token') do |request|
13
+ request.headers['Content-Type'] = 'application/x-www-form-urlencoded'
14
+ request.body = URI.encode_www_form( api_access_token_params )
15
+ end
16
+ api_process_token(response.body)
17
+
18
+ # use default endpoint and replace it with global endpoint
19
+ partner = self.get( "/whoami/v1" )
20
+ if 'partner'.eql?(partner.idType) && partner.id
21
+ self.partner_id = partner.id
22
+ self.endpoint = partner.apiHosts.global
23
+ self.connection_options = { headers: { 'X-partner-id': self.partner_id } }
24
+ else
25
+ raise raise StandardError.new 'Partner id not returned; response ' + response.to_s
26
+ end
27
+ end
28
+ alias login auth_token
29
+
30
+ private
31
+
32
+ def api_access_token_params
33
+ {
34
+ grant_type: 'client_credentials',
35
+ client_id: client_id,
36
+ client_secret: client_secret,
37
+ scope: 'token'
38
+ }
39
+ end
40
+
41
+ def api_process_token(response)
42
+ at = self.access_token = response['access_token']
43
+ self.token_type = response['token_type']
44
+ self.refresh_token = response['refresh_token']
45
+ self.token_expires = response['expires_in']
46
+ raise StandardError.new 'Could not find valid access_token; response ' + response.to_s if at.nil? || at.empty?
47
+
48
+ at
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,25 @@
1
+ module Sophos
2
+
3
+ class Client
4
+ require File.expand_path('helper', __dir__)
5
+ include Sophos::Client::Helper
6
+
7
+ # This is the OAS 3.0 specification for the Common API in Sophos Central.
8
+ # @see https://developer.sophos.com/docs/common-v1/1/overview
9
+ module Common
10
+
11
+ # @see https://developer.sophos.com/docs/common-v1/1/routes/alerts/get
12
+ Helper::def_api_call :alerts, Helper::common_url(:alerts)
13
+ # @see https://developer.sophos.com/docs/common-v1/1/routes/directory/user-groups/get
14
+ Helper::def_api_call :directory_user_groups, Helper::common_url('directory/user-groups')
15
+ def directory_user_group_users(group_id, params = {})
16
+ get_paged(Helper::common_url("directory/user-groups/#{group_id}/users"), params)
17
+ end
18
+ Helper::def_api_call :directory_users, Helper::common_url('directory/users')
19
+ def directory_user_groups(user_id, params = {})
20
+ get_paged(Helper::common_url("directory/users/#{user_id}/groups"), params)
21
+ end
22
+ # roles and admins can be retrieved using the partner api
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,40 @@
1
+ module Sophos
2
+ class Client
3
+ require File.expand_path('helper', __dir__)
4
+ include Sophos::Client::Helper
5
+
6
+ # Sophos Endpoint api
7
+ # @see https://developer.sophos.com/docs/endpoint-v1/1/overview
8
+ module Endpoint
9
+
10
+ # @see https://developer.sophos.com/docs/endpoint-v1/1/routes/downloads/get
11
+ Helper::def_api_call :downloads, Helper::endpoint_url(:downloads)
12
+
13
+ # @see https://developer.sophos.com/docs/endpoint-v1/1/routes/endpoint-groups/get
14
+ Helper::def_api_call :endpoint_groups, Helper::endpoint_url(:endpoint_groups), true
15
+ def endpoint_group_endpoints(group_id)
16
+ get_paged Helper::endpoint_url("endpoint-groups/#{group_id}/endpoints")
17
+ end
18
+
19
+ # @see https://developer.sophos.com/docs/endpoint-v1/1/routes/migrations/get
20
+ Helper::def_api_call :migrations, Helper::endpoint_url(:migrations), true
21
+ def migration_endpoints(migration_id)
22
+ get_paged Helper::endpoint_url("migrations/#{migration_id}/endpoints")
23
+ end
24
+
25
+ # @see https://developer.sophos.com/docs/endpoint-v1/1/routes/policies/get
26
+ Helper::def_api_call :policies, Helper::endpoint_url(:policies), true
27
+
28
+ # Get all the endpoints for the specified tenant. No endpoint method defined as this clashes with api endpoint method
29
+ # @see https://developer.sophos.com/docs/endpoint-v1/1/routes/endpoints/get
30
+ Helper::def_api_call :endpoints, Helper::endpoint_url(:endpoints), false
31
+ def endpoint_isolation(endpoint_id)
32
+ get Helper::endpoint_url("endpoints/#{endpoint_id}/isolation")
33
+ end
34
+ def endpoint_tamper_protection(endpoint_id)
35
+ get Helper::endpoint_url("endpoints/#{endpoint_id}/tamper-protection")
36
+ end
37
+
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,59 @@
1
+ module Sophos
2
+
3
+ # Generate generic api methods
4
+ class Client
5
+ module Helper
6
+
7
+ def self.sanitize method_name
8
+ method_name.to_s.gsub('_', '-')
9
+ end
10
+
11
+ def self.singular method_name
12
+ method_name = method_name.to_s.gsub(/s$/, '')
13
+ method_name.gsub(/ie$/, 'y').to_sym
14
+ end
15
+
16
+ def self.common_url(method)
17
+ "/common/v1/#{sanitize(method)}"
18
+ end
19
+
20
+ def self.endpoint_url(method)
21
+ "/endpoint/v1/#{sanitize(method)}"
22
+ end
23
+
24
+ def self.partner_url(method)
25
+ "/partner/v1/#{sanitize(method)}"
26
+ end
27
+
28
+ # generate end point for 'endpoint' and 'endpoints'
29
+ def self.def_api_call(method, url, id_field = false, paged = true)
30
+ if id_field
31
+ self.send(:define_method, method) do |id = nil, params = {}|
32
+ if id
33
+ get("#{url}/#{id}", params)
34
+ else
35
+ get_paged(url, params)
36
+ end
37
+ end
38
+ # strip trailing 's'
39
+ singlr = self.singular(method) #method.to_s.chop.to_sym
40
+ self.send(:define_method, singlr) do |id, params = {}|
41
+ get("#{url}/#{id}", params)
42
+ end
43
+ else
44
+ if paged
45
+ self.send(:define_method, method) do |params = {}|
46
+ get_paged(url, params)
47
+ end
48
+ else
49
+ self.send(:define_method, method) do |params = {}|
50
+ get(url, params)
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ end
57
+ end
58
+
59
+ end
@@ -0,0 +1,71 @@
1
+ module Sophos
2
+ class Client
3
+ require File.expand_path('helper', __dir__)
4
+ include Sophos::Client::Helper
5
+
6
+ # Sophos partner api
7
+ # @see https://developer.sophos.com/docs/partner-v1/1/overview
8
+ module Partner
9
+
10
+ def self.__def_partner_call(method, id_field = nil)
11
+ if id_field
12
+ self.send(:define_method, method) do |id = nil|
13
+ url = partner_url(method)
14
+ if id
15
+ get(partner_url("#{method}/#{id}"))
16
+ else
17
+ get_paged(url)
18
+ end
19
+ end
20
+ # strip trailing 's'
21
+ singular = method.to_s.chop.to_sym
22
+ self.send(:define_method, singular) do |id, params = nil|
23
+ get(partner_url("#{method}/#{id}", params))
24
+ end
25
+ else
26
+ self.send(:define_method, method) do
27
+ get_paged(partner_url(method))
28
+ end
29
+ end
30
+ end
31
+
32
+ # @see https://developer.sophos.com/docs/partner-v1/1/routes/tenants/get
33
+ Helper::def_api_call :tenants, Helper::partner_url(:tenants), true
34
+
35
+ # @see https://developer.sophos.com/docs/partner-v1/1/routes/roles/get
36
+ Helper::def_api_call :roles, Helper::partner_url(:roles), true
37
+
38
+ # @see https://developer.sophos.com/docs/partner-v1/1/routes/admins/get
39
+ Helper::def_api_call :admins, Helper::partner_url(:admins), true
40
+
41
+ # Get the list of role assignments for given admin.
42
+ # @see https://developer.sophos.com/docs/partner-v1/1/routes/admins/%7BadminId%7D/role-assignments/get
43
+ def admin_role_assignments(admin_id, params = {})
44
+ get(Helper::partner_url("admins/#{admin_id}/role-assignments"), params)
45
+ end
46
+ # Get the list of role assignments for given admin.
47
+ # @see https://developer.sophos.com/docs/partner-v1/1/routes/admins/%7BadminId%7D/role-assignments/%7BassignmentId%7D/get
48
+ def admin_role_assignment(admin_id, assignment_id, params = {})
49
+ get(Helper::partner_url("admins/#{admin_id}/role-assignments/#{assignment_id}"), params)
50
+ end
51
+
52
+
53
+ # List all the tenants for a partner
54
+ def permission_sets( params = {} )
55
+ get(Helper::partner_url('roles/permission-sets'), params)
56
+ end
57
+
58
+ # Usage report.
59
+ # @see https://developer.sophos.com/docs/partner-v1/1/routes/billing/usage/%7Byear%7D/%7Bmonth%7D/get
60
+ def billing_usage(year, month, params = {})
61
+ get_paged(Helper::partner_url("billing/usage/#{year}/#{month}"), params)
62
+ end
63
+
64
+ private
65
+
66
+ def __partner_url(method, id = nil)
67
+ "/partner/v1/#{method}"
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,30 @@
1
+
2
+
3
+ module Sophos
4
+
5
+ # Wrapper for the Sophos Central REST API
6
+ #
7
+ # @note All methods have been separated into modules and follow the same grouping used in api docs
8
+ # @see https://developer.sophos.com/getting-started
9
+ class Client < API
10
+ require File.expand_path('client/partner', __dir__)
11
+
12
+ def tenant_client( api_host, tenant_id )
13
+ TenantClient.new(self.config.merge({ access_token: access_token, endpoint: api_host, tenant_id: tenant_id, connection_options: { headers: { 'X-Tenant-ID': tenant_id } } }))
14
+ end
15
+
16
+ include Sophos::Client::Partner
17
+
18
+ end
19
+
20
+ # Wrapper for the Sophos Central REST API for tenant related calls
21
+ #
22
+ # @note All methods have been separated into modules and follow the same grouping used in api docs
23
+ # @see https://developer.sophos.com/getting-started
24
+ class TenantClient < Client
25
+ require File.expand_path('client/common', __dir__)
26
+ require File.expand_path('client/endpoint', __dir__)
27
+ include Sophos::Client::Common
28
+ include Sophos::Client::Endpoint
29
+ end
30
+ end
@@ -0,0 +1,21 @@
1
+ require 'wrapi'
2
+
3
+ module Sophos
4
+ # Defines constants and methods related to configuration
5
+ module Configuration
6
+ include WrAPI::Configuration
7
+
8
+ # An array of additional valid keys in the options hash when configuring a {Sophos::API}
9
+ VALID_OPTIONS_KEYS = (WrAPI::Configuration::VALID_OPTIONS_KEYS + [:partner_id, :tenant_id, :id_endpoint]).freeze
10
+
11
+ # @private
12
+ attr_accessor *VALID_OPTIONS_KEYS
13
+
14
+ # Reset all configuration options to defaults
15
+ def reset
16
+ super
17
+ self.partner_id = nil
18
+ end
19
+ end
20
+ end
21
+
@@ -0,0 +1,63 @@
1
+ require 'json'
2
+
3
+ module Sophos
4
+ # Defines HTTP request methods
5
+ # required attributes format
6
+ module RequestPagination
7
+
8
+ # Sophos uses different pagination for global api and tenant api
9
+ #
10
+ # response structure:
11
+ # { "pages": {
12
+ # "current": 1, # page no - not laways present
13
+ # "size": 50,
14
+ # "total": 3, # not always present - pages
15
+ # "items": 123, # not always present - records
16
+ # "maxSize": 100
17
+ # },
18
+ # "items": []
19
+ #
20
+ class PagesPagination
21
+ attr_reader :current, :total, :page_size
22
+
23
+ def initialize(page_size)
24
+ # ignore page size
25
+ @page_size = page_size
26
+ @total = @current = 1
27
+ end
28
+
29
+ def page_options
30
+ { 'page': @current, 'pageSize': @page_size, 'pageTotal': true }
31
+ end
32
+
33
+ def next_page!(data)
34
+
35
+ pages = page_info(data)
36
+ if pages
37
+ @total = pages['total'].to_i
38
+ if pages['current']
39
+ @current = pages['current'].to_i + 1
40
+ else
41
+ @current += 1
42
+ end
43
+ else
44
+ # no page info so assume single page request
45
+ @total = 0
46
+ end
47
+ end
48
+
49
+ def page_info(body)
50
+ body['pages']
51
+ end
52
+
53
+ def self.data(body)
54
+ body['items'] ? body['items'] : body
55
+ end
56
+
57
+ # only single page available
58
+ def more_pages?
59
+ @current <= @total
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Sophos
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,37 @@
1
+ require "wrapi"
2
+ require File.expand_path('sophos/api', __dir__)
3
+ require File.expand_path('sophos/client', __dir__)
4
+ require File.expand_path('sophos/pagination', __dir__)
5
+ require File.expand_path('sophos/version', __dir__)
6
+
7
+ module Sophos
8
+ extend Configuration
9
+ extend WrAPI::RespondTo
10
+
11
+ DEFAULT_ENDPOINT = 'https://api.central.sophos.com'.freeze
12
+ DEFAULT_ID_ENDPOINT = 'https://id.sophos.com'.freeze
13
+ DEFAULT_UA = "Sophos Ruby API wrapper #{Sophos::VERSION}".freeze
14
+ DEFAULT_PAGINATION = Sophos::RequestPagination::PagesPagination
15
+ DEFAULT_PAGE_SIZE = 100
16
+
17
+ #
18
+ # @return [Sophos::Client]
19
+ def self.client(options = {})
20
+ Sophos::Client.new({
21
+ endpoint: DEFAULT_ENDPOINT,
22
+ id_endpoint: DEFAULT_ID_ENDPOINT,
23
+ user_agent: DEFAULT_UA,
24
+ page_size: DEFAULT_PAGE_SIZE,
25
+ pagination_class: DEFAULT_PAGINATION
26
+ }.merge(options))
27
+ end
28
+
29
+ def self.reset
30
+ super
31
+ self.endpoint = DEFAULT_ENDPOINT
32
+ self.id_endpoint = DEFAULT_ID_ENDPOINT
33
+ self.user_agent = DEFAULT_UA
34
+ self.page_size = DEFAULT_PAGE_SIZE
35
+ self.pagination_class = DEFAULT_PAGINATION
36
+ end
37
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative 'lib/sophos/version'
4
+
5
+ Gem::Specification.new do |s|
6
+ s.name = 'sophos_central_api'
7
+ s.version = Sophos::VERSION
8
+ s.authors = ['Janco Tanis']
9
+ s.email = 'gems@jancology.com'
10
+ s.license = 'MIT'
11
+
12
+ s.summary = 'A Ruby wrapper for the Sophos Central REST APIs (readonly)'
13
+ s.homepage = 'https://rubygems.org/gems/sophos'
14
+
15
+ s.required_ruby_version = Gem::Requirement.new('>= 2.4.0')
16
+
17
+ s.metadata['homepage_uri'] = s.homepage
18
+ s.metadata['source_code_uri'] = 'https://github.com/jancotanis/sophos'
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ s.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
24
+ end
25
+ s.bindir = 'exe'
26
+ s.executables = s.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
27
+ s.require_paths = ['lib']
28
+
29
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
30
+ s.platform = Gem::Platform::RUBY
31
+ s.add_runtime_dependency 'faraday'
32
+ s.add_runtime_dependency 'wrapi', ">= 0.3.0"
33
+ s.add_development_dependency 'dotenv'
34
+ s.add_development_dependency 'minitest'
35
+ s.add_development_dependency 'rubocop'
36
+ end
metadata ADDED
@@ -0,0 +1,132 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sophos_central_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Janco Tanis
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-02-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: wrapi
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 0.3.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: dotenv
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: minitest
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
+ - !ruby/object:Gem::Dependency
70
+ name: rubocop
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ description:
84
+ email: gems@jancology.com
85
+ executables: []
86
+ extensions: []
87
+ extra_rdoc_files: []
88
+ files:
89
+ - ".env.template"
90
+ - ".gitignore"
91
+ - CHANGELOG.md
92
+ - Gemfile
93
+ - README.md
94
+ - Rakefile
95
+ - lib/sophos/api.rb
96
+ - lib/sophos/authentication.rb
97
+ - lib/sophos/client.rb
98
+ - lib/sophos/client/common.rb
99
+ - lib/sophos/client/endpoint.rb
100
+ - lib/sophos/client/helper.rb
101
+ - lib/sophos/client/partner.rb
102
+ - lib/sophos/configuration.rb
103
+ - lib/sophos/pagination.rb
104
+ - lib/sophos/version.rb
105
+ - lib/sophos_central_api.rb
106
+ - sophos_central_api.gemspec
107
+ homepage: https://rubygems.org/gems/sophos
108
+ licenses:
109
+ - MIT
110
+ metadata:
111
+ homepage_uri: https://rubygems.org/gems/sophos
112
+ source_code_uri: https://github.com/jancotanis/sophos
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: 2.4.0
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubygems_version: 3.2.12
129
+ signing_key:
130
+ specification_version: 4
131
+ summary: A Ruby wrapper for the Sophos Central REST APIs (readonly)
132
+ test_files: []