cloudally 0.2.2 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Gemfile +1 -0
- data/README.md +3 -0
- data/Rakefile +14 -6
- data/bin/cc-test-reporter.exe +0 -0
- data/cloudally.gemspec +1 -0
- data/lib/cloudally/authentication.rb +11 -0
- data/lib/cloudally/error.rb +11 -0
- data/lib/cloudally/version.rb +1 -1
- metadata +18 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e29633647fb8984a79c99fcd163a8ec7a394aee08e70fa9b769841ac8a2f0b4
|
4
|
+
data.tar.gz: 6231ffb138601eb3719500f778758b9824a83a3e51032d25d4420ef9bbe605f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf7fb20897ffd7c2c443824dab575b922458ffb1c12f55e15ab220412d174b44a90744a1c764537e3a44d3f5a496c72ef207f352c49bb569d189c6a56957aaa1
|
7
|
+
data.tar.gz: 2ba40d29f87ead154cf16f18ba26080fd4469de2b96d7c4cf9c02d7bd1b84ae999df2caed48dd95511eda0102b23ca7c6394fe46c0c15fd43aebae07f4828c3e
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
# Cloudally API
|
2
|
+
[![Version](https://img.shields.io/gem/v/cloudally.svg)](https://rubygems.org/gems/cloudally)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/fc344d88ac45777b3168/maintainability)](https://codeclimate.com/github/jancotanis/cloudally/maintainability)
|
4
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/fc344d88ac45777b3168/test_coverage)](https://codeclimate.com/github/jancotanis/cloudally/test_coverage)
|
2
5
|
|
3
6
|
|
4
7
|
This is a wrapper for the CloudAlly portal API v1. You can see the API endpoints here https://api.cloudally.com/documentation
|
data/Rakefile
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'dotenv'
|
5
|
+
require 'rake/testtask'
|
6
|
+
|
7
|
+
Dotenv.load
|
8
|
+
|
9
|
+
system './bin/cc-test-reporter before-build'
|
5
10
|
|
6
11
|
Rake::TestTask.new(:test) do |t|
|
7
|
-
t.libs <<
|
8
|
-
t.libs <<
|
9
|
-
t.test_files = FileList[
|
12
|
+
t.libs << 'test'
|
13
|
+
t.libs << 'lib'
|
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
|
-
require
|
20
|
+
require 'rubocop/rake_task'
|
13
21
|
RuboCop::RakeTask.new
|
14
22
|
task default: %i[test rubocop]
|
Binary file
|
data/cloudally.gemspec
CHANGED
@@ -1,25 +1,36 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require File.expand_path('error', __dir__)
|
1
3
|
|
2
4
|
module CloudAlly
|
3
5
|
# Deals with authentication flow and stores it within global configuration
|
4
6
|
module Authentication
|
5
7
|
# Authorize to the CloudAlly portal and return access_token
|
6
8
|
def auth(options = {})
|
9
|
+
raise raise ConfigurationError.new "client_id and/or client_secret empty" unless client_id && client_secret
|
7
10
|
api_auth('/auth', options)
|
11
|
+
rescue Faraday::UnauthorizedError => e
|
12
|
+
raise AuthenticationError.new e.to_s
|
8
13
|
end
|
9
14
|
alias login auth
|
10
15
|
|
11
16
|
# Return an access token from authorization
|
12
17
|
def auth_refresh(token)
|
13
18
|
api_refresh('/auth/refresh', token)
|
19
|
+
rescue Faraday::UnauthorizedError => e
|
20
|
+
raise AuthenticationError.new e.to_s
|
14
21
|
end
|
15
22
|
|
16
23
|
# Authorize to the partner portal and return access_token
|
17
24
|
def auth_partner(options = {})
|
25
|
+
raise raise ConfigurationError.new "client_id and/or client_secret empty" unless client_id && client_secret
|
18
26
|
api_auth('/auth/partner', options)
|
27
|
+
rescue Faraday::ServerError, Faraday::UnauthorizedError => e
|
28
|
+
raise AuthenticationError.new e.to_s
|
19
29
|
end
|
20
30
|
alias partner_login auth_partner
|
21
31
|
private
|
22
32
|
def api_access_token_params
|
33
|
+
raise raise ConfigurationError.new "username and/or password empty" unless username && password
|
23
34
|
{
|
24
35
|
email: username,
|
25
36
|
password: password
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module CloudAlly
|
2
|
+
|
3
|
+
# Generic error to be able to rescue all CloudAlly errors
|
4
|
+
class CloudAllyError < StandardError; end
|
5
|
+
|
6
|
+
# Error when configuration not sufficient
|
7
|
+
class ConfigurationError < CloudAllyError; end
|
8
|
+
|
9
|
+
# Error when authentication fails
|
10
|
+
class AuthenticationError < CloudAllyError; end
|
11
|
+
end
|
data/lib/cloudally/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudally
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.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-21 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,12 +106,14 @@ files:
|
|
92
106
|
- Gemfile
|
93
107
|
- README.md
|
94
108
|
- Rakefile
|
109
|
+
- bin/cc-test-reporter.exe
|
95
110
|
- cloudally.gemspec
|
96
111
|
- lib/cloudally.rb
|
97
112
|
- lib/cloudally/api.rb
|
98
113
|
- lib/cloudally/authentication.rb
|
99
114
|
- lib/cloudally/client.rb
|
100
115
|
- lib/cloudally/client/partners.rb
|
116
|
+
- lib/cloudally/error.rb
|
101
117
|
- lib/cloudally/pagination.rb
|
102
118
|
- lib/cloudally/version.rb
|
103
119
|
homepage: https://rubygems.org/gems/cloudally
|