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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '019901c543aede3628f96a1a896fe8f360c9d1bef28c5c5908b9d6786eda490e'
4
- data.tar.gz: 84c7707fa65dff0b0522bd9868d479be10afe8834e65d455297aab34438f1ed4
3
+ metadata.gz: a307c4d56c69dc3de6ec6d7253069f4cd7ca67a9a8ea14ad2d5b8d1c07fef8cd
4
+ data.tar.gz: a284adc2837156d46fdce366d6d84c6956419544dce82bf7b2f53299affbf95c
5
5
  SHA512:
6
- metadata.gz: 1233f3235a156f2bb8df4cc000abd2291a0e5dcc27da3b1a039047a7776ffca02b793b4e21341b2664efe9ad7c252b08cdc309b647c98455740207bdbf013c79
7
- data.tar.gz: 1116480d6e73e27e1217b6d0cca698d8f66258157bbc26290e2a1416711f1f32014500d3b68d408b43271743a3cd3868b6332c2920c60e6e696c0736c9cfe474
6
+ metadata.gz: 628d2c184935b720b57bf7b7466603a1c80921c78796e3e2f444f3d339cc4efd316de6dcbb3e199471d622961d84d08a0f2ffe9b33841d14cf6dd25fca32573e
7
+ data.tar.gz: c651329be9cb1d61a0995c23617dd9d22ca2f8fd2ef0787af42dbb25a84f3e1a2862a469b69dfbca2ec1c538a2f6de74a631de53818ee547caa3119be8dc9007
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirro-ruby-client (1.3.0)
4
+ cirro-ruby-client (1.4.0)
5
5
  faraday (< 1.2.0)
6
6
  faraday_middleware
7
7
  json_api_client (>= 1.10.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
+ ```
@@ -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'
@@ -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,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
@@ -1,7 +1,7 @@
1
1
  # rubocop:disable Style/MutableConstant
2
2
  module CirroIO
3
3
  module Client
4
- VERSION = '1.3.0'
4
+ VERSION = '1.4.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.3.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: 2021-02-01 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
@@ -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
- rubygems_version: 3.1.2
128
- signing_key:
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: []