integra365 0.1.1 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 286286718c5dbb03cc8f7c42fa96f2bb7aa8ab491f244a278b402f87b211c51c
4
- data.tar.gz: 24796e4d267be6b3af273949b97b67a764d7621a7a63981c7a67c81e5f291fd7
3
+ metadata.gz: f47672ce28d07c8052f4012a30e06b034c7a7d05d7d4251bcd16cfc75e420eeb
4
+ data.tar.gz: 1a08657cc42716f7ee24bd49a6b3edfbb05a0f0e803180583f5e64e4d681fcdb
5
5
  SHA512:
6
- metadata.gz: cc34a938bb662acaebecd42dde3a51a600bdc99a1cc55a7330d5b91e8f663872d3129080dc580dfdc9a6ec001ac7ffe0e5c59658a24c739859741735b30720d0
7
- data.tar.gz: 732d6708e095fd297082a411fba15b0ceae055f7810436e0a899eab23d5ca805d82dc8d7fbd741594c5fcf27a74aad10bff03191fdeb09d4d8042813dd4c268d
6
+ metadata.gz: d38d1a982e490ca349e3eb7e1aa83db407148fec053e4b83f3947739387d931519839becf51cf3a7fc0fc815435a08ebbb0f5defb50a04f393025cb6959af0ea
7
+ data.tar.gz: 33aee28e333f7fd0d71853eb0c26e424a86abbd5c635d6b9cd2aa538d503aee2daab12abe3613c744f71cef011fbbb23177fa8d49ac056556e905ad6703b810d
data/CHANGELOG.md CHANGED
@@ -6,3 +6,6 @@
6
6
  ## [0.1.1] - 2024-02-09
7
7
  - new wrapi dependency for paging
8
8
 
9
+ ## [0.2.0] - 2024-02-20
10
+ - Exception harmonization
11
+
data/Gemfile CHANGED
@@ -7,4 +7,5 @@ gemspec
7
7
 
8
8
  gem 'rake', '~> 13.0'
9
9
  gem 'rubocop', '~> 1.7'
10
+ gem 'simplecov', require: false, group: :test
10
11
  gem 'wrapi'
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # Integra Office365 backup API
2
+ [![Version](https://img.shields.io/gem/v/integra365.svg)](https://rubygems.org/gems/integra365)
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/41dec06ba5200b40b44e/maintainability)](https://codeclimate.com/github/jancotanis/integra365/maintainability)
4
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/41dec06ba5200b40b44e/test_coverage)](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
@@ -33,4 +33,5 @@ Gem::Specification.new do |s|
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
- api_auth("Token", options)
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("Token/Refresh", token)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Integra365
4
- VERSION = '0.1.1'
4
+ VERSION = '0.2.0'
5
5
  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.1.1
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-09 00:00:00.000000000 Z
11
+ date: 2024-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -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: