cirro-ruby-client 1.1.0 → 1.2.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: 4345f8d02b4f3afcc21cd23b3b0c2edcfadeeeeb887dd0e7c7f501b5bb2ced40
4
+ data.tar.gz: 00ee7217ad02c180d22cae50b5c23a915a8998c47efacf68e99c7da630e4d255
5
5
  SHA512:
6
- metadata.gz: e82c0ff26229b5178e05e471a2fb746ac1de0cf5e531b1dcb0e77dfed39ba5b9205f1bdeaa91d221fe64617c578f473745896ee005f062ff7b947e83352b27af
7
- data.tar.gz: 131bf1dc4a613de2c26ffaf3328ca1631e4a5b9f672274975ef69e1c767a035a9e33130cb2ccd834de4154c68762c25d3c763d53a655e6a866f6c395b33e8628
6
+ metadata.gz: ec030038393796f3dcac6ccc457453100584e8fc2aeb4d2f9016a2b3d2cd004078e6155062bd940584909659f1e026cd325b0c2702dd7936afe80d03f7b7580e
7
+ data.tar.gz: '0853aff5207749a568f87fce5bf43d87ab47d883513c1c389f15d10398f71ce7d8f5ca4fced3e7f49aec4b042b74a34ccd2573a73d3c9fd2234c4de11fec3e0c'
data/Gemfile CHANGED
@@ -5,6 +5,8 @@ gemspec
5
5
 
6
6
  gem 'rake', '~> 12.0'
7
7
  gem 'rspec', '~> 3.0'
8
+ # tempprary till my PR gets approved in original gem
9
+ gem 'json_api_client', git: 'https://github.com/inderps/json_api_client'
8
10
 
9
11
  group :development do
10
12
  gem 'faker'
@@ -1,17 +1,28 @@
1
+ GIT
2
+ remote: https://github.com/inderps/json_api_client
3
+ revision: 675e1c8b1bf9978ca4722c2aa19314fb0aa5860b
4
+ specs:
5
+ json_api_client (1.17.1)
6
+ activemodel (>= 3.2.0)
7
+ activesupport (>= 3.2.0)
8
+ addressable (~> 2.2)
9
+ faraday (>= 0.15.2, < 1.2.0)
10
+ faraday_middleware (>= 0.9.0, < 1.2.0)
11
+ rack (>= 0.2)
12
+
1
13
  PATH
2
14
  remote: .
3
15
  specs:
4
16
  cirro-ruby-client (1.1.0)
5
17
  faraday_middleware
6
- json_api_client
7
18
  jwt
8
19
 
9
20
  GEM
10
21
  remote: https://rubygems.org/
11
22
  specs:
12
- activemodel (6.0.3.3)
13
- activesupport (= 6.0.3.3)
14
- activesupport (6.0.3.3)
23
+ activemodel (6.0.3.4)
24
+ activesupport (= 6.0.3.4)
25
+ activesupport (6.0.3.4)
15
26
  concurrent-ruby (~> 1.0, >= 1.0.2)
16
27
  i18n (>= 0.7, < 2)
17
28
  minitest (~> 5.1)
@@ -33,13 +44,6 @@ GEM
33
44
  hashdiff (1.0.1)
34
45
  i18n (1.8.5)
35
46
  concurrent-ruby (~> 1.0)
36
- json_api_client (1.17.1)
37
- activemodel (>= 3.2.0)
38
- activesupport (>= 3.2.0)
39
- addressable (~> 2.2)
40
- faraday (>= 0.15.2, < 1.2.0)
41
- faraday_middleware (>= 0.9.0, < 1.2.0)
42
- rack (>= 0.2)
43
47
  jwt (2.2.2)
44
48
  method_source (1.0.0)
45
49
  minitest (5.14.2)
@@ -84,14 +88,14 @@ GEM
84
88
  rubocop (~> 0.87)
85
89
  ruby-progressbar (1.10.1)
86
90
  thread_safe (0.3.6)
87
- tzinfo (1.2.7)
91
+ tzinfo (1.2.8)
88
92
  thread_safe (~> 0.1)
89
93
  unicode-display_width (1.7.0)
90
94
  webmock (3.9.1)
91
95
  addressable (>= 2.3.6)
92
96
  crack (>= 0.3.2)
93
97
  hashdiff (>= 0.4.0, < 2.0.0)
94
- zeitwerk (2.4.0)
98
+ zeitwerk (2.4.2)
95
99
 
96
100
  PLATFORMS
97
101
  ruby
@@ -99,6 +103,7 @@ PLATFORMS
99
103
  DEPENDENCIES
100
104
  cirro-ruby-client!
101
105
  faker
106
+ json_api_client!
102
107
  pry
103
108
  rake (~> 12.0)
104
109
  rspec (~> 3.0)
@@ -26,6 +26,5 @@ 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'
30
29
  spec.add_runtime_dependency 'faraday_middleware'
31
30
  end
@@ -9,6 +9,8 @@ require 'cirro_io/client/app_user'
9
9
  require 'cirro_io/client/app_worker'
10
10
  require 'cirro_io/client/worker_invitation_filter'
11
11
  require 'cirro_io/client/gig_task'
12
+ require 'cirro_io/client/gig_result'
13
+ require 'cirro_io/client/gig_time_activity'
12
14
  require 'cirro_io/client/gig'
13
15
 
14
16
  module CirroIO
@@ -3,26 +3,43 @@ module CirroIO
3
3
  class Gig < Base
4
4
  has_one :worker_invitation_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_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
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.2.0'
5
5
  end
6
6
  end
7
7
  # rubocop:enable Style/MutableConstant
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.2.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: 2020-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -24,20 +24,6 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: json_api_client
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: faraday_middleware
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -81,7 +67,9 @@ files:
81
67
  - lib/cirro_io/client/configuration.rb
82
68
  - lib/cirro_io/client/gig.rb
83
69
  - lib/cirro_io/client/gig_invitation.rb
70
+ - lib/cirro_io/client/gig_result.rb
84
71
  - lib/cirro_io/client/gig_task.rb
72
+ - lib/cirro_io/client/gig_time_activity.rb
85
73
  - lib/cirro_io/client/jwt_authentication.rb
86
74
  - lib/cirro_io/client/response_debugging_middleware.rb
87
75
  - lib/cirro_io/client/version.rb