cirro-ruby-client 1.1.0 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6a519fabbdd1bfa16f4f088ec3d7dc648c6aceb74931e420ed1488619735cac
4
- data.tar.gz: c08439cdaddb6444a2aba457dc93d68a997647a1472c6b39493461eddceb0402
3
+ metadata.gz: '019901c543aede3628f96a1a896fe8f360c9d1bef28c5c5908b9d6786eda490e'
4
+ data.tar.gz: 84c7707fa65dff0b0522bd9868d479be10afe8834e65d455297aab34438f1ed4
5
5
  SHA512:
6
- metadata.gz: e82c0ff26229b5178e05e471a2fb746ac1de0cf5e531b1dcb0e77dfed39ba5b9205f1bdeaa91d221fe64617c578f473745896ee005f062ff7b947e83352b27af
7
- data.tar.gz: 131bf1dc4a613de2c26ffaf3328ca1631e4a5b9f672274975ef69e1c767a035a9e33130cb2ccd834de4154c68762c25d3c763d53a655e6a866f6c395b33e8628
6
+ metadata.gz: 1233f3235a156f2bb8df4cc000abd2291a0e5dcc27da3b1a039047a7776ffca02b793b4e21341b2664efe9ad7c252b08cdc309b647c98455740207bdbf013c79
7
+ data.tar.gz: 1116480d6e73e27e1217b6d0cca698d8f66258157bbc26290e2a1416711f1f32014500d3b68d408b43271743a3cd3868b6332c2920c60e6e696c0736c9cfe474
data/Gemfile.lock CHANGED
@@ -1,22 +1,23 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirro-ruby-client (1.1.0)
4
+ cirro-ruby-client (1.3.0)
5
+ faraday (< 1.2.0)
5
6
  faraday_middleware
6
- json_api_client
7
+ json_api_client (>= 1.10.0)
7
8
  jwt
8
9
 
9
10
  GEM
10
11
  remote: https://rubygems.org/
11
12
  specs:
12
- activemodel (6.0.3.3)
13
- activesupport (= 6.0.3.3)
14
- activesupport (6.0.3.3)
13
+ activemodel (6.1.1)
14
+ activesupport (= 6.1.1)
15
+ activesupport (6.1.1)
15
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
- i18n (>= 0.7, < 2)
17
- minitest (~> 5.1)
18
- tzinfo (~> 1.1)
19
- zeitwerk (~> 2.2, >= 2.2.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
20
21
  addressable (2.7.0)
21
22
  public_suffix (>= 2.0.2, < 5.0)
22
23
  ast (2.4.1)
@@ -26,14 +27,15 @@ GEM
26
27
  diff-lcs (1.4.4)
27
28
  faker (2.14.0)
28
29
  i18n (>= 1.6, < 2)
29
- faraday (1.0.1)
30
+ faraday (1.1.0)
30
31
  multipart-post (>= 1.2, < 3)
32
+ ruby2_keywords
31
33
  faraday_middleware (1.0.0)
32
34
  faraday (~> 1.0)
33
35
  hashdiff (1.0.1)
34
36
  i18n (1.8.5)
35
37
  concurrent-ruby (~> 1.0)
36
- json_api_client (1.17.1)
38
+ json_api_client (1.18.0)
37
39
  activemodel (>= 3.2.0)
38
40
  activesupport (>= 3.2.0)
39
41
  addressable (~> 2.2)
@@ -42,7 +44,7 @@ GEM
42
44
  rack (>= 0.2)
43
45
  jwt (2.2.2)
44
46
  method_source (1.0.0)
45
- minitest (5.14.2)
47
+ minitest (5.14.3)
46
48
  multipart-post (2.1.1)
47
49
  parallel (1.19.2)
48
50
  parser (2.7.2.0)
@@ -83,15 +85,15 @@ GEM
83
85
  rubocop-rspec (1.43.2)
84
86
  rubocop (~> 0.87)
85
87
  ruby-progressbar (1.10.1)
86
- thread_safe (0.3.6)
87
- tzinfo (1.2.7)
88
- thread_safe (~> 0.1)
88
+ ruby2_keywords (0.0.4)
89
+ tzinfo (2.0.4)
90
+ concurrent-ruby (~> 1.0)
89
91
  unicode-display_width (1.7.0)
90
92
  webmock (3.9.1)
91
93
  addressable (>= 2.3.6)
92
94
  crack (>= 0.3.2)
93
95
  hashdiff (>= 0.4.0, < 2.0.0)
94
- zeitwerk (2.4.0)
96
+ zeitwerk (2.4.2)
95
97
 
96
98
  PLATFORMS
97
99
  ruby
@@ -26,6 +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 'json_api_client'
29
+ spec.add_runtime_dependency 'faraday', '< 1.2.0'
30
30
  spec.add_runtime_dependency 'faraday_middleware'
31
+ spec.add_runtime_dependency 'json_api_client', '>= 1.10.0'
31
32
  end
@@ -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,8 +8,10 @@ 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'
10
- require 'cirro_io/client/worker_invitation_filter'
11
+ require 'cirro_io/client/worker_filter'
11
12
  require 'cirro_io/client/gig_task'
13
+ require 'cirro_io/client/gig_result'
14
+ require 'cirro_io/client/gig_time_activity'
12
15
  require 'cirro_io/client/gig'
13
16
 
14
17
  module CirroIO
@@ -1,28 +1,45 @@
1
1
  module CirroIO
2
2
  module Client
3
3
  class Gig < Base
4
- has_one :worker_invitation_filter
4
+ has_one :worker_filter
5
5
  has_many :gig_tasks
6
+ has_many :gig_results
7
+ has_many :gig_time_activities
6
8
 
7
9
  # rubocop:disable Metrics/AbcSize
8
- def bulk_create_with(attrs)
9
- payload = { data: { attributes: attributes } }
10
+ def bulk_create_with(worker_filter, gig_tasks)
11
+ payload = { data: { attributes: attributes, relationships: {} } }
12
+ payload[:data][:relationships][:gig_tasks] = gig_tasks.map(&:attributes)
13
+ payload[:data][:relationships][:worker_filter] = worker_filter.attributes
10
14
 
11
- if attrs[:gig_tasks]
12
- payload[:data][:relationships] ||= {}
13
- payload[:data][:relationships][:gig_tasks] = attrs[:gig_tasks].map(&:attributes)
14
- end
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
15
19
 
16
- if attrs[:worker_invitation_filter]
17
- payload[:data][:relationships] ||= {}
18
- payload[:data][:relationships][:worker_invitation_filter] = attrs[:worker_invitation_filter].attributes
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 } } })
19
30
  end
