integra365 0.2.0 → 0.4.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 +4 -4
- data/CHANGELOG.md +13 -1
- data/Gemfile +1 -1
- data/README.md +34 -8
- data/lib/integra365/api.rb +3 -1
- data/lib/integra365/authentication.rb +6 -5
- data/lib/integra365/client/backup_job_reporting.rb +3 -2
- data/lib/integra365/client/backup_jobs.rb +34 -0
- data/lib/integra365/client/tenants.rb +5 -2
- data/lib/integra365/client.rb +5 -0
- data/lib/integra365/const.rb +31 -0
- data/lib/integra365/error.rb +3 -2
- data/lib/integra365/version.rb +1 -1
- data/lib/integra365.rb +5 -3
- metadata +5 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b872e0f6b5f05ab04116db74078c1c70bacecfd596c8a268c93e0dce47df35a
|
4
|
+
data.tar.gz: 7522cac01bff0f2f86d11b962ff62baa0223707187698b5760056a3027718fb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: feb5d102d898512bb2aa05f5001c952f26817379a69e5370c3aee76d2a27e5248ae60dcad54e1632a29414dd0ddc35bd5241061d6a57afc9b2a50234e1a0f73c
|
7
|
+
data.tar.gz: 5c6c963dee2b09c51bbab1dae62b76d2ad9eb9a30307a1560e167f607166641806add2a0ae8f2add89d25814a4eb105cd22844f364a05c48140a238b6536756e
|
data/CHANGELOG.md
CHANGED
@@ -1,11 +1,23 @@
|
|
1
|
-
|
1
|
+
# Changelog
|
2
2
|
|
3
3
|
## [0.1.0] - 2024-02-05
|
4
|
+
|
4
5
|
- Initial release
|
5
6
|
|
6
7
|
## [0.1.1] - 2024-02-09
|
8
|
+
|
7
9
|
- new wrapi dependency for paging
|
8
10
|
|
9
11
|
## [0.2.0] - 2024-02-20
|
12
|
+
|
10
13
|
- Exception harmonization
|
11
14
|
|
15
|
+
## [0.3.0] - 2025-03-20
|
16
|
+
|
17
|
+
- Add backup job api
|
18
|
+
- fix issues with http error codes bad request vs unauthorized
|
19
|
+
|
20
|
+
## [0.4.0] - 2025-09-08
|
21
|
+
|
22
|
+
- Add backup job sessions api
|
23
|
+
- Add constants for list type and last backup state
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,11 +1,14 @@
|
|
1
1
|
# Integra Office365 backup API
|
2
|
+
|
2
3
|
[](https://rubygems.org/gems/integra365)
|
3
4
|
[](https://codeclimate.com/github/jancotanis/integra365/maintainability)
|
4
5
|
[](https://codeclimate.com/github/jancotanis/integra365/test_coverage)
|
5
6
|
|
6
|
-
This is a wrapper for the Integra Office365 backup API.
|
7
|
+
This is a wrapper for the Integra Office365 backup API.
|
8
|
+
You can see the [API endpoints](https://api.integra-bcs.nl/swagger/index.html).
|
7
9
|
|
8
|
-
Currently only the GET requests to get a list of tenants and backup job reports
|
10
|
+
Currently only the GET requests to get a list of tenants and backup job reports
|
11
|
+
are implemented.
|
9
12
|
|
10
13
|
## Installation
|
11
14
|
|
@@ -17,15 +20,20 @@ gem 'integra365'
|
|
17
20
|
|
18
21
|
And then execute:
|
19
22
|
|
20
|
-
|
23
|
+
```console
|
24
|
+
> bundle install
|
25
|
+
```
|
21
26
|
|
22
27
|
Or install it yourself as:
|
23
28
|
|
24
|
-
|
29
|
+
```console
|
30
|
+
> gem install integra365
|
31
|
+
```
|
25
32
|
|
26
33
|
## Usage
|
27
34
|
|
28
|
-
Before you start making the requests to API provide the client id and client secret and
|
35
|
+
Before you start making the requests to API provide the client id and client secret and
|
36
|
+
email/password using the configuration wrapping.
|
29
37
|
|
30
38
|
```ruby
|
31
39
|
require 'integra365'
|
@@ -45,19 +53,24 @@ end
|
|
45
53
|
```
|
46
54
|
|
47
55
|
## Resources
|
56
|
+
|
48
57
|
### Authentication
|
58
|
+
|
49
59
|
```ruby
|
50
60
|
# setup configuration
|
51
61
|
#
|
52
62
|
client.login
|
53
63
|
```
|
64
|
+
|
54
65
|
|Resource|API endpoint|Description|
|
55
66
|
|:--|:--|:--|
|
56
|
-
|.token or .login|/Api/V1/Token
|
67
|
+
|.token or .login|/Api/V1/Token|portal user|
|
57
68
|
|.token_refresh|/Api/V1/Token/Refresh|Refresh authentication token|
|
58
69
|
|
59
70
|
### Tenant
|
60
|
-
|
71
|
+
|
72
|
+
Endpoint for tenant related requests
|
73
|
+
|
61
74
|
```ruby
|
62
75
|
licenses = client.tenant_licenses
|
63
76
|
```
|
@@ -69,8 +82,21 @@ licenses = client.tenant_licenses
|
|
69
82
|
|.tenant_licenses(id) |/Api/V1/Tenants/{id}/Licenses|
|
70
83
|
|.tenant_storage(id)|/Api/V1/Tenants/{id}/Storage|
|
71
84
|
|
85
|
+
### BackupJobs
|
86
|
+
|
87
|
+
Get list of backup jobs or by id and state
|
88
|
+
|
89
|
+
|Resource|API endpoint|
|
90
|
+
|:--|:--|
|
91
|
+
|.backup_jobs|/Api/V1/BackupJobs|
|
92
|
+
|.backup_job(id) .tenant(id)|/Api/V1/BackupJobs/{id}|
|
93
|
+
|.backup_job_state(id)|/Api/V1/BackupJobs/{id}/State|
|
94
|
+
|.backup_job_sessions(id)|/Api/V1/BackupJobs/{id}/Sessions|
|
95
|
+
|
72
96
|
### BackupJobReporting
|
97
|
+
|
73
98
|
BackupJobReporting for status of backup jobs
|
99
|
+
|
74
100
|
```ruby
|
75
101
|
job_statuses = client.backup_job_reporting
|
76
102
|
|
@@ -82,7 +108,7 @@ job_statuses = client.backup_job_reporting
|
|
82
108
|
|
83
109
|
## Contributing
|
84
110
|
|
85
|
-
Bug reports and pull requests are welcome on GitHub
|
111
|
+
Bug reports and pull requests are welcome on [GitHub](https://github.com/jancotanis/integra365).
|
86
112
|
|
87
113
|
## License
|
88
114
|
|
data/lib/integra365/api.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require File.expand_path('error', __dir__)
|
2
4
|
|
3
5
|
module Integra365
|
@@ -6,9 +8,9 @@ module Integra365
|
|
6
8
|
# Authorize to the Integra365 portal and return access_token
|
7
9
|
def token(options = {})
|
8
10
|
raise ConfigurationError.new 'Client id and/or secret not configured' unless self.username && self.password
|
9
|
-
api_auth('Token', options)
|
10
|
-
rescue Faraday::BadRequestError => e
|
11
11
|
|
12
|
+
api_auth('Token', options)
|
13
|
+
rescue Faraday::BadRequestError, Faraday::UnauthorizedError => e
|
12
14
|
raise AuthenticationError.new 'Unauthorized; response ' + e.to_s
|
13
15
|
end
|
14
16
|
alias login token
|
@@ -17,9 +19,8 @@ module Integra365
|
|
17
19
|
# token currrent token
|
18
20
|
def token_refresh(token)
|
19
21
|
api_refresh('Token/Refresh', token)
|
20
|
-
rescue Faraday::BadRequestError => e
|
21
|
-
|
22
|
-
raise AuthenticationError.new 'Unauthorized; response ' + e.to_s
|
22
|
+
rescue Faraday::BadRequestError, Faraday::UnauthorizedError => e
|
23
|
+
raise AuthenticationError.new 'Unauthorized; response #{e}'
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
@@ -1,12 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Integra365
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Defines methods related to backup job reporting
|
5
6
|
# @see https://api.integra-bcs.nl/swagger/index.html
|
6
7
|
module BackupJobReporting
|
7
8
|
# Get all backupjob reports
|
8
9
|
def backup_job_reporting
|
9
|
-
get(
|
10
|
+
get('BackupJobReporting')
|
10
11
|
end
|
11
12
|
end
|
12
13
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Integra365
|
4
|
+
class Client
|
5
|
+
# Defines methods related to backup job reporting
|
6
|
+
# @see https://api.integra-bcs.nl/swagger/index.html
|
7
|
+
module BackupJobs
|
8
|
+
# Get all backupjobs
|
9
|
+
def backup_jobs
|
10
|
+
get('BackupJobs')
|
11
|
+
end
|
12
|
+
|
13
|
+
# Get backupjob by id
|
14
|
+
def backup_job(id)
|
15
|
+
get("BackupJobs/#{id}")
|
16
|
+
end
|
17
|
+
|
18
|
+
# Get backupjob state as string
|
19
|
+
def backup_job_state(id)
|
20
|
+
get("BackupJobs/#{id}/State")
|
21
|
+
end
|
22
|
+
|
23
|
+
# Get backupjob sessions
|
24
|
+
def backup_job_sessions(id)
|
25
|
+
get("BackupJobs/#{id}/Sessions")
|
26
|
+
end
|
27
|
+
|
28
|
+
# Get backupjob session
|
29
|
+
def backup_job_session(id, session_id)
|
30
|
+
get("BackupJobs/#{id}/Sessions/#{session_id}")
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Integra365
|
2
4
|
class Client
|
3
|
-
|
4
5
|
# Defines methods related to tenants
|
5
6
|
# @see https://api.integra-bcs.nl/swagger/index.html
|
6
7
|
module Tenants
|
@@ -9,9 +10,11 @@ module Integra365
|
|
9
10
|
if id
|
10
11
|
get("Tenants/#{id}")
|
11
12
|
else
|
12
|
-
get(
|
13
|
+
get('Tenants')
|
13
14
|
end
|
14
15
|
end
|
16
|
+
|
17
|
+
# Get tenant by id
|
15
18
|
def tenant(id)
|
16
19
|
tenants(id)
|
17
20
|
end
|
data/lib/integra365/client.rb
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require File.expand_path('const', __dir__)
|
4
|
+
|
1
5
|
module Integra365
|
2
6
|
# Wrapper for the Integra365 REST API
|
3
7
|
#
|
@@ -7,6 +11,7 @@ module Integra365
|
|
7
11
|
Dir[File.expand_path('client/*.rb', __dir__)].each { |f| require f }
|
8
12
|
|
9
13
|
include Integra365::Client::Tenants
|
14
|
+
include Integra365::Client::BackupJobs
|
10
15
|
include Integra365::Client::BackupJobReporting
|
11
16
|
end
|
12
17
|
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Integra365
|
4
|
+
class Enum
|
5
|
+
def self.enum(array, proc=:to_s)
|
6
|
+
array.each do |c|
|
7
|
+
const_set c.upcase,c
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
# Represents different session line types
|
13
|
+
class BackupJobStatus < Enum
|
14
|
+
enum %w[Success Warning Error Running]
|
15
|
+
end
|
16
|
+
|
17
|
+
# Represents different session line types
|
18
|
+
class SessionListTypes
|
19
|
+
# Session is
|
20
|
+
RUNNING = 0
|
21
|
+
# Warning description
|
22
|
+
WARNING = 1
|
23
|
+
# Error description
|
24
|
+
ERROR = 2
|
25
|
+
# Succes line
|
26
|
+
SUCCESS = 3
|
27
|
+
# Session stopped
|
28
|
+
STOP = 4
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
data/lib/integra365/error.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Integra365
|
2
|
-
|
3
4
|
# Generic error to be able to rescue all Integra365 errors
|
4
5
|
class Integra365Error < StandardError; end
|
5
6
|
|
@@ -8,4 +9,4 @@ module Integra365
|
|
8
9
|
|
9
10
|
# Error when authentication fails
|
10
11
|
class AuthenticationError < Integra365Error; end
|
11
|
-
end
|
12
|
+
end
|
data/lib/integra365/version.rb
CHANGED
data/lib/integra365.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'wrapi'
|
2
4
|
require File.expand_path('integra365/api', __dir__)
|
3
5
|
require File.expand_path('integra365/client', __dir__)
|
4
6
|
require File.expand_path('integra365/version', __dir__)
|
@@ -7,8 +9,8 @@ module Integra365
|
|
7
9
|
extend WrAPI::Configuration
|
8
10
|
extend WrAPI::RespondTo
|
9
11
|
|
10
|
-
DEFAULT_ENDPOINT = 'https://api.integra-bcs.nl/Api/V1/'
|
11
|
-
DEFAULT_UA = "Integra365 Ruby API wrapper #{Integra365::VERSION}"
|
12
|
+
DEFAULT_ENDPOINT = 'https://api.integra-bcs.nl/Api/V1/'
|
13
|
+
DEFAULT_UA = "Integra365 Ruby API wrapper #{Integra365::VERSION}"
|
12
14
|
|
13
15
|
# Alias for Integra365::Client.new
|
14
16
|
#
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: integra365
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janco Tanis
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-09-08 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: faraday
|
@@ -94,7 +93,6 @@ dependencies:
|
|
94
93
|
- - ">="
|
95
94
|
- !ruby/object:Gem::Version
|
96
95
|
version: '0'
|
97
|
-
description:
|
98
96
|
email: gems@jancology.com
|
99
97
|
executables: []
|
100
98
|
extensions: []
|
@@ -113,7 +111,9 @@ files:
|
|
113
111
|
- lib/integra365/authentication.rb
|
114
112
|
- lib/integra365/client.rb
|
115
113
|
- lib/integra365/client/backup_job_reporting.rb
|
114
|
+
- lib/integra365/client/backup_jobs.rb
|
116
115
|
- lib/integra365/client/tenants.rb
|
116
|
+
- lib/integra365/const.rb
|
117
117
|
- lib/integra365/error.rb
|
118
118
|
- lib/integra365/version.rb
|
119
119
|
homepage: https://rubygems.org/gems/integra365
|
@@ -122,7 +122,6 @@ licenses:
|
|
122
122
|
metadata:
|
123
123
|
homepage_uri: https://rubygems.org/gems/integra365
|
124
124
|
source_code_uri: https://github.com/jancotanis/integra365
|
125
|
-
post_install_message:
|
126
125
|
rdoc_options: []
|
127
126
|
require_paths:
|
128
127
|
- lib
|
@@ -137,8 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
136
|
- !ruby/object:Gem::Version
|
138
137
|
version: '0'
|
139
138
|
requirements: []
|
140
|
-
rubygems_version: 3.2
|
141
|
-
signing_key:
|
139
|
+
rubygems_version: 3.6.2
|
142
140
|
specification_version: 4
|
143
141
|
summary: A Ruby wrapper for the Integra36 backup Portal REST APIs (readonly)
|
144
142
|
test_files: []
|