cirro-ruby-client 1.2.2 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -15
- data/README.md +12 -0
- data/cirro-ruby-client.gemspec +2 -1
- data/lib/cirro_io/client.rb +6 -1
- data/lib/cirro_io/client/app_worker.rb +1 -0
- data/lib/cirro_io/client/base.rb +9 -9
- data/lib/cirro_io/client/bulk_action_helper.rb +9 -0
- data/lib/cirro_io/client/gig.rb +5 -9
- data/lib/cirro_io/client/gig_invitation.rb +11 -0
- data/lib/cirro_io/client/notifications_broadcast.rb +8 -0
- data/lib/cirro_io/client/{worker_invitation_filter.rb → notifications_channel.rb} +1 -1
- data/lib/cirro_io/client/notifications_template.rb +7 -0
- data/lib/cirro_io/client/payout.rb +7 -0
- data/lib/cirro_io/client/version.rb +1 -1
- data/lib/cirro_io/client/worker_filter.rb +6 -0
- metadata +24 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e6e3f17c3acdc3e539664def130e878b587730478ae7cafb3201028616057f8a
|
4
|
+
data.tar.gz: '0069fc55eb4d448e63301574530a4107643d991bb13576850e3fdfaa9dbf7994'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14a90dc502be3d444a4534d3b7e88b823e4fac4a740c1293363985bb2d1dd68fc92bffb8c4f9c06afaddfe214f2922a6cbd9f2e00edb0e6bfea79c108434a2ca
|
7
|
+
data.tar.gz: 03cb09ec7e03c958acc035d02c8be6d4dabe4b68aeb4885f7b1c832ffc5f0b4122c22748bbd869c55a3fe882eccc34014f52e47b28578d6945b3004db1155157
|
data/Gemfile.lock
CHANGED
@@ -1,22 +1,23 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cirro-ruby-client (1.
|
4
|
+
cirro-ruby-client (1.5.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.
|
13
|
-
activesupport (= 6.
|
14
|
-
activesupport (6.
|
13
|
+
activemodel (6.1.3.2)
|
14
|
+
activesupport (= 6.1.3.2)
|
15
|
+
activesupport (6.1.3.2)
|
15
16
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
16
|
-
i18n (>=
|
17
|
-
minitest (
|
18
|
-
tzinfo (~>
|
19
|
-
zeitwerk (~> 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)
|
@@ -41,9 +42,9 @@ GEM
|
|
41
42
|
faraday (>= 0.15.2, < 1.2.0)
|
42
43
|
faraday_middleware (>= 0.9.0, < 1.2.0)
|
43
44
|
rack (>= 0.2)
|
44
|
-
jwt (2.2.
|
45
|
+
jwt (2.2.3)
|
45
46
|
method_source (1.0.0)
|
46
|
-
minitest (5.14.
|
47
|
+
minitest (5.14.4)
|
47
48
|
multipart-post (2.1.1)
|
48
49
|
parallel (1.19.2)
|
49
50
|
parser (2.7.2.0)
|
@@ -84,10 +85,9 @@ GEM
|
|
84
85
|
rubocop-rspec (1.43.2)
|
85
86
|
rubocop (~> 0.87)
|
86
87
|
ruby-progressbar (1.10.1)
|
87
|
-
ruby2_keywords (0.0.
|
88
|
-
|
89
|
-
|
90
|
-
thread_safe (~> 0.1)
|
88
|
+
ruby2_keywords (0.0.4)
|
89
|
+
tzinfo (2.0.4)
|
90
|
+
concurrent-ruby (~> 1.0)
|
91
91
|
unicode-display_width (1.7.0)
|
92
92
|
webmock (3.9.1)
|
93
93
|
addressable (>= 2.3.6)
|
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
|
+
```
|
data/cirro-ruby-client.gemspec
CHANGED
@@ -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 'faraday', '< 1.2.0'
|
29
30
|
spec.add_runtime_dependency 'faraday_middleware'
|
30
|
-
spec.add_runtime_dependency 'json_api_client'
|
31
|
+
spec.add_runtime_dependency 'json_api_client', '>= 1.10.0'
|
31
32
|
end
|
data/lib/cirro_io/client.rb
CHANGED
@@ -5,14 +5,19 @@ require 'cirro_io/client/configuration'
|
|
5
5
|
require 'cirro_io/client/response_debugging_middleware'
|
6
6
|
require 'cirro_io/client/jwt_authentication'
|
7
7
|
require 'cirro_io/client/base'
|
8
|
+
require 'cirro_io/client/bulk_action_helper'
|
8
9
|
require 'cirro_io/client/gig_invitation'
|
9
10
|
require 'cirro_io/client/app_user'
|
10
11
|
require 'cirro_io/client/app_worker'
|
11
|
-
require 'cirro_io/client/
|
12
|
+
require 'cirro_io/client/worker_filter'
|
12
13
|
require 'cirro_io/client/gig_task'
|
13
14
|
require 'cirro_io/client/gig_result'
|
14
15
|
require 'cirro_io/client/gig_time_activity'
|
15
16
|
require 'cirro_io/client/gig'
|
17
|
+
require 'cirro_io/client/payout'
|
18
|
+
require 'cirro_io/client/notifications_broadcast'
|
19
|
+
require 'cirro_io/client/notifications_channel'
|
20
|
+
require 'cirro_io/client/notifications_template'
|
16
21
|
|
17
22
|
module CirroIO
|
18
23
|
module Client
|
data/lib/cirro_io/client/base.rb
CHANGED
@@ -4,10 +4,16 @@ module CirroIO
|
|
4
4
|
self.route_format = :dasherized_route
|
5
5
|
self.json_key_format = :dasherized_key
|
6
6
|
|
7
|
-
# https://github.com/JsonApiClient/json_api_client/issues/215
|
7
|
+
# HACK: https://github.com/JsonApiClient/json_api_client/issues/215
|
8
|
+
# Used for initialization as well
|
8
9
|
def self.site=(url)
|
9
|
-
super
|
10
|
-
|
10
|
+
super.tap do
|
11
|
+
connection true do |connection|
|
12
|
+
connection.use JwtAuthentication
|
13
|
+
connection.use Faraday::Response::Logger
|
14
|
+
# connection.use ResponseDebuggingMiddleware # for debugging or while adding new specs
|
15
|
+
end
|
16
|
+
end
|
11
17
|
end
|
12
18
|
|
13
19
|
def self.custom_post(endpoint, payload)
|
@@ -25,9 +31,3 @@ module CirroIO
|
|
25
31
|
end
|
26
32
|
end
|
27
33
|
end
|
28
|
-
|
29
|
-
CirroIO::Client::Base.connection do |connection|
|
30
|
-
connection.use CirroIO::Client::JwtAuthentication
|
31
|
-
connection.use Faraday::Response::Logger
|
32
|
-
# connection.use CirroIO::Client::ResponseDebuggingMiddleware # This middleware can be injected during debugging or while adding new specs
|
33
|
-
end
|
data/lib/cirro_io/client/gig.rb
CHANGED
@@ -1,16 +1,18 @@
|
|
1
1
|
module CirroIO
|
2
2
|
module Client
|
3
3
|
class Gig < Base
|
4
|
-
|
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(
|
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][:
|
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
|
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.6.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:
|
11
|
+
date: 2021-06-24 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
|
@@ -44,14 +58,14 @@ dependencies:
|
|
44
58
|
requirements:
|
45
59
|
- - ">="
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
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:
|
68
|
+
version: 1.10.0
|
55
69
|
description: Simple wrapper for Cirro API
|
56
70
|
email:
|
57
71
|
- OrgtestIODevelopers@epam.com
|
@@ -78,6 +92,7 @@ files:
|
|
78
92
|
- lib/cirro_io/client/app_user.rb
|
79
93
|
- lib/cirro_io/client/app_worker.rb
|
80
94
|
- lib/cirro_io/client/base.rb
|
95
|
+
- lib/cirro_io/client/bulk_action_helper.rb
|
81
96
|
- lib/cirro_io/client/configuration.rb
|
82
97
|
- lib/cirro_io/client/gig.rb
|
83
98
|
- lib/cirro_io/client/gig_invitation.rb
|
@@ -85,9 +100,13 @@ files:
|
|
85
100
|
- lib/cirro_io/client/gig_task.rb
|
86
101
|
- lib/cirro_io/client/gig_time_activity.rb
|
87
102
|
- lib/cirro_io/client/jwt_authentication.rb
|
103
|
+
- lib/cirro_io/client/notifications_broadcast.rb
|
104
|
+
- lib/cirro_io/client/notifications_channel.rb
|
105
|
+
- lib/cirro_io/client/notifications_template.rb
|
106
|
+
- lib/cirro_io/client/payout.rb
|
88
107
|
- lib/cirro_io/client/response_debugging_middleware.rb
|
89
108
|
- lib/cirro_io/client/version.rb
|
90
|
-
- lib/cirro_io/client/
|
109
|
+
- lib/cirro_io/client/worker_filter.rb
|
91
110
|
homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
|
92
111
|
licenses:
|
93
112
|
- MIT
|