20
31
 
21
- response = self.class.custom_post('bulk/gigs', payload)
32
+ response = self.class.custom_post("bulk/gigs/#{id}/archive", format_to_dashed_keys(payload))
22
33
 
23
34
  self.class.parser.parse(self.class, response).first
24
35
  end
25
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
26
43
  end
27
44
  end
28
45
  end
@@ -0,0 +1,8 @@
1
+ module CirroIO
2
+ module Client
3
+ class GigResult < Base
4
+ has_one :app_worker
5
+ has_one :gig_task
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ module CirroIO
2
+ module Client
3
+ class GigTimeActivity < Base
4
+ has_one :app_worker
5
+ end
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
1
  # rubocop:disable Style/MutableConstant
2
2
  module CirroIO
3
3
  module Client
4
- VERSION = '1.1.0'
4
+ VERSION = '1.3.0'
5
5
  end
6
6
  end
7
7
  # rubocop:enable Style/MutableConstant
@@ -1,6 +1,6 @@
1
1
  module CirroIO
2
2
  module Client
3
- class WorkerInvitationFilter < Base
3
+ class WorkerFilter < Base
4
4
  end
5
5
  end
6
6
  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.1.0
4
+ version: 1.3.0
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: 2020-11-26 00:00:00.000000000 Z
11
+ date: 2021-02-01 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: json_api_client
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
  - - ">="
@@ -39,19 +53,19 @@ dependencies:
39
53
  - !ruby/object:Gem::Version
40
54
  version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
- name: faraday_middleware
56
+ name: json_api_client
43
57
  requirement: !ruby/object:Gem::Requirement
44
58
  requirements:
45
59
  - - ">="
46
60
  - !ruby/object:Gem::Version
47
- version: '0'
61
+ version: 1.10.0
48
62
  type: :runtime
49
63
  prerelease: false
50
64
  version_requirements: !ruby/object:Gem::Requirement
51
65
  requirements:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
- version: '0'
68
+ version: 1.10.0
55
69
  description: Simple wrapper for Cirro API
56
70
  email:
57
71
  - OrgtestIODevelopers@epam.com
@@ -81,11 +95,13 @@ files:
81
95
  - lib/cirro_io/client/configuration.rb
82
96
  - lib/cirro_io/client/gig.rb
83
97
  - lib/cirro_io/client/gig_invitation.rb
98
+ - lib/cirro_io/client/gig_result.rb
84
99
  - lib/cirro_io/client/gig_task.rb
100
+ - lib/cirro_io/client/gig_time_activity.rb
85
101
  - lib/cirro_io/client/jwt_authentication.rb
86
102
  - lib/cirro_io/client/response_debugging_middleware.rb
87
103
  - lib/cirro_io/client/version.rb
88
- - lib/cirro_io/client/worker_invitation_filter.rb
104
+ - lib/cirro_io/client/worker_filter.rb
89
105
  homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
90
106
  licenses:
91
107
  - MIT