cirro-ruby-client 1.2.0 → 1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4345f8d02b4f3afcc21cd23b3b0c2edcfadeeeeb887dd0e7c7f501b5bb2ced40
4
- data.tar.gz: 00ee7217ad02c180d22cae50b5c23a915a8998c47efacf68e99c7da630e4d255
3
+ metadata.gz: a307c4d56c69dc3de6ec6d7253069f4cd7ca67a9a8ea14ad2d5b8d1c07fef8cd
4
+ data.tar.gz: a284adc2837156d46fdce366d6d84c6956419544dce82bf7b2f53299affbf95c
5
5
  SHA512:
6
- metadata.gz: ec030038393796f3dcac6ccc457453100584e8fc2aeb4d2f9016a2b3d2cd004078e6155062bd940584909659f1e026cd325b0c2702dd7936afe80d03f7b7580e
7
- data.tar.gz: '0853aff5207749a568f87fce5bf43d87ab47d883513c1c389f15d10398f71ce7d8f5ca4fced3e7f49aec4b042b74a34ccd2573a73d3c9fd2234c4de11fec3e0c'
6
+ metadata.gz: 628d2c184935b720b57bf7b7466603a1c80921c78796e3e2f444f3d339cc4efd316de6dcbb3e199471d622961d84d08a0f2ffe9b33841d14cf6dd25fca32573e
7
+ data.tar.gz: c651329be9cb1d61a0995c23617dd9d22ca2f8fd2ef0787af42dbb25a84f3e1a2862a469b69dfbca2ec1c538a2f6de74a631de53818ee547caa3119be8dc9007
data/Gemfile CHANGED
@@ -5,8 +5,6 @@ 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'
10
8
 
11
9
  group :development do
12
10
  gem 'faker'
data/Gemfile.lock CHANGED
@@ -1,33 +1,23 @@
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
-
13
1
  PATH
14
2
  remote: .
15
3
  specs:
16
- cirro-ruby-client (1.1.0)
4
+ cirro-ruby-client (1.4.0)
5
+ faraday (< 1.2.0)
17
6
  faraday_middleware
7
+ json_api_client (>= 1.10.0)
18
8
  jwt
19
9
 
20
10
  GEM
21
11
  remote: https://rubygems.org/
22
12
  specs:
23
- activemodel (6.0.3.4)
24
- activesupport (= 6.0.3.4)
25
- activesupport (6.0.3.4)
13
+ activemodel (6.1.1)
14
+ activesupport (= 6.1.1)
15
+ activesupport (6.1.1)
26
16
  concurrent-ruby (~> 1.0, >= 1.0.2)
27
- i18n (>= 0.7, < 2)
28
- minitest (~> 5.1)
29
- tzinfo (~> 1.1)
30
- zeitwerk (~> 2.2, >= 2.2.2)
17
+ i18n (>= 1.6, < 2)
18
+ minitest (>= 5.1)
19
+ tzinfo (~> 2.0)
20
+ zeitwerk (~> 2.3)
31
21
  addressable (2.7.0)
32
22
  public_suffix (>= 2.0.2, < 5.0)
33
23
  ast (2.4.1)
@@ -37,16 +27,24 @@ GEM
37
27
  diff-lcs (1.4.4)
38
28
  faker (2.14.0)
39
29
  i18n (>= 1.6, < 2)
40
- faraday (1.0.1)
30
+ faraday (1.1.0)
41
31
  multipart-post (>= 1.2, < 3)
32
+ ruby2_keywords
42
33
  faraday_middleware (1.0.0)
43
34
  faraday (~> 1.0)
44
35
  hashdiff (1.0.1)
45
36
  i18n (1.8.5)
46
37
  concurrent-ruby (~> 1.0)
38
+ json_api_client (1.18.0)
39
+ activemodel (>= 3.2.0)
40
+ activesupport (>= 3.2.0)
41
+ addressable (~> 2.2)
42
+ faraday (>= 0.15.2, < 1.2.0)
43
+ faraday_middleware (>= 0.9.0, < 1.2.0)
44
+ rack (>= 0.2)
47
45
  jwt (2.2.2)
48
46
  method_source (1.0.0)
49
- minitest (5.14.2)
47
+ minitest (5.14.3)
50
48
  multipart-post (2.1.1)
51
49
  parallel (1.19.2)
52
50
  parser (2.7.2.0)
@@ -87,9 +85,9 @@ GEM
87
85
  rubocop-rspec (1.43.2)
88
86
  rubocop (~> 0.87)
89
87
  ruby-progressbar (1.10.1)
90
- thread_safe (0.3.6)
91
- tzinfo (1.2.8)
92
- thread_safe (~> 0.1)
88
+ ruby2_keywords (0.0.4)
89
+ tzinfo (2.0.4)
90
+ concurrent-ruby (~> 1.0)
93
91
  unicode-display_width (1.7.0)
94
92
  webmock (3.9.1)
95
93
  addressable (>= 2.3.6)
@@ -103,7 +101,6 @@ PLATFORMS
103
101
  DEPENDENCIES
104
102
  cirro-ruby-client!
105
103
  faker
106
- json_api_client!
107
104
  pry
108
105
  rake (~> 12.0)
109
106
  rspec (~> 3.0)
data/README.md CHANGED
@@ -43,3 +43,15 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
43
43
  ## License
44
44
 
