cirro-ruby-client 1.3.0 → 1.4.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 +1 -1
- data/README.md +12 -0
- data/lib/cirro_io/client.rb +1 -0
- data/lib/cirro_io/client/bulk_action_helper.rb +9 -0
- data/lib/cirro_io/client/gig.rb +2 -6
- data/lib/cirro_io/client/gig_invitation.rb +11 -0
- data/lib/cirro_io/client/version.rb +1 -1
- metadata +8 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a307c4d56c69dc3de6ec6d7253069f4cd7ca67a9a8ea14ad2d5b8d1c07fef8cd
|
4
|
+
data.tar.gz: a284adc2837156d46fdce366d6d84c6956419544dce82bf7b2f53299affbf95c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 628d2c184935b720b57bf7b7466603a1c80921c78796e3e2f444f3d339cc4efd316de6dcbb3e199471d622961d84d08a0f2ffe9b33841d14cf6dd25fca32573e
|
7
|
+
data.tar.gz: c651329be9cb1d61a0995c23617dd9d22ca2f8fd2ef0787af42dbb25a84f3e1a2862a469b69dfbca2ec1c538a2f6de74a631de53818ee547caa3119be8dc9007
|
data/Gemfile.lock
CHANGED
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/lib/cirro_io/client.rb
CHANGED
@@ -5,6 +5,7 @@ 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'
|
data/lib/cirro_io/client/gig.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
module CirroIO
|
2
2
|
module Client
|
3
3
|
class Gig < Base
|
4
|
+
include CirroIO::Client::BulkActionHelper
|
5
|
+
|
4
6
|
has_one :worker_filter
|
5
7
|
has_many :gig_tasks
|
6
8
|
has_many :gig_results
|
@@ -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.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: 2021-
|
11
|
+
date: 2021-04-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jwt
|
@@ -92,6 +92,7 @@ files:
|
|
92
92
|
- lib/cirro_io/client/app_user.rb
|
93
93
|
- lib/cirro_io/client/app_worker.rb
|
94
94
|
- lib/cirro_io/client/base.rb
|
95
|
+
- lib/cirro_io/client/bulk_action_helper.rb
|
95
96
|
- lib/cirro_io/client/configuration.rb
|
96
97
|
- lib/cirro_io/client/gig.rb
|
97
98
|
- lib/cirro_io/client/gig_invitation.rb
|
@@ -109,7 +110,7 @@ metadata:
|
|
109
110
|
homepage_uri: https://cirro.io/api-docs/v1#cirro-api-documentation
|
110
111
|
source_code_uri: https://github.com/test-IO/cirro-ruby-client
|
111
112
|
changelog_uri: https://github.com/test-IO/cirro-ruby-client/CHANGELOG.md
|
112
|
-
post_install_message:
|
113
|
+
post_install_message:
|
113
114
|
rdoc_options: []
|
114
115
|
require_paths:
|
115
116
|
- lib
|
@@ -124,8 +125,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
125
|
- !ruby/object:Gem::Version
|
125
126
|
version: '0'
|
126
127
|
requirements: []
|
127
|
-
|
128
|
-
|
128
|
+
rubyforge_project:
|
129
|
+
rubygems_version: 2.7.7
|
130
|
+
signing_key:
|
129
131
|
specification_version: 4
|
130
132
|
summary: Ruby client library for Cirro API
|
131
133
|
test_files: []
|