kaze_client 0.3.2.2 → 0.4.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/.rubocop.yml +249 -0
- data/CHANGELOG.md +11 -0
- data/Gemfile.lock +52 -40
- data/README.md +22 -0
- data/kaze_client.gemspec +0 -1
- data/lib/kaze_client/client.rb +5 -1
- data/lib/kaze_client/data_utils.rb +4 -0
- data/lib/kaze_client/error/disabled_account.rb +7 -1
- data/lib/kaze_client/error/forbidden.rb +7 -1
- data/lib/kaze_client/error/generic.rb +6 -0
- data/lib/kaze_client/error/internal_server_error.rb +7 -1
- data/lib/kaze_client/error/invalid_credentials.rb +7 -1
- data/lib/kaze_client/error/no_endpoint.rb +6 -0
- data/lib/kaze_client/error/no_private_token.rb +7 -1
- data/lib/kaze_client/error/not_found.rb +7 -1
- data/lib/kaze_client/error/unauthorized.rb +7 -1
- data/lib/kaze_client/json_utils.rb +4 -0
- data/lib/kaze_client/request/request.rb +5 -1
- data/lib/kaze_client/request/requests/collections/collection_request.rb +4 -0
- data/lib/kaze_client/request/requests/collections/collections_request.rb +4 -0
- data/lib/kaze_client/request/requests/collections/items/create_collection_item_request.rb +4 -0
- data/lib/kaze_client/request/requests/collections/items/create_link_request.rb +8 -0
- data/lib/kaze_client/request/requests/collections/items/item_request.rb +6 -0
- data/lib/kaze_client/request/requests/collections/items/items_request.rb +6 -0
- data/lib/kaze_client/request/requests/jobs/add_tag_request.rb +4 -0
- data/lib/kaze_client/request/requests/jobs/assign_performer_request.rb +4 -0
- data/lib/kaze_client/request/requests/jobs/cancel_job_request.rb +4 -0
- data/lib/kaze_client/request/requests/jobs/complete_step_request.rb +36 -0
- data/lib/kaze_client/request/requests/jobs/create_job_request.rb +5 -1
- data/lib/kaze_client/request/requests/jobs/job_document_request.rb +4 -0
- data/lib/kaze_client/request/requests/jobs/job_request.rb +4 -0
- data/lib/kaze_client/request/requests/jobs/job_workflow_request.rb +4 -0
- data/lib/kaze_client/request/requests/jobs/job_workflows_request.rb +4 -0
- data/lib/kaze_client/request/requests/jobs/jobs_request.rb +4 -0
- data/lib/kaze_client/request/requests/jobs/update_template_request.rb +4 -0
- data/lib/kaze_client/request/requests/login_request.rb +5 -1
- data/lib/kaze_client/request/requests/partners_request.rb +4 -0
- data/lib/kaze_client/request/requests/profile_request.rb +4 -0
- data/lib/kaze_client/request/requests/tags/tag_request.rb +21 -0
- data/lib/kaze_client/request/requests/tags/tags_request.rb +20 -0
- data/lib/kaze_client/request/requests/upload_attachment_request.rb +7 -3
- data/lib/kaze_client/request/requests/upload_image_request.rb +4 -0
- data/lib/kaze_client/request/requests/users_request.rb +4 -0
- data/lib/kaze_client/request/requests/utils/authentified_request.rb +6 -0
- data/lib/kaze_client/request/requests/utils/final_request.rb +6 -0
- data/lib/kaze_client/request/requests/utils/list_request.rb +8 -4
- data/lib/kaze_client/requests.rb +7 -0
- data/lib/kaze_client/response.rb +5 -1
- data/lib/kaze_client/version.rb +3 -1
- metadata +9 -6
@@ -1,13 +1,19 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
module Error
|
6
|
+
|
5
7
|
# @author ciappa_m@modulotech.fr
|
6
8
|
# Generic 401 error sent by Kaze server
|
7
9
|
class Unauthorized < Generic
|
8
|
-
|
10
|
+
|
11
|
+
def initialize(msg='401 Unauthorized')
|
9
12
|
super(status: :unauthorized, message: msg)
|
10
13
|
end
|
14
|
+
|
11
15
|
end
|
16
|
+
|
12
17
|
end
|
18
|
+
|
13
19
|
end
|
@@ -1,11 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Utility methods to interact with JSON data
|
6
7
|
# @see KazeClient::Response
|
7
8
|
# @since 0.2.1
|
8
9
|
module JsonUtils
|
10
|
+
|
9
11
|
# Fetch nodes in given JSON
|
10
12
|
#
|
11
13
|
# @param json [KazeClient::Response,Hash,String] The JSON to analyze
|
@@ -32,5 +34,7 @@ module KazeClient
|
|
32
34
|
def self.fetch_node(json, path)
|
33
35
|
fetch_nodes(json, path).first
|
34
36
|
end
|
37
|
+
|
35
38
|
end
|
39
|
+
|
36
40
|
end
|
@@ -1,16 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Represents request to a Kaze API
|
6
7
|
# @see KazeClient::Client
|
7
8
|
# @see KazeClient::Response
|
8
9
|
# @since 0.1.0
|
9
10
|
class Request
|
11
|
+
|
10
12
|
# Those headers are added on all requests by default
|
11
13
|
DEFAULT_HEADERS = {
|
12
14
|
'Content-Type' => 'application/json',
|
13
|
-
'Accept'
|
15
|
+
'Accept' => 'application/json'
|
14
16
|
}.freeze
|
15
17
|
|
16
18
|
# @return [String, Symbol] The HTTP verb to use for the request
|
@@ -123,5 +125,7 @@ module KazeClient
|
|
123
125
|
Error::Generic.new(status: response.code, error: error, message: message)
|
124
126
|
end
|
125
127
|
end
|
128
|
+
|
126
129
|
end
|
130
|
+
|
127
131
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author richar_p@modulotech.fr
|
5
6
|
# Fetch the details for the given collection id.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,10 +9,13 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.3.2
|
10
11
|
class CollectionRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
def initialize(id)
|
14
16
|
super(:get, "api/collections/#{id}")
|
15
17
|
end
|
18
|
+
|
16
19
|
end
|
20
|
+
|
17
21
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author richar_p@modulotech.fr
|
5
6
|
# List the collections for the company of the current user.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,11 +9,14 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.3.2
|
10
11
|
class CollectionsRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
include Utils::ListRequest
|
13
15
|
|
14
16
|
def initialize
|
15
17
|
super(:get, 'api/collections')
|
16
18
|
end
|
19
|
+
|
17
20
|
end
|
21
|
+
|
18
22
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author chevre_a@modulotech.fr
|
5
6
|
# Create a collection item
|
6
7
|
# @see KazeClient::Request
|
@@ -8,6 +9,7 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.3.2
|
10
11
|
class CreateCollectionItemRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
# @param collection_id [String]
|
@@ -17,5 +19,7 @@ module KazeClient
|
|
17
19
|
|
18
20
|
@body = payload
|
19
21
|
end
|
22
|
+
|
20
23
|
end
|
24
|
+
|
21
25
|
end
|
@@ -1,9 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
module Collection
|
6
|
+
|
5
7
|
module Item
|
8
|
+
|
6
9
|
class CreateLinkRequest < Utils::FinalRequest
|
10
|
+
|
7
11
|
include Utils::AuthentifiedRequest
|
8
12
|
|
9
13
|
# @author chevre_a@modulotech.fr
|
@@ -17,7 +21,11 @@ module KazeClient
|
|
17
21
|
|
18
22
|
@body = { id: linked_collection_item_id }
|
19
23
|
end
|
24
|
+
|
20
25
|
end
|
26
|
+
|
21
27
|
end
|
28
|
+
|
22
29
|
end
|
30
|
+
|
23
31
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
module Collection
|
6
|
+
|
5
7
|
# @author richar_p@modulotech.fr
|
6
8
|
# Fetch the details for the given item id from the given collection id.
|
7
9
|
# @see KazeClient::Request
|
@@ -9,11 +11,15 @@ module KazeClient
|
|
9
11
|
# @see KazeClient::Utils::AuthentifiedRequest
|
10
12
|
# @since 0.3.2
|
11
13
|
class ItemRequest < Utils::FinalRequest
|
14
|
+
|
12
15
|
include Utils::AuthentifiedRequest
|
13
16
|
|
14
17
|
def initialize(collection_id, item_id)
|
15
18
|
super(:get, "api/collection/#{collection_id}/items/#{item_id}")
|
16
19
|
end
|
20
|
+
|
17
21
|
end
|
22
|
+
|
18
23
|
end
|
24
|
+
|
19
25
|
end
|
@@ -1,7 +1,9 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
module Collection
|
6
|
+
|
5
7
|
# @author richar_p@modulotech.fr
|
6
8
|
# List the items assigned to the collection id.
|
7
9
|
# @see KazeClient::Request
|
@@ -9,12 +11,16 @@ module KazeClient
|
|
9
11
|
# @see KazeClient::Utils::AuthentifiedRequest
|
10
12
|
# @since 0.3.2
|
11
13
|
class ItemsRequest < Utils::FinalRequest
|
14
|
+
|
12
15
|
include Utils::AuthentifiedRequest
|
13
16
|
include Utils::ListRequest
|
14
17
|
|
15
18
|
def initialize(id)
|
16
19
|
super(:get, "api/collections/#{id}/items")
|
17
20
|
end
|
21
|
+
|
18
22
|
end
|
23
|
+
|
19
24
|
end
|
25
|
+
|
20
26
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author RICHARD Peter <richar_p@modulotech.fr>
|
5
6
|
# Add tags to a job.
|
6
7
|
# @note This API is under development and does not work well.
|
@@ -27,6 +28,7 @@ module KazeClient
|
|
27
28
|
# @see KazeClient::Utils::AuthentifiedRequest
|
28
29
|
# @since 0.3.2
|
29
30
|
class AddTagRequest < Utils::FinalRequest
|
31
|
+
|
30
32
|
include Utils::AuthentifiedRequest
|
31
33
|
|
32
34
|
def initialize(job_id, tag_ids)
|
@@ -34,5 +36,7 @@ module KazeClient
|
|
34
36
|
|
35
37
|
@body = { tags: tag_ids }
|
36
38
|
end
|
39
|
+
|
37
40
|
end
|
41
|
+
|
38
42
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Assign a performer to the given job.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,6 +9,7 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.1.0
|
10
11
|
class AssignPerformerRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
def initialize(id, performer_user_id)
|
@@ -19,5 +21,7 @@ module KazeClient
|
|
19
21
|
}
|
20
22
|
}
|
21
23
|
end
|
24
|
+
|
22
25
|
end
|
26
|
+
|
23
27
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author chevre_a@modulotech.fr
|
5
6
|
# Cancel a job.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,6 +9,7 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.3.0
|
10
11
|
class CancelJobRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
def initialize(job_id, cancel_reason_id)
|
@@ -17,5 +19,7 @@ module KazeClient
|
|
17
19
|
job: { cancel_reason_id: cancel_reason_id }
|
18
20
|
}
|
19
21
|
end
|
22
|
+
|
20
23
|
end
|
24
|
+
|
21
25
|
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KazeClient
|
4
|
+
|
5
|
+
# @author richar_p@modulotech.fr
|
6
|
+
# Validate a step from a job.
|
7
|
+
# @see KazeClient::Request
|
8
|
+
# @see KazeClient::Utils::FinalRequest
|
9
|
+
# @see KazeClient::Utils::AuthentifiedRequest
|
10
|
+
# @since 0.3.3
|
11
|
+
class CompleteStepRequest < Utils::FinalRequest
|
12
|
+
|
13
|
+
include Utils::AuthentifiedRequest
|
14
|
+
|
15
|
+
# @return [String] The id of the targeted job.
|
16
|
+
attr_reader :job_id
|
17
|
+
|
18
|
+
# @return [Hash] The step needed to be completed.
|
19
|
+
attr_reader :step_id
|
20
|
+
|
21
|
+
# @example
|
22
|
+
# KazeClient::CompleteStepRequest.new('5295d1c4-2c25-4fc2-8bad-e714f2907f0d', 'job_info')
|
23
|
+
# => The step job_info is now completed.
|
24
|
+
def initialize(job_id, step_id)
|
25
|
+
super(:put, "api/jobs/#{job_id}/cells/#{step_id}")
|
26
|
+
|
27
|
+
@body = {
|
28
|
+
data: {
|
29
|
+
step_id => { completed: { value: true } }
|
30
|
+
}
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Create a job from the current user to the target company.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,6 +9,7 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.1.0
|
10
11
|
class CreateJobRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
# @return [String] The id of the target company.
|
@@ -25,8 +27,10 @@ module KazeClient
|
|
25
27
|
@workflow = workflow
|
26
28
|
@body = {
|
27
29
|
target_id: @target_id,
|
28
|
-
workflow:
|
30
|
+
workflow: @workflow
|
29
31
|
}
|
30
32
|
end
|
33
|
+
|
31
34
|
end
|
35
|
+
|
32
36
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author chevre_a@modulotech.fr
|
5
6
|
# Retrieve a job document from a job.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,10 +9,13 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.3.0
|
10
11
|
class JobDocumentRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
def initialize(job_id, job_document_id)
|
14
16
|
super(:get, "api/jobs/#{job_id}/documents/#{job_document_id}")
|
15
17
|
end
|
18
|
+
|
16
19
|
end
|
20
|
+
|
17
21
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Fetch the details for the given job id.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,10 +9,13 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.1.0
|
10
11
|
class JobRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
def initialize(id)
|
14
16
|
super(:get, "api/jobs/#{id}")
|
15
17
|
end
|
18
|
+
|
16
19
|
end
|
20
|
+
|
17
21
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Request the details about a specific workflow.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,6 +9,7 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.1.0
|
10
11
|
class JobWorkflowRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
# @return [String] The id of the workflow to request
|
@@ -21,5 +23,7 @@ module KazeClient
|
|
21
23
|
@query = {}
|
22
24
|
@filters = {}
|
23
25
|
end
|
26
|
+
|
24
27
|
end
|
28
|
+
|
25
29
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Request the list of job workflows for the current user.
|
6
7
|
# @see KazeClient::Request
|
@@ -9,11 +10,14 @@ module KazeClient
|
|
9
10
|
# @see KazeClient::Utils::ListRequest
|
10
11
|
# @since 0.1.0
|
11
12
|
class JobWorkflowsRequest < Utils::FinalRequest
|
13
|
+
|
12
14
|
include Utils::AuthentifiedRequest
|
13
15
|
include Utils::ListRequest
|
14
16
|
|
15
17
|
def initialize
|
16
18
|
super(:get, 'api/job_workflows')
|
17
19
|
end
|
20
|
+
|
18
21
|
end
|
22
|
+
|
19
23
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# List the jobs assigned to the current user's company.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,11 +9,14 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.1.0
|
10
11
|
class JobsRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
include Utils::ListRequest
|
13
15
|
|
14
16
|
def initialize
|
15
17
|
super(:get, 'api/jobs')
|
16
18
|
end
|
19
|
+
|
17
20
|
end
|
21
|
+
|
18
22
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Update data of the given template on the given job.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,6 +9,7 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.1.0
|
10
11
|
class UpdateTemplateRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
def initialize(id, template_id, body)
|
@@ -15,5 +17,7 @@ module KazeClient
|
|
15
17
|
|
16
18
|
@body = body
|
17
19
|
end
|
20
|
+
|
18
21
|
end
|
22
|
+
|
19
23
|
end
|
@@ -1,12 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Authenticate a user on the server.
|
6
7
|
# @see KazeClient::Request
|
7
8
|
# @see KazeClient::Utils::FinalRequest
|
8
9
|
# @since 0.1.0
|
9
10
|
class LoginRequest < Utils::FinalRequest
|
11
|
+
|
10
12
|
# @return [String] The user login.
|
11
13
|
attr_reader :login
|
12
14
|
|
@@ -19,10 +21,12 @@ module KazeClient
|
|
19
21
|
@password = password
|
20
22
|
@body = {
|
21
23
|
user: {
|
22
|
-
login:
|
24
|
+
login: @login,
|
23
25
|
password: @password
|
24
26
|
}
|
25
27
|
}
|
26
28
|
end
|
29
|
+
|
27
30
|
end
|
31
|
+
|
28
32
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Request the list of companies.
|
6
7
|
# @see KazeClient::Request
|
@@ -9,11 +10,14 @@ module KazeClient
|
|
9
10
|
# @see KazeClient::Utils::ListRequest
|
10
11
|
# @since 0.1.1
|
11
12
|
class PartnersRequest < Utils::FinalRequest
|
13
|
+
|
12
14
|
include Utils::AuthentifiedRequest
|
13
15
|
include Utils::ListRequest
|
14
16
|
|
15
17
|
def initialize
|
16
18
|
super(:get, 'api/partners')
|
17
19
|
end
|
20
|
+
|
18
21
|
end
|
22
|
+
|
19
23
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author ciappa_m@modulotech.fr
|
5
6
|
# Request data about the current user.
|
6
7
|
# @see KazeClient::Request
|
@@ -8,10 +9,13 @@ module KazeClient
|
|
8
9
|
# @see KazeClient::Utils::AuthentifiedRequest
|
9
10
|
# @since 0.1.0
|
10
11
|
class ProfileRequest < Utils::FinalRequest
|
12
|
+
|
11
13
|
include Utils::AuthentifiedRequest
|
12
14
|
|
13
15
|
def initialize
|
14
16
|
super(:get, 'api/profile')
|
15
17
|
end
|
18
|
+
|
16
19
|
end
|
20
|
+
|
17
21
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KazeClient
|
4
|
+
|
5
|
+
# @author chevre_a@modulotech.fr
|
6
|
+
# Fetch a tag with the given id
|
7
|
+
# @see KazeClient::Request
|
8
|
+
# @see KazeClient::Utils::FinalRequest
|
9
|
+
# @see KazeClient::Utils::AuthentifiedRequest
|
10
|
+
class TagRequest < Utils::FinalRequest
|
11
|
+
|
12
|
+
include Utils::AuthentifiedRequest
|
13
|
+
|
14
|
+
# @param tag_id [String]
|
15
|
+
def initialize(tag_id)
|
16
|
+
super(:get, "api/tag/#{tag_id}")
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module KazeClient
|
4
|
+
|
5
|
+
# @author chevre_a@modulotech.fr
|
6
|
+
# Fetch all tags
|
7
|
+
# @see KazeClient::Request
|
8
|
+
# @see KazeClient::Utils::FinalRequest
|
9
|
+
# @see KazeClient::Utils::AuthentifiedRequest
|
10
|
+
class TagsRequest < Utils::FinalRequest
|
11
|
+
|
12
|
+
include Utils::AuthentifiedRequest
|
13
|
+
|
14
|
+
def initialize
|
15
|
+
super(:get, 'api/tags')
|
16
|
+
end
|
17
|
+
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author chevre_a@modulotech.fr
|
5
6
|
# Upload an ActiveStorage::Attachment to a job document from a job.
|
6
7
|
# @see KazeClient::Request
|
@@ -12,6 +13,7 @@ module KazeClient
|
|
12
13
|
# response = KazeClient::Client.new(URL).execute(rq)
|
13
14
|
# rq.send_attachment(response['direct_upload'])
|
14
15
|
class UploadAttachmentRequest < Utils::FinalRequest
|
16
|
+
|
15
17
|
include Utils::AuthentifiedRequest
|
16
18
|
|
17
19
|
# @param attachment [ActiveStorage::Attachment]
|
@@ -23,9 +25,9 @@ module KazeClient
|
|
23
25
|
|
24
26
|
@body = {
|
25
27
|
blob: {
|
26
|
-
filename:
|
27
|
-
byte_size:
|
28
|
-
checksum:
|
28
|
+
filename: @attachment.filename,
|
29
|
+
byte_size: @attachment.byte_size,
|
30
|
+
checksum: @attachment.checksum,
|
29
31
|
content_type: @attachment.content_type
|
30
32
|
}
|
31
33
|
}
|
@@ -35,5 +37,7 @@ module KazeClient
|
|
35
37
|
header = direct_uploads['headers']
|
36
38
|
HTTParty.put(direct_uploads['url'], { body: @attachment.download, headers: header })
|
37
39
|
end
|
40
|
+
|
38
41
|
end
|
42
|
+
|
39
43
|
end
|
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module KazeClient
|
4
|
+
|
4
5
|
# @author pourch_t@modulotech.fr
|
5
6
|
# @author ciappa_m@modulotech.fr
|
6
7
|
# Upload an image to a job document from a job.
|
@@ -13,6 +14,7 @@ module KazeClient
|
|
13
14
|
# response = KazeClient::Client.new(URL).execute(request)
|
14
15
|
# request.send_image(response['direct_upload'])
|
15
16
|
class UploadImageRequest < Utils::FinalRequest
|
17
|
+
|
16
18
|
include Utils::AuthentifiedRequest
|
17
19
|
|
18
20
|
def initialize(filepath)
|
@@ -35,5 +37,7 @@ module KazeClient
|
|
35
37
|
header = direct_uploads['headers']
|
36
38
|
HTTParty.put(direct_uploads['url'], { body: body, headers: header })
|
37
39
|
end
|
40
|
+
|
38
41
|
end
|
42
|
+
|
39
43
|
end
|