cirro-ruby-client 1.0.1 → 1.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +11 -8
- data/cirro-ruby-client.gemspec +3 -1
- data/lib/cirro_io/client.rb +6 -0
- data/lib/cirro_io/client/app_user.rb +0 -3
- data/lib/cirro_io/client/app_worker.rb +0 -4
- data/lib/cirro_io/client/base.rb +13 -0
- data/lib/cirro_io/client/gig.rb +45 -0
- data/lib/cirro_io/client/gig_invitation.rb +0 -3
- data/lib/cirro_io/client/gig_result.rb +8 -0
- data/lib/cirro_io/client/gig_task.rb +6 -0
- data/lib/cirro_io/client/gig_time_activity.rb +7 -0
- data/lib/cirro_io/client/response_debugging_middleware.rb +1 -1
- data/lib/cirro_io/client/version.rb +1 -1
- data/lib/cirro_io/client/worker_invitation_filter.rb +6 -0
- metadata +36 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcb633e6af68286109c3f5329c596be38609e12bfc74f8db3532b62b5d7a198a
|
4
|
+
data.tar.gz: 1043a463fdd431cf96fb4abe6c85de402c3c39c00056c830eb701457f0a2f246
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 19b4504bb063bcf4ba2575c785928c7cc7a5b358e10fbf5bb17a39a5dd1b0b5b647e416c4450686682cf5e78ee88a62dbdcb452fc0a4e053731a4a2aaa406f67
|
7
|
+
data.tar.gz: bddcf4a2f30da9ae1e6ba56a1099b57957f50cefeb642e226e08ae974f756d3a874b739380732f3d937e7b9f5386639c4046903ffddd766b294c26d1ed24f2d4
|
data/Gemfile.lock
CHANGED
@@ -1,16 +1,17 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cirro-ruby-client (1.
|
4
|
+
cirro-ruby-client (1.2.1)
|
5
|
+
faraday_middleware
|
5
6
|
json_api_client
|
6
7
|
jwt
|
7
8
|
|
8
9
|
GEM
|
9
10
|
remote: https://rubygems.org/
|
10
11
|
specs:
|
11
|
-
activemodel (6.0.3.
|
12
|
-
activesupport (= 6.0.3.
|
13
|
-
activesupport (6.0.3.
|
12
|
+
activemodel (6.0.3.4)
|
13
|
+
activesupport (= 6.0.3.4)
|
14
|
+
activesupport (6.0.3.4)
|
14
15
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
15
16
|
i18n (>= 0.7, < 2)
|
16
17
|
minitest (~> 5.1)
|
@@ -25,14 +26,15 @@ GEM
|
|
25
26
|
diff-lcs (1.4.4)
|
26
27
|
faker (2.14.0)
|
27
28
|
i18n (>= 1.6, < 2)
|
28
|
-
faraday (1.0
|
29
|
+
faraday (1.1.0)
|
29
30
|
multipart-post (>= 1.2, < 3)
|
31
|
+
ruby2_keywords
|
30
32
|
faraday_middleware (1.0.0)
|
31
33
|
faraday (~> 1.0)
|
32
34
|
hashdiff (1.0.1)
|
33
35
|
i18n (1.8.5)
|
34
36
|
concurrent-ruby (~> 1.0)
|
35
|
-
json_api_client (1.
|
37
|
+
json_api_client (1.18.0)
|
36
38
|
activemodel (>= 3.2.0)
|
37
39
|
activesupport (>= 3.2.0)
|
38
40
|
addressable (~> 2.2)
|
@@ -82,15 +84,16 @@ GEM
|
|
82
84
|
rubocop-rspec (1.43.2)
|
83
85
|
rubocop (~> 0.87)
|
84
86
|
ruby-progressbar (1.10.1)
|
87
|
+
ruby2_keywords (0.0.2)
|
85
88
|
thread_safe (0.3.6)
|
86
|
-
tzinfo (1.2.
|
89
|
+
tzinfo (1.2.8)
|
87
90
|
thread_safe (~> 0.1)
|
88
91
|
unicode-display_width (1.7.0)
|
89
92
|
webmock (3.9.1)
|
90
93
|
addressable (>= 2.3.6)
|
91
94
|
crack (>= 0.3.2)
|
92
95
|
hashdiff (>= 0.4.0, < 2.0.0)
|
93
|
-
zeitwerk (2.4.
|
96
|
+
zeitwerk (2.4.2)
|
94
97
|
|
95
98
|
PLATFORMS
|
96
99
|
ruby
|
data/cirro-ruby-client.gemspec
CHANGED
@@ -26,5 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.require_paths = ['lib']
|
27
27
|
|
28
28
|
spec.add_runtime_dependency 'jwt'
|
29
|
-
spec.add_runtime_dependency '
|
29
|
+
spec.add_runtime_dependency 'faraday', '< 1.2.0'
|
30
|
+
spec.add_runtime_dependency 'faraday_middleware'
|
31
|
+
spec.add_runtime_dependency 'json_api_client', '>= 1.10.0'
|
30
32
|
end
|
data/lib/cirro_io/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'json_api_client'
|
2
|
+
|
2
3
|
require 'cirro_io/client/version'
|
3
4
|
require 'cirro_io/client/configuration'
|
4
5
|
require 'cirro_io/client/response_debugging_middleware'
|
@@ -7,6 +8,11 @@ require 'cirro_io/client/base'
|
|
7
8
|
require 'cirro_io/client/gig_invitation'
|
8
9
|
require 'cirro_io/client/app_user'
|
9
10
|
require 'cirro_io/client/app_worker'
|
11
|
+
require 'cirro_io/client/worker_invitation_filter'
|
12
|
+
require 'cirro_io/client/gig_task'
|
13
|
+
require 'cirro_io/client/gig_result'
|
14
|
+
require 'cirro_io/client/gig_time_activity'
|
15
|
+
require 'cirro_io/client/gig'
|
10
16
|
|
11
17
|
module CirroIO
|
12
18
|
module Client
|
data/lib/cirro_io/client/base.rb
CHANGED
@@ -9,6 +9,19 @@ module CirroIO
|
|
9
9
|
super(url)
|
10
10
|
connection.faraday.url_prefix = url
|
11
11
|
end
|
12
|
+
|
13
|
+
def self.custom_post(endpoint, payload)
|
14
|
+
custom_connection.post(endpoint, payload.to_json)
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.custom_connection
|
18
|
+
Faraday.new(url: "#{CirroIO::Client.configuration.site}/#{CirroIO::Client.configuration.api_version}") do |conn|
|
19
|
+
conn.request :json
|
20
|
+
conn.response :json
|
21
|
+
conn.use CirroIO::Client::JwtAuthentication
|
22
|
+
conn.use JsonApiClient::Middleware::Status, {}
|
23
|
+
end
|
24
|
+
end
|
12
25
|
end
|
13
26
|
end
|
14
27
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module CirroIO
|
2
|
+
module Client
|
3
|
+
class Gig < Base
|
4
|
+
has_one :worker_invitation_filter
|
5
|
+
has_many :gig_tasks
|
6
|
+
has_many :gig_results
|
7
|
+
has_many :gig_time_activities
|
8
|
+
|
9
|
+
# rubocop:disable Metrics/AbcSize
|
10
|
+
def bulk_create_with(worker_invitation_filter, gig_tasks)
|
11
|
+
payload = { data: { attributes: attributes, relationships: {} } }
|
12
|
+
payload[:data][:relationships][:gig_tasks] = gig_tasks.map(&:attributes)
|
13
|
+
payload[:data][:relationships][:worker_invitation_filter] = worker_invitation_filter.attributes
|
14
|
+
|
15
|
+
response = self.class.custom_post('bulk/gigs', format_to_dashed_keys(payload))
|
16
|
+
|
17
|
+
self.class.parser.parse(self.class, response).first
|
18
|
+
end
|
19
|
+
|
20
|
+
def bulk_archive_with(gig_results, gig_time_activities)
|
21
|
+
payload = { data: { relationships: {} } }
|
22
|
+
payload[:data][:relationships][:gig_results] = gig_results.map do |result|
|
23
|
+
result.attributes.merge({ relationships: {
|
24
|
+
'app-worker': { data: result.app_worker.attributes },
|
25
|
+
'gig-task': { data: result.gig_task.attributes },
|
26
|
+
} })
|
27
|
+
end
|
28
|
+
payload[:data][:relationships][:gig_time_activities] = gig_time_activities.map do |activity|
|
29
|
+
activity.attributes.merge({ relationships: { 'app-worker': { data: activity.app_worker.attributes } } })
|
30
|
+
end
|
31
|
+
|
32
|
+
response = self.class.custom_post("bulk/gigs/#{id}/archive", format_to_dashed_keys(payload))
|
33
|
+
|
34
|
+
self.class.parser.parse(self.class, response).first
|
35
|
+
end
|
36
|
+
# rubocop:enable Metrics/AbcSize
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def format_to_dashed_keys(params)
|
41
|
+
params.deep_transform_keys { |key| key.to_s.gsub('_', '-') }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cirro-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cirro Dev Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -25,7 +25,21 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "<"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: 1.2.0
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday_middleware
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - ">="
|
@@ -38,6 +52,20 @@ dependencies:
|
|
38
52
|
- - ">="
|
39
53
|
- !ruby/object:Gem::Version
|
40
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json_api_client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.10.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.10.0
|
41
69
|
description: Simple wrapper for Cirro API
|
42
70
|
email:
|
43
71
|
- OrgtestIODevelopers@epam.com
|
@@ -65,10 +93,15 @@ files:
|
|
65
93
|
- lib/cirro_io/client/app_worker.rb
|
66
94
|
- lib/cirro_io/client/base.rb
|
67
95
|
- lib/cirro_io/client/configuration.rb
|
96
|
+
- lib/cirro_io/client/gig.rb
|
68
97
|
- lib/cirro_io/client/gig_invitation.rb
|
98
|
+
- lib/cirro_io/client/gig_result.rb
|
99
|
+
- lib/cirro_io/client/gig_task.rb
|
100
|
+
- lib/cirro_io/client/gig_time_activity.rb
|
69
101
|
- lib/cirro_io/client/jwt_authentication.rb
|
70
102
|
- lib/cirro_io/client/response_debugging_middleware.rb
|
71
103
|
- lib/cirro_io/client/version.rb
|
104
|
+
- lib/cirro_io/client/worker_invitation_filter.rb
|
72
105
|
homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
|
73
106
|
licenses:
|
74
107
|
- MIT
|