kaze_client 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 +4 -4
- data/.rubocop.yml +1 -103
- data/CHANGELOG.md +9 -0
- data/Gemfile +10 -4
- data/Gemfile.lock +32 -16
- data/Rakefile +3 -3
- data/bin/console +3 -3
- data/kaze_client.gemspec +15 -14
- data/lib/kaze_client/client.rb +16 -5
- data/lib/kaze_client/error/disabled_account.rb +1 -1
- data/lib/kaze_client/error/forbidden.rb +1 -1
- data/lib/kaze_client/error/generic.rb +1 -1
- data/lib/kaze_client/error/internal_server_error.rb +1 -1
- data/lib/kaze_client/error/invalid_credentials.rb +1 -1
- data/lib/kaze_client/error/no_private_token.rb +1 -1
- data/lib/kaze_client/error/not_found.rb +1 -1
- data/lib/kaze_client/error/unauthorized.rb +1 -1
- data/lib/kaze_client/errors.rb +9 -9
- data/lib/kaze_client/request/request.rb +6 -6
- data/lib/kaze_client/request/requests/create_job_request.rb +1 -1
- data/lib/kaze_client/request/requests/job_workflows_request.rb +1 -1
- data/lib/kaze_client/request/requests/jobs_request.rb +1 -1
- data/lib/kaze_client/request/requests/login_request.rb +1 -1
- data/lib/kaze_client/request/requests/{companies_request.rb → partners_request.rb} +2 -2
- data/lib/kaze_client/request/requests/profile_request.rb +1 -1
- data/lib/kaze_client/request/requests/utils/authentified_request.rb +1 -1
- data/lib/kaze_client/request/requests/utils/list_request.rb +1 -1
- data/lib/kaze_client/requests.rb +14 -14
- data/lib/kaze_client/version.rb +1 -1
- data/lib/kaze_client.rb +8 -8
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff98889c7d39f15fc54339f9751d5197b15d3c5ed8af54375382858cf76a431b
|
4
|
+
data.tar.gz: 8484f58d8443003290a8a165c640c936705ffb4c2b7a51188fa9b8486d6e672c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0197299afa26f1a0a773f60e28f77c5d49b8a49930149f80e07cf7762311bdf7dd5c496df45e72c52d163b8e194ab57e7e94b97835449798db3f47f4a34e3bb
|
7
|
+
data.tar.gz: 76488d384368b10038eb5e126c846c29f6bac94d318f899528b4c8d9b001e2c637d9775b882f40dfaa33d5e06884477e0801d3fb24eb8fbadb0e3f1b5423a2bb
|
data/.rubocop.yml
CHANGED
@@ -1,104 +1,2 @@
|
|
1
1
|
AllCops:
|
2
|
-
|
3
|
-
|
4
|
-
Style/StringLiterals:
|
5
|
-
Enabled: true
|
6
|
-
EnforcedStyle: double_quotes
|
7
|
-
|
8
|
-
Style/StringLiteralsInInterpolation:
|
9
|
-
Enabled: true
|
10
|
-
EnforcedStyle: double_quotes
|
11
|
-
|
12
|
-
Layout/LineLength:
|
13
|
-
Max: 120
|
14
|
-
|
15
|
-
Gemspec/DateAssignment: # (new in 1.10)
|
16
|
-
Enabled: true
|
17
|
-
|
18
|
-
Layout/SpaceBeforeBrackets: # (new in 1.7)
|
19
|
-
Enabled: true
|
20
|
-
|
21
|
-
Lint/AmbiguousAssignment: # (new in 1.7)
|
22
|
-
Enabled: true
|
23
|
-
|
24
|
-
Lint/DeprecatedConstants: # (new in 1.8)
|
25
|
-
Enabled: true
|
26
|
-
|
27
|
-
Lint/DuplicateBranch: # (new in 1.3)
|
28
|
-
Enabled: true
|
29
|
-
|
30
|
-
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
|
31
|
-
Enabled: true
|
32
|
-
|
33
|
-
Lint/EmptyBlock: # (new in 1.1)
|
34
|
-
Enabled: true
|
35
|
-
|
36
|
-
Lint/EmptyClass: # (new in 1.3)
|
37
|
-
Enabled: true
|
38
|
-
|
39
|
-
Lint/LambdaWithoutLiteralBlock: # (new in 1.8)
|
40
|
-
Enabled: true
|
41
|
-
|
42
|
-
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
|
43
|
-
Enabled: true
|
44
|
-
|
45
|
-
Lint/NumberedParameterAssignment: # (new in 1.9)
|
46
|
-
Enabled: true
|
47
|
-
|
48
|
-
Lint/OrAssignmentToConstant: # (new in 1.9)
|
49
|
-
Enabled: true
|
50
|
-
|
51
|
-
Lint/RedundantDirGlobSort: # (new in 1.8)
|
52
|
-
Enabled: true
|
53
|
-
|
54
|
-
Lint/SymbolConversion: # (new in 1.9)
|
55
|
-
Enabled: true
|
56
|
-
|
57
|
-
Lint/ToEnumArguments: # (new in 1.1)
|
58
|
-
Enabled: true
|
59
|
-
|
60
|
-
Lint/TripleQuotes: # (new in 1.9)
|
61
|
-
Enabled: true
|
62
|
-
|
63
|
-
Lint/UnexpectedBlockArity: # (new in 1.5)
|
64
|
-
Enabled: true
|
65
|
-
|
66
|
-
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
|
67
|
-
Enabled: true
|
68
|
-
|
69
|
-
Style/ArgumentsForwarding: # (new in 1.1)
|
70
|
-
Enabled: true
|
71
|
-
|
72
|
-
Style/CollectionCompact: # (new in 1.2)
|
73
|
-
Enabled: true
|
74
|
-
|
75
|
-
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
|
76
|
-
Enabled: true
|
77
|
-
|
78
|
-
Style/EndlessMethod: # (new in 1.8)
|
79
|
-
Enabled: true
|
80
|
-
|
81
|
-
Style/HashConversion: # (new in 1.10)
|
82
|
-
Enabled: true
|
83
|
-
|
84
|
-
Style/HashExcept: # (new in 1.7)
|
85
|
-
Enabled: true
|
86
|
-
|
87
|
-
Style/IfWithBooleanLiteralBranches: # (new in 1.9)
|
88
|
-
Enabled: true
|
89
|
-
|
90
|
-
Style/NegatedIfElseCondition: # (new in 1.2)
|
91
|
-
Enabled: true
|
92
|
-
|
93
|
-
Style/NilLambda: # (new in 1.3)
|
94
|
-
Enabled: true
|
95
|
-
|
96
|
-
Style/RedundantArgument: # (new in 1.4)
|
97
|
-
Enabled: true
|
98
|
-
|
99
|
-
Style/StringChars: # (new in 1.12)
|
100
|
-
Enabled: true
|
101
|
-
|
102
|
-
Style/SwapValues: # (new in 1.1)
|
103
|
-
Enabled: true
|
104
|
-
|
2
|
+
NewCops: enable
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## [0.2.0] - 2022-06-01
|
2
|
+
|
3
|
+
- Allow to set the authentication token on the client skipping login step.
|
4
|
+
|
5
|
+
## [0.1.1p0] - 2022-05-31
|
6
|
+
|
7
|
+
- Replace KazeClient::CompaniesRequest (/api/companies) with KazeClient::PartnersRequest (/api/partners).
|
8
|
+
- Upgrade rubocop.
|
9
|
+
|
1
10
|
## [0.1.1] - 2022-05-31
|
2
11
|
|
3
12
|
- Rename the gem to KazeClient to follow the rebranding of LastBill to Kaze.
|
data/Gemfile
CHANGED
@@ -1,12 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in kaze_client.gemspec
|
6
6
|
gemspec
|
7
7
|
|
8
|
-
gem
|
8
|
+
gem 'rake', '~> 13.0'
|
9
9
|
|
10
|
-
gem
|
10
|
+
gem 'rspec', '~> 3.0'
|
11
11
|
|
12
|
-
gem
|
12
|
+
gem 'rubocop', '~> 1.30'
|
13
|
+
|
14
|
+
gem 'rubocop-rake', '~> 0.6.0'
|
15
|
+
|
16
|
+
gem 'rubocop-rspec', '~> 2.11.1'
|
17
|
+
|
18
|
+
gem 'debug', '~> 1.5'
|
data/Gemfile.lock
CHANGED
@@ -1,27 +1,35 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kaze_client (0.1.
|
4
|
+
kaze_client (0.1.1p0)
|
5
5
|
httparty (~> 0.18, >= 0.18.1)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
|
+
debug (1.5.0)
|
12
|
+
irb (>= 1.3.6)
|
13
|
+
reline (>= 0.2.7)
|
11
14
|
diff-lcs (1.4.4)
|
12
|
-
httparty (0.
|
15
|
+
httparty (0.20.0)
|
13
16
|
mime-types (~> 3.0)
|
14
17
|
multi_xml (>= 0.5.2)
|
15
|
-
|
18
|
+
io-console (0.5.11)
|
19
|
+
irb (1.4.1)
|
20
|
+
reline (>= 0.3.0)
|
21
|
+
mime-types (3.4.1)
|
16
22
|
mime-types-data (~> 3.2015)
|
17
|
-
mime-types-data (3.
|
23
|
+
mime-types-data (3.2022.0105)
|
18
24
|
multi_xml (0.6.0)
|
19
|
-
parallel (1.
|
20
|
-
parser (3.
|
25
|
+
parallel (1.22.1)
|
26
|
+
parser (3.1.2.0)
|
21
27
|
ast (~> 2.4.1)
|
22
|
-
rainbow (3.
|
28
|
+
rainbow (3.1.1)
|
23
29
|
rake (13.0.3)
|
24
|
-
regexp_parser (2.
|
30
|
+
regexp_parser (2.5.0)
|
31
|
+
reline (0.3.1)
|
32
|
+
io-console (~> 0.5)
|
25
33
|
rexml (3.2.5)
|
26
34
|
rspec (3.10.0)
|
27
35
|
rspec-core (~> 3.10.0)
|
@@ -36,28 +44,36 @@ GEM
|
|
36
44
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
45
|
rspec-support (~> 3.10.0)
|
38
46
|
rspec-support (3.10.2)
|
39
|
-
rubocop (1.
|
47
|
+
rubocop (1.30.0)
|
40
48
|
parallel (~> 1.10)
|
41
|
-
parser (>= 3.
|
49
|
+
parser (>= 3.1.0.0)
|
42
50
|
rainbow (>= 2.2.2, < 4.0)
|
43
51
|
regexp_parser (>= 1.8, < 3.0)
|
44
|
-
rexml
|
45
|
-
rubocop-ast (>= 1.
|
52
|
+
rexml (>= 3.2.5, < 4.0)
|
53
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
46
54
|
ruby-progressbar (~> 1.7)
|
47
55
|
unicode-display_width (>= 1.4.0, < 3.0)
|
48
|
-
rubocop-ast (1.
|
49
|
-
parser (>= 3.
|
56
|
+
rubocop-ast (1.18.0)
|
57
|
+
parser (>= 3.1.1.0)
|
58
|
+
rubocop-rake (0.6.0)
|
59
|
+
rubocop (~> 1.0)
|
60
|
+
rubocop-rspec (2.11.1)
|
61
|
+
rubocop (~> 1.19)
|
50
62
|
ruby-progressbar (1.11.0)
|
51
|
-
unicode-display_width (2.
|
63
|
+
unicode-display_width (2.1.0)
|
52
64
|
|
53
65
|
PLATFORMS
|
66
|
+
aarch64-linux
|
54
67
|
x86_64-darwin-20
|
55
68
|
|
56
69
|
DEPENDENCIES
|
70
|
+
debug (~> 1.5)
|
57
71
|
kaze_client!
|
58
72
|
rake (~> 13.0)
|
59
73
|
rspec (~> 3.0)
|
60
|
-
rubocop (~> 1.
|
74
|
+
rubocop (~> 1.30)
|
75
|
+
rubocop-rake (~> 0.6.0)
|
76
|
+
rubocop-rspec (~> 2.11.1)
|
61
77
|
|
62
78
|
BUNDLED WITH
|
63
79
|
2.2.15
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require 'bundler/gem_tasks'
|
4
|
+
require 'rspec/core/rake_task'
|
5
5
|
|
6
6
|
RSpec::Core::RakeTask.new(:spec)
|
7
7
|
|
8
|
-
require
|
8
|
+
require 'rubocop/rake_task'
|
9
9
|
|
10
10
|
RuboCop::RakeTask.new
|
11
11
|
|
data/bin/console
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'kaze_client'
|
6
6
|
|
7
7
|
# You can add fixtures and/or initialization code here to make experimenting
|
8
8
|
# with your gem easier. You can also use a different console, if you like.
|
@@ -11,5 +11,5 @@ require "kaze_client"
|
|
11
11
|
# require "pry"
|
12
12
|
# Pry.start
|
13
13
|
|
14
|
-
require
|
14
|
+
require 'irb'
|
15
15
|
IRB.start(__FILE__)
|
data/kaze_client.gemspec
CHANGED
@@ -1,35 +1,36 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
3
|
+
require_relative 'lib/kaze_client/version'
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
|
-
spec.name =
|
6
|
+
spec.name = 'kaze_client'
|
7
7
|
spec.version = KazeClient::VERSION
|
8
|
-
spec.authors = [
|
9
|
-
spec.email = [
|
8
|
+
spec.authors = ['Matthieu Ciappara']
|
9
|
+
spec.email = ['ciappa_m@modulotech.fr']
|
10
10
|
|
11
|
-
spec.summary =
|
11
|
+
spec.summary = 'This is the official Ruby client library for Kaze API.'
|
12
12
|
spec.description = <<~TEXT
|
13
13
|
This is the official Ruby client library for Kaze (https://www.kaze.so/) API.
|
14
14
|
|
15
15
|
The API documentation can be found at https://documenter.getpostman.com/view/15303175/U16nLQ7r.
|
16
16
|
TEXT
|
17
|
-
spec.homepage =
|
18
|
-
spec.license =
|
19
|
-
spec.required_ruby_version = Gem::Requirement.new(
|
17
|
+
spec.homepage = 'https://github.com/moduloTech/kaze_client'
|
18
|
+
spec.license = 'MIT'
|
19
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
20
20
|
|
21
|
-
spec.metadata[
|
22
|
-
spec.metadata[
|
23
|
-
spec.metadata[
|
21
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
22
|
+
spec.metadata['source_code_uri'] = 'https://github.com/moduloTech/kaze_client'
|
23
|
+
spec.metadata['changelog_uri'] = 'https://github.com/moduloTech/kaze_client/blob/master/CHANGELOG.md'
|
24
24
|
|
25
25
|
# Specify which files should be added to the gem when it is released.
|
26
26
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
27
27
|
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
28
28
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
29
29
|
end
|
30
|
-
spec.bindir =
|
30
|
+
spec.bindir = 'exe'
|
31
31
|
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
32
|
-
spec.require_paths = [
|
32
|
+
spec.require_paths = ['lib']
|
33
33
|
|
34
|
-
spec.add_runtime_dependency
|
34
|
+
spec.add_runtime_dependency 'httparty', '~> 0.18', '>= 0.18.1'
|
35
|
+
# spec.metadata['rubygems_mfa_required'] = 'true'
|
35
36
|
end
|
data/lib/kaze_client/client.rb
CHANGED
@@ -13,10 +13,11 @@ module KazeClient
|
|
13
13
|
# @see KazeClient::Client#login
|
14
14
|
attr_reader :token
|
15
15
|
|
16
|
-
# @param base_url [String] The server's base URL (e.g. https://app.kaze.
|
17
|
-
|
16
|
+
# @param base_url [String] The server's base URL (e.g. https://app.kaze.so)
|
17
|
+
# @param token [String] The authentication token
|
18
|
+
def initialize(base_url, token: nil)
|
18
19
|
@base_url = base_url
|
19
|
-
@token =
|
20
|
+
@token = token
|
20
21
|
@login = nil
|
21
22
|
@password = nil
|
22
23
|
end
|
@@ -52,20 +53,30 @@ module KazeClient
|
|
52
53
|
def login(login = @login, password = @password)
|
53
54
|
# Impossible to login using nil login or password.
|
54
55
|
# The first call to #login must be given a login and a password.
|
55
|
-
raise KazeClient::Error::InvalidCredentials,
|
56
|
+
raise KazeClient::Error::InvalidCredentials, 'Please set login and password' if login.nil? || password.nil?
|
56
57
|
|
57
58
|
request = KazeClient::LoginRequest.new(login: login, password: password)
|
58
59
|
|
59
60
|
response = do_execute(request)
|
60
61
|
|
61
62
|
# Store the token for next request and the login/password for next call
|
62
|
-
@token = response[
|
63
|
+
@token = response['token']
|
63
64
|
@login = login
|
64
65
|
@password = password
|
65
66
|
|
66
67
|
response
|
67
68
|
end
|
68
69
|
|
70
|
+
# Set the authentication token
|
71
|
+
#
|
72
|
+
# @param token [String] The new authentication token
|
73
|
+
# @return [KazeClient::Client] The client after assigning the new token
|
74
|
+
def with_token(token)
|
75
|
+
@token = token
|
76
|
+
|
77
|
+
self
|
78
|
+
end
|
79
|
+
|
69
80
|
private
|
70
81
|
|
71
82
|
# @param request [KazeClient::Request] The request which was executed
|
@@ -5,7 +5,7 @@ module KazeClient
|
|
5
5
|
# @author ciappa_m@modulotech.fr
|
6
6
|
# 403 error sent by Kaze server when trying to log in with a disabled account
|
7
7
|
class DisabledAccount < Forbidden
|
8
|
-
def initialize(msg =
|
8
|
+
def initialize(msg = 'User account was disabled by administrator')
|
9
9
|
super(msg)
|
10
10
|
end
|
11
11
|
end
|
@@ -15,7 +15,7 @@ module KazeClient
|
|
15
15
|
attr_reader :error
|
16
16
|
|
17
17
|
# The default error message
|
18
|
-
DEFAULT_MESSAGE =
|
18
|
+
DEFAULT_MESSAGE = 'An unknown error occured'
|
19
19
|
|
20
20
|
def initialize(status: :internal_server_error, error: nil,
|
21
21
|
message: DEFAULT_MESSAGE)
|
@@ -5,7 +5,7 @@ module KazeClient
|
|
5
5
|
# @author ciappa_m@modulotech.fr
|
6
6
|
# Generic 500 error sent by Kaze server
|
7
7
|
class InternalServerError < Generic
|
8
|
-
def initialize(msg =
|
8
|
+
def initialize(msg = 'An unknown error occured')
|
9
9
|
super(message: msg)
|
10
10
|
end
|
11
11
|
end
|
@@ -5,7 +5,7 @@ module KazeClient
|
|
5
5
|
# @author ciappa_m@modulotech.fr
|
6
6
|
# 401 error sent by Kaze server when trying to log in with invalid credentials
|
7
7
|
class InvalidCredentials < Unauthorized
|
8
|
-
def initialize(msg =
|
8
|
+
def initialize(msg = 'Invalid Login or Password')
|
9
9
|
super(msg)
|
10
10
|
end
|
11
11
|
end
|
@@ -5,7 +5,7 @@ module KazeClient
|
|
5
5
|
# @author ciappa_m@modulotech.fr
|
6
6
|
# 403 error sent by Kaze server when trying to log in and user has no token
|
7
7
|
class NoPrivateToken < Forbidden
|
8
|
-
def initialize(msg =
|
8
|
+
def initialize(msg = 'User has no private token assigned')
|
9
9
|
super(msg)
|
10
10
|
end
|
11
11
|
end
|
@@ -5,7 +5,7 @@ module KazeClient
|
|
5
5
|
# @author ciappa_m@modulotech.fr
|
6
6
|
# Generic 401 error sent by Kaze server
|
7
7
|
class Unauthorized < Generic
|
8
|
-
def initialize(msg =
|
8
|
+
def initialize(msg = '401 Unauthorized')
|
9
9
|
super(status: :unauthorized, message: msg)
|
10
10
|
end
|
11
11
|
end
|
data/lib/kaze_client/errors.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# Require the error classes
|
4
|
-
require_relative
|
5
|
-
require_relative
|
6
|
-
require_relative
|
7
|
-
require_relative
|
8
|
-
require_relative
|
9
|
-
require_relative
|
10
|
-
require_relative
|
11
|
-
require_relative
|
12
|
-
require_relative
|
4
|
+
require_relative 'error/generic'
|
5
|
+
require_relative 'error/unauthorized'
|
6
|
+
require_relative 'error/forbidden'
|
7
|
+
require_relative 'error/not_found'
|
8
|
+
require_relative 'error/internal_server_error'
|
9
|
+
require_relative 'error/disabled_account'
|
10
|
+
require_relative 'error/invalid_credentials'
|
11
|
+
require_relative 'error/no_endpoint'
|
12
|
+
require_relative 'error/no_private_token'
|
@@ -9,8 +9,8 @@ module KazeClient
|
|
9
9
|
class Request
|
10
10
|
# Those headers are added on all requests by default
|
11
11
|
DEFAULT_HEADERS = {
|
12
|
-
|
13
|
-
|
12
|
+
'Content-Type' => 'application/json',
|
13
|
+
'Accept' => 'application/json'
|
14
14
|
}.freeze
|
15
15
|
|
16
16
|
# @return [String, Symbol] The HTTP verb to use for the request
|
@@ -69,14 +69,14 @@ module KazeClient
|
|
69
69
|
return KazeClient::Error::NotFound.new if response.code == 404
|
70
70
|
|
71
71
|
# Return the adequate error class for the error code in the response
|
72
|
-
"KazeClient::Error::#{response.parsed_response[
|
73
|
-
.constantize.new(response.parsed_response[
|
72
|
+
"KazeClient::Error::#{response.parsed_response['error'].camelize}"
|
73
|
+
.constantize.new(response.parsed_response['message'])
|
74
74
|
rescue NameError
|
75
75
|
# This means no error class exists for the error code in the response, we fallback to a
|
76
76
|
# generic error
|
77
77
|
Error::Generic.new(status: response.code,
|
78
|
-
error: response.parsed_response[
|
79
|
-
message: response.parsed_response[
|
78
|
+
error: response.parsed_response['error'],
|
79
|
+
message: response.parsed_response['message'])
|
80
80
|
end
|
81
81
|
|
82
82
|
protected
|
@@ -19,7 +19,7 @@ module KazeClient
|
|
19
19
|
# @param target_id [String] The id of the target company.
|
20
20
|
# @param workflow [Hash] The workflow to use to create the job.
|
21
21
|
def initialize(target_id, workflow)
|
22
|
-
super(:post,
|
22
|
+
super(:post, 'api/jobs')
|
23
23
|
|
24
24
|
@target_id = target_id
|
25
25
|
@workflow = workflow
|
@@ -8,12 +8,12 @@ module KazeClient
|
|
8
8
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
9
|
# @see KazeClient::Utils::ListRequest
|
10
10
|
# @since 0.1.0
|
11
|
-
class
|
11
|
+
class PartnersRequest < Utils::FinalRequest
|
12
12
|
include Utils::AuthentifiedRequest
|
13
13
|
include Utils::ListRequest
|
14
14
|
|
15
15
|
def initialize
|
16
|
-
super(:get,
|
16
|
+
super(:get, 'api/partners')
|
17
17
|
end
|
18
18
|
end
|
19
19
|
end
|
@@ -73,7 +73,7 @@ module KazeClient
|
|
73
73
|
# @return [KazeClient::Utils::ListRequest] self (to chain methods)
|
74
74
|
def add_order_direction(direction)
|
75
75
|
# Ensure the +direction+ parameter is valid; default direction is ascendant
|
76
|
-
@order_direction = %w[asc desc].include?(direction.to_s) ? direction.to_s :
|
76
|
+
@order_direction = %w[asc desc].include?(direction.to_s) ? direction.to_s : 'asc'
|
77
77
|
|
78
78
|
@query[:order_direction] = @order_direction
|
79
79
|
|
data/lib/kaze_client/requests.rb
CHANGED
@@ -1,23 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# The base request object - for custom/newest APIs
|
4
|
-
require_relative
|
4
|
+
require_relative 'request/request'
|
5
5
|
|
6
6
|
# Modules included in requests
|
7
|
-
require_relative
|
8
|
-
require_relative
|
7
|
+
require_relative 'request/requests/utils/authentified_request'
|
8
|
+
require_relative 'request/requests/utils/list_request'
|
9
9
|
|
10
10
|
# The base object for pre-crafted requests
|
11
|
-
require_relative
|
11
|
+
require_relative 'request/requests/utils/final_request'
|
12
12
|
|
13
13
|
# The pre-crafted requests
|
14
|
-
require_relative
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
18
|
-
require_relative
|
19
|
-
require_relative
|
20
|
-
require_relative
|
21
|
-
require_relative
|
22
|
-
require_relative
|
23
|
-
require_relative
|
14
|
+
require_relative 'request/requests/assign_performer_request'
|
15
|
+
require_relative 'request/requests/partners_request'
|
16
|
+
require_relative 'request/requests/create_job_request'
|
17
|
+
require_relative 'request/requests/job_request'
|
18
|
+
require_relative 'request/requests/job_workflow_request'
|
19
|
+
require_relative 'request/requests/job_workflows_request'
|
20
|
+
require_relative 'request/requests/jobs_request'
|
21
|
+
require_relative 'request/requests/login_request'
|
22
|
+
require_relative 'request/requests/profile_request'
|
23
|
+
require_relative 'request/requests/update_template_request'
|
data/lib/kaze_client/version.rb
CHANGED
data/lib/kaze_client.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
# I only need some very specific parts of activesupport.
|
4
|
-
require
|
5
|
-
require
|
4
|
+
require 'activesupport/blank'
|
5
|
+
require 'activesupport/camelize'
|
6
6
|
|
7
7
|
# Require HTTParty
|
8
|
-
require
|
8
|
+
require 'httparty'
|
9
9
|
|
10
10
|
# Require the version number
|
11
|
-
require_relative
|
11
|
+
require_relative 'kaze_client/version'
|
12
12
|
|
13
13
|
# Require the different parts of the gem
|
14
|
-
require_relative
|
15
|
-
require_relative
|
16
|
-
require_relative
|
17
|
-
require_relative
|
14
|
+
require_relative 'kaze_client/errors'
|
15
|
+
require_relative 'kaze_client/requests'
|
16
|
+
require_relative 'kaze_client/response'
|
17
|
+
require_relative 'kaze_client/client'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaze_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthieu Ciappara
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -70,13 +70,13 @@ files:
|
|
70
70
|
- lib/kaze_client/errors.rb
|
71
71
|
- lib/kaze_client/request/request.rb
|
72
72
|
- lib/kaze_client/request/requests/assign_performer_request.rb
|
73
|
-
- lib/kaze_client/request/requests/companies_request.rb
|
74
73
|
- lib/kaze_client/request/requests/create_job_request.rb
|
75
74
|
- lib/kaze_client/request/requests/job_request.rb
|
76
75
|
- lib/kaze_client/request/requests/job_workflow_request.rb
|
77
76
|
- lib/kaze_client/request/requests/job_workflows_request.rb
|
78
77
|
- lib/kaze_client/request/requests/jobs_request.rb
|
79
78
|
- lib/kaze_client/request/requests/login_request.rb
|
79
|
+
- lib/kaze_client/request/requests/partners_request.rb
|
80
80
|
- lib/kaze_client/request/requests/profile_request.rb
|
81
81
|
- lib/kaze_client/request/requests/update_template_request.rb
|
82
82
|
- lib/kaze_client/request/requests/utils/authentified_request.rb
|
@@ -100,7 +100,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
101
101
|
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 2.
|
103
|
+
version: 2.6.0
|
104
104
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
105
|
requirements:
|
106
106
|
- - ">="
|