45
45
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
+
47
+ ## Usage
48
+
49
+ #### Bulk create gig invitations
50
+
51
+ ```ruby
52
+ gig = CirroIO::Client::Gig.load(id: 1)
53
+ filter = CirroIO::Client::WorkerFilter.new(filter_query: '{ "app_worker_id": { "$in": [1,2,3] } }')
54
+ invitation = CirroIO::Client::GigInvitation.new(gig: gig)
55
+
56
+ invitation.bulk_create_with(filter, auto_accept: true) # by default auto_accept is false
57
+ ```
@@ -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 'faraday', '< 1.2.0'
29
30
  spec.add_runtime_dependency 'faraday_middleware'
31
+ spec.add_runtime_dependency 'json_api_client', '>= 1.10.0'
30
32
  end
@@ -1,13 +1,15 @@
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'
5
6
  require 'cirro_io/client/jwt_authentication'
6
7
  require 'cirro_io/client/base'
8
+ require 'cirro_io/client/bulk_action_helper'
7
9
  require 'cirro_io/client/gig_invitation'
8
10
  require 'cirro_io/client/app_user'
9
11
  require 'cirro_io/client/app_worker'
10
- require 'cirro_io/client/worker_invitation_filter'
12
+ require 'cirro_io/client/worker_filter'
11
13
  require 'cirro_io/client/gig_task'
12
14
  require 'cirro_io/client/gig_result'
13
15
  require 'cirro_io/client/gig_time_activity'
@@ -0,0 +1,9 @@
1
+ module CirroIO
2
+ module Client
3
+ module BulkActionHelper
4
+ def format_to_dashed_keys(params)
5
+ params.deep_transform_keys { |key| key.to_s.gsub('_', '-') }
6
+ end
7
+ end
8
+ end
9
+ end
@@ -1,16 +1,18 @@
1
1
  module CirroIO
2
2
  module Client
3
3
  class Gig < Base
4
- has_one :worker_invitation_filter
4
+ include CirroIO::Client::BulkActionHelper
5
+
6
+ has_one :worker_filter
5
7
  has_many :gig_tasks
6
8
  has_many :gig_results
7
9
  has_many :gig_time_activities
8
10
 
9
11
  # rubocop:disable Metrics/AbcSize
10
- def bulk_create_with(worker_invitation_filter, gig_tasks)
12
+ def bulk_create_with(worker_filter, gig_tasks)
11
13
  payload = { data: { attributes: attributes, relationships: {} } }
12
14
  payload[:data][:relationships][:gig_tasks] = gig_tasks.map(&:attributes)
13
- payload[:data][:relationships][:worker_invitation_filter] = worker_invitation_filter.attributes
15
+ payload[:data][:relationships][:worker_filter] = worker_filter.attributes
14
16
 
15
17
  response = self.class.custom_post('bulk/gigs', format_to_dashed_keys(payload))
16
18
 
@@ -34,12 +36,6 @@ module CirroIO
34
36
  self.class.parser.parse(self.class, response).first
35
37
  end
36
38
  # 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
39
  end
44
40
  end
45
41
  end
@@ -1,6 +1,17 @@
1
1
  module CirroIO
2
2
  module Client
3
3
  class GigInvitation < Base
4
+ include CirroIO::Client::BulkActionHelper
5
+
6
+ has_one :gig
7
+
8
+ def bulk_create_with(worker_filter, auto_accept: false)
9
+ payload = { data: { attributes: attributes.merge(worker_filter: worker_filter.attributes, auto_accept: auto_accept) } }
10
+
11
+ response = self.class.custom_post("bulk/gigs/#{gig.id}/gig_invitations", format_to_dashed_keys(payload))
12
+
13
+ self.class.parser.parse(self.class, response)
14
+ end
4
15
  end
5
16
  end
6
17
  end
@@ -1,7 +1,7 @@
1
1
  # rubocop:disable Style/MutableConstant
2
2
  module CirroIO
3
3
  module Client
4
- VERSION = '1.2.0'
4
+ VERSION = '1.4.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.2.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cirro Dev Team
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-02 00:00:00.000000000 Z
11
+ date: 2021-04-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
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
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: faraday_middleware
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -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
@@ -64,6 +92,7 @@ files:
64
92
  - lib/cirro_io/client/app_user.rb
65
93
  - lib/cirro_io/client/app_worker.rb
66
94
  - lib/cirro_io/client/base.rb
95
+ - lib/cirro_io/client/bulk_action_helper.rb
67
96
  - lib/cirro_io/client/configuration.rb
68
97
  - lib/cirro_io/client/gig.rb
69
98
  - lib/cirro_io/client/gig_invitation.rb
@@ -73,7 +102,7 @@ files:
73
102
  - lib/cirro_io/client/jwt_authentication.rb
74
103
  - lib/cirro_io/client/response_debugging_middleware.rb
75
104
  - lib/cirro_io/client/version.rb
76
- - lib/cirro_io/client/worker_invitation_filter.rb
105
+ - lib/cirro_io/client/worker_filter.rb
77
106
  homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
78
107
  licenses:
79
108
  - MIT
@@ -81,7 +110,7 @@ metadata:
81
110
  homepage_uri: https://cirro.io/api-docs/v1#cirro-api-documentation
82
111
  source_code_uri: https://github.com/test-IO/cirro-ruby-client
83
112
  changelog_uri: https://github.com/test-IO/cirro-ruby-client/CHANGELOG.md
84
- post_install_message:
113
+ post_install_message:
85
114
  rdoc_options: []
86
115
  require_paths:
87
116
  - lib
@@ -96,8 +125,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
96
125
  - !ruby/object:Gem::Version
97
126
  version: '0'
98
127
  requirements: []
99
- rubygems_version: 3.1.2
100
- signing_key:
128
+ rubyforge_project:
129
+ rubygems_version: 2.7.7
130
+ signing_key:
101
131
  specification_version: 4
102
132
  summary: Ruby client library for Cirro API
103
133
  test_files: []