skykick 0.1.1 → 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 +3 -0
- data/Gemfile +2 -1
- data/README.md +8 -5
- data/Rakefile +8 -0
- data/lib/skykick/authentication.rb +12 -7
- data/lib/skykick/error.rb +11 -0
- data/lib/skykick/version.rb +1 -1
- data/skykick.gemspec +1 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3568006d852bb95fdf9bc05a9c2847f0735858d0b30b1db54f07af5b1e8c547e
|
4
|
+
data.tar.gz: e714cce3f3851c064abf1fcb314f460d4d2dd34fab2fb6caba2e3a794fae4e57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 023d97f414b04c76cdacc95857b1b2c1c956ddeed653022f79c4f5bcdf13764b32f9e8ac931de6fd0e7b03c566ac2410f1b356991c2975008668f9f602857baa
|
7
|
+
data.tar.gz: 0baba10c6e1b0db00d6390a3ef594b292e0f23c1f6ef99a71ec2d0d81163c24a23eb3d0c047b4201a7ddbe2f08c699b4e2ce92aeb05ba827f2454a4cb64da0c3
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# Skykick Office365 backup API
|
2
|
+
[](https://rubygems.org/gems/skykick)
|
3
|
+
[](https://codeclimate.com/github/jancotanis/skykick/maintainability)
|
4
|
+
[](https://codeclimate.com/github/jancotanis/skykick/test_coverage)
|
2
5
|
|
3
6
|
This is a wrapper for the Skykick Office365 backup API. You can see the API endpoints here https://developers.skykick.com/apis
|
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 'skykick'
|
29
32
|
|
30
33
|
Skykick.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
|
### Backup
|
57
60
|
Endpoint for backup related requests
|
58
|
-
```
|
61
|
+
```ruby
|
59
62
|
subscriptions = client.subscriptions
|
60
63
|
```
|
61
64
|
|
@@ -77,7 +80,7 @@ subscriptions = client.subscriptions
|
|
77
80
|
|
78
81
|
### Alerts
|
79
82
|
Returns Alerts for a provided Email Migration Order ID or Backup service ID.
|
80
|
-
```
|
83
|
+
```ruby
|
81
84
|
subscriptions = client.subscriptions
|
82
85
|
alerts = client.alerts(subscriptions.first.id)
|
83
86
|
|
@@ -89,7 +92,7 @@ alerts = client.alerts(subscriptions.first.id)
|
|
89
92
|
|
90
93
|
## Contributing
|
91
94
|
|
92
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/jancotanis/
|
95
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jancotanis/skykick.
|
93
96
|
|
94
97
|
## License
|
95
98
|
|
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'
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require File.expand_path('error', __dir__)
|
2
2
|
require 'uri'
|
3
3
|
|
4
4
|
module Skykick
|
@@ -7,6 +7,8 @@ module Skykick
|
|
7
7
|
# Authorize to the Skykick portal and return access_token
|
8
8
|
# @see https://developers.skykick.com/Guides/Authentication
|
9
9
|
def auth_token(options = {})
|
10
|
+
raise ConfigurationError.new 'Client id and/or secret not configured' unless client_id && client_secret
|
11
|
+
|
10
12
|
c = connection
|
11
13
|
c.basic_auth(client_id, client_secret)
|
12
14
|
response = c.post('/auth/token') do |request|
|
@@ -15,6 +17,10 @@ module Skykick
|
|
15
17
|
end
|
16
18
|
|
17
19
|
api_process_token(response.body)
|
20
|
+
|
21
|
+
self.access_token
|
22
|
+
rescue Faraday::ForbiddenError => e
|
23
|
+
raise AuthenticationError.new 'Unauthorized; response ' + e.to_s
|
18
24
|
end
|
19
25
|
alias login auth_token
|
20
26
|
|
@@ -28,13 +34,12 @@ module Skykick
|
|
28
34
|
end
|
29
35
|
|
30
36
|
def api_process_token(response)
|
31
|
-
|
32
|
-
self.token_type
|
33
|
-
self.refresh_token
|
34
|
-
self.token_expires
|
35
|
-
raise StandardError.new 'Could not find valid access_token; response ' + response.to_s if at.nil? || at.empty?
|
37
|
+
self.access_token = response['access_token']
|
38
|
+
self.token_type = response['token_type']
|
39
|
+
self.refresh_token = response['refresh_token']
|
40
|
+
self.token_expires = response['expires_in']
|
36
41
|
|
37
|
-
|
42
|
+
raise AuthorizationError.new 'Could not find valid access_token; response ' + response.to_s if self.access_token.nil? || self.access_token.empty?
|
38
43
|
end
|
39
44
|
end
|
40
45
|
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Skykick
|
2
|
+
|
3
|
+
# Generic error to be able to rescue all Skykick errors
|
4
|
+
class SkykickError < StandardError; end
|
5
|
+
|
6
|
+
# Error when configuration not sufficient
|
7
|
+
class ConfigurationError < SkykickError; end
|
8
|
+
|
9
|
+
# Error when authentication fails
|
10
|
+
class AuthenticationError < SkykickError; end
|
11
|
+
end
|
data/lib/skykick/version.rb
CHANGED
data/skykick.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skykick
|
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
|
@@ -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: []
|
@@ -99,6 +113,7 @@ files:
|
|
99
113
|
- lib/skykick/client/alerts.rb
|
100
114
|
- lib/skykick/client/backup.rb
|
101
115
|
- lib/skykick/connection.rb
|
116
|
+
- lib/skykick/error.rb
|
102
117
|
- lib/skykick/pagination.rb
|
103
118
|
- lib/skykick/version.rb
|
104
119
|
- skykick.gemspec
|