integra365 0.1.0 → 0.2.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 +7 -0
- data/Gemfile +1 -0
- data/README.md +7 -4
- data/Rakefile +8 -0
- data/bin/cc-test-reporter.exe +0 -0
- data/integra365.gemspec +2 -1
- data/lib/integra365/authentication.rb +10 -2
- data/lib/integra365/error.rb +11 -0
- data/lib/integra365/version.rb +1 -1
- data/lib/integra365.rb +11 -2
- metadata +22 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f47672ce28d07c8052f4012a30e06b034c7a7d05d7d4251bcd16cfc75e420eeb
|
4
|
+
data.tar.gz: 1a08657cc42716f7ee24bd49a6b3edfbb05a0f0e803180583f5e64e4d681fcdb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d38d1a982e490ca349e3eb7e1aa83db407148fec053e4b83f3947739387d931519839becf51cf3a7fc0fc815435a08ebbb0f5defb50a04f393025cb6959af0ea
|
7
|
+
data.tar.gz: 33aee28e333f7fd0d71853eb0c26e424a86abbd5c635d6b9cd2aa538d503aee2daab12abe3613c744f71cef011fbbb23177fa8d49ac056556e905ad6703b810d
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# Integra Office365 backup API
|
2
|
+
[](https://rubygems.org/gems/integra365)
|
3
|
+
[](https://codeclimate.com/github/jancotanis/integra365/maintainability)
|
4
|
+
[](https://codeclimate.com/github/jancotanis/integra365/test_coverage)
|
2
5
|
|
3
6
|
This is a wrapper for the Integra Office365 backup API. You can see the API endpoints here https://api.integra-bcs.nl/swagger/index.html
|
4
7
|
|
@@ -24,7 +27,7 @@ Or install it yourself as:
|
|
24
27
|
|
25
28
|
Before you start making the requests to API provide the client id and client secret and email/password using the configuration wrapping.
|
26
29
|
|
27
|
-
```
|
30
|
+
```ruby
|
28
31
|
require 'integra365'
|
29
32
|
|
30
33
|
Integra365.configure do |config|
|
@@ -43,7 +46,7 @@ end
|
|
43
46
|
|
44
47
|
## Resources
|
45
48
|
### Authentication
|
46
|
-
```
|
49
|
+
```ruby
|
47
50
|
# setup configuration
|
48
51
|
#
|
49
52
|
client.login
|
@@ -55,7 +58,7 @@ client.login
|
|
55
58
|
|
56
59
|
### Tenant
|
57
60
|
Endpoint for tenant related requests
|
58
|
-
```
|
61
|
+
```ruby
|
59
62
|
licenses = client.tenant_licenses
|
60
63
|
```
|
61
64
|
|
@@ -68,7 +71,7 @@ licenses = client.tenant_licenses
|
|
68
71
|
|
69
72
|
### BackupJobReporting
|
70
73
|
BackupJobReporting for status of backup jobs
|
71
|
-
```
|
74
|
+
```ruby
|
72
75
|
job_statuses = client.backup_job_reporting
|
73
76
|
|
74
77
|
```
|
data/Rakefile
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
|
+
require 'dotenv'
|
4
5
|
require 'rake/testtask'
|
5
6
|
|
7
|
+
Dotenv.load
|
8
|
+
|
9
|
+
system './bin/cc-test-reporter before-build'
|
10
|
+
|
6
11
|
Rake::TestTask.new(:test) do |t|
|
7
12
|
t.libs << 'test'
|
8
13
|
t.libs << 'lib'
|
9
14
|
t.test_files = FileList['test/**/*_test.rb']
|
15
|
+
at_exit do
|
16
|
+
system './bin/cc-test-reporter after-build'
|
17
|
+
end
|
10
18
|
end
|
11
19
|
|
12
20
|
require 'rubocop/rake_task'
|
Binary file
|
data/integra365.gemspec
CHANGED
@@ -29,8 +29,9 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
30
30
|
s.platform = Gem::Platform::RUBY
|
31
31
|
s.add_runtime_dependency 'faraday'
|
32
|
-
s.add_runtime_dependency 'wrapi', "
|
32
|
+
s.add_runtime_dependency 'wrapi', ">= 0.2.0"
|
33
33
|
s.add_development_dependency 'dotenv'
|
34
34
|
s.add_development_dependency 'minitest'
|
35
35
|
s.add_development_dependency 'rubocop'
|
36
|
+
s.add_development_dependency 'simplecov'
|
36
37
|
end
|
@@ -1,17 +1,25 @@
|
|
1
|
+
require File.expand_path('error', __dir__)
|
1
2
|
|
2
3
|
module Integra365
|
3
4
|
# Deals with authentication flow and stores it within global configuration
|
4
5
|
module Authentication
|
5
6
|
# Authorize to the Integra365 portal and return access_token
|
6
7
|
def token(options = {})
|
7
|
-
|
8
|
+
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
|
+
|
12
|
+
raise AuthenticationError.new 'Unauthorized; response ' + e.to_s
|
8
13
|
end
|
9
14
|
alias login token
|
10
15
|
|
11
16
|
# Return an access token from authorization
|
12
17
|
# token currrent token
|
13
18
|
def token_refresh(token)
|
14
|
-
api_refresh(
|
19
|
+
api_refresh('Token/Refresh', token)
|
20
|
+
rescue Faraday::BadRequestError => e
|
21
|
+
|
22
|
+
raise AuthenticationError.new 'Unauthorized; response ' + e.to_s
|
15
23
|
end
|
16
24
|
end
|
17
25
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Integra365
|
2
|
+
|
3
|
+
# Generic error to be able to rescue all Integra365 errors
|
4
|
+
class Integra365Error < StandardError; end
|
5
|
+
|
6
|
+
# Raised when Integra365 not configured correctly
|
7
|
+
class ConfigurationError < Integra365Error; end
|
8
|
+
|
9
|
+
# Error when authentication fails
|
10
|
+
class AuthenticationError < Integra365Error; end
|
11
|
+
end
|
data/lib/integra365/version.rb
CHANGED
data/lib/integra365.rb
CHANGED
@@ -7,13 +7,22 @@ module Integra365
|
|
7
7
|
extend WrAPI::Configuration
|
8
8
|
extend WrAPI::RespondTo
|
9
9
|
|
10
|
+
DEFAULT_ENDPOINT = 'https://api.integra-bcs.nl/Api/V1/'.freeze
|
11
|
+
DEFAULT_UA = "Integra365 Ruby API wrapper #{Integra365::VERSION}".freeze
|
12
|
+
|
10
13
|
# Alias for Integra365::Client.new
|
11
14
|
#
|
12
15
|
# @return [Integra365::Client]
|
13
16
|
def self.client(options = {})
|
14
17
|
Integra365::Client.new({
|
15
|
-
endpoint:
|
16
|
-
user_agent:
|
18
|
+
endpoint: DEFAULT_ENDPOINT,
|
19
|
+
user_agent: DEFAULT_UA
|
17
20
|
}.merge(options))
|
18
21
|
end
|
22
|
+
|
23
|
+
def self.reset
|
24
|
+
super
|
25
|
+
self.endpoint = DEFAULT_ENDPOINT
|
26
|
+
self.user_agent = DEFAULT_UA
|
27
|
+
end
|
19
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: integra365
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Janco Tanis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-02-
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -28,16 +28,16 @@ dependencies:
|
|
28
28
|
name: wrapi
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: dotenv
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: simplecov
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
description:
|
84
98
|
email: gems@jancology.com
|
85
99
|
executables: []
|
@@ -92,6 +106,7 @@ files:
|
|
92
106
|
- Gemfile
|
93
107
|
- README.md
|
94
108
|
- Rakefile
|
109
|
+
- bin/cc-test-reporter.exe
|
95
110
|
- integra365.gemspec
|
96
111
|
- lib/integra365.rb
|
97
112
|
- lib/integra365/api.rb
|
@@ -99,6 +114,7 @@ files:
|
|
99
114
|
- lib/integra365/client.rb
|
100
115
|
- lib/integra365/client/backup_job_reporting.rb
|
101
116
|
- lib/integra365/client/tenants.rb
|
117
|
+
- lib/integra365/error.rb
|
102
118
|
- lib/integra365/version.rb
|
103
119
|
homepage: https://rubygems.org/gems/integra365
|
104
120
|
licenses:
|