Skip to content

Commit 1c32c9f

Browse files
Merge pull request #12 from test-IO/feature/worker-filter
Rename WorkerInvitationFilter to WorkerFilter
2 parents b098d84 + 6aad96c commit 1c32c9f

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

Gemfile.lock

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
PATH
22
remote: .
33
specs:
4-
cirro-ruby-client (1.2.1)
4+
cirro-ruby-client (1.3.0)
5+
faraday (< 1.2.0)
56
faraday_middleware
6-
json_api_client
7+
json_api_client (>= 1.10.0)
78
jwt
89

910
GEM
1011
remote: https://rubygems.org/
1112
specs:
12-
activemodel (6.0.3.4)
13-
activesupport (= 6.0.3.4)
14-
activesupport (6.0.3.4)
13+
activemodel (6.1.1)
14+
activesupport (= 6.1.1)
15+
activesupport (6.1.1)
1516
concurrent-ruby (~> 1.0, >= 1.0.2)
16-
i18n (>= 0.7, < 2)
17-
minitest (~> 5.1)
18-
tzinfo (~> 1.1)
19-
zeitwerk (~> 2.2, >= 2.2.2)
17+
i18n (>= 1.6, < 2)
18+
minitest (>= 5.1)
19+
tzinfo (~> 2.0)
20+
zeitwerk (~> 2.3)
2021
addressable (2.7.0)
2122
public_suffix (>= 2.0.2, < 5.0)
2223
ast (2.4.1)
@@ -43,7 +44,7 @@ GEM
4344
rack (>= 0.2)
4445
jwt (2.2.2)
4546
method_source (1.0.0)
46-
minitest (5.14.2)
47+
minitest (5.14.3)
4748
multipart-post (2.1.1)
4849
parallel (1.19.2)
4950
parser (2.7.2.0)
@@ -84,10 +85,9 @@ GEM
8485
rubocop-rspec (1.43.2)
8586
rubocop (~> 0.87)
8687
ruby-progressbar (1.10.1)
87-
ruby2_keywords (0.0.2)
88-
thread_safe (0.3.6)
89-
tzinfo (1.2.8)
90-
thread_safe (~> 0.1)
88+
ruby2_keywords (0.0.4)
89+
tzinfo (2.0.4)
90+
concurrent-ruby (~> 1.0)
9191
unicode-display_width (1.7.0)
9292
webmock (3.9.1)
9393
addressable (>= 2.3.6)

lib/cirro_io/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
require 'cirro_io/client/gig_invitation'
99
require 'cirro_io/client/app_user'
1010
require 'cirro_io/client/app_worker'
11-
require 'cirro_io/client/worker_invitation_filter'
11+
require 'cirro_io/client/worker_filter'
1212
require 'cirro_io/client/gig_task'
1313
require 'cirro_io/client/gig_result'
1414
require 'cirro_io/client/gig_time_activity'

lib/cirro_io/client/gig.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
module CirroIO
22
module Client
33
class Gig < Base
4-
has_one :worker_invitation_filter
4+
has_one :worker_filter
55
has_many :gig_tasks
66
has_many :gig_results
77
has_many :gig_time_activities
88

99
# rubocop:disable Metrics/AbcSize
10-
def bulk_create_with(worker_invitation_filter, gig_tasks)
10+
def bulk_create_with(worker_filter, gig_tasks)
1111
payload = { data: { attributes: attributes, relationships: {} } }
1212
payload[:data][:relationships][:gig_tasks] = gig_tasks.map(&:attributes)
13-
payload[:data][:relationships][:worker_invitation_filter] = worker_invitation_filter.attributes
13+
payload[:data][:relationships][:worker_filter] = worker_filter.attributes
1414

1515
response = self.class.custom_post('bulk/gigs', format_to_dashed_keys(payload))
1616

lib/cirro_io/client/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# rubocop:disable Style/MutableConstant
22
module CirroIO
33
module Client
4-
VERSION = '1.2.3'
4+
VERSION = '1.3.0'
55
end
66
end
77
# rubocop:enable Style/MutableConstant
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module CirroIO
22
module Client
3-
class WorkerInvitationFilter < Base
3+
class WorkerFilter < Base
44
end
55
end
66
end

spec/cirro_io/client/gig_spec.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,19 @@
1313
archive_at: 1.month.from_now)
1414
end
1515

16-
let(:worker_invitation_filter) { CirroIO::Client::WorkerInvitationFilter.new(filter_query: '{}') }
16+
let(:worker_filter) { CirroIO::Client::WorkerFilter.new(filter_query: '{}') }
1717
let(:gig_task1) { CirroIO::Client::GigTask.new(title: Faker::Hipster.sentence, base_price: 5) }
1818
let(:gig_task2) { CirroIO::Client::GigTask.new(title: Faker::Hipster.sentence, base_price: 10) }
1919

2020
it 'bulk create a gig with gig tasks and filter query' do
2121
stub_request(:post, "#{test_site}/v1/bulk/gigs")
2222
.to_return(body: File.read('./spec/fixtures/gig_with_filter_and_gig_tasks.json'), headers: { 'Content-Type' => 'application/json' })
2323

24-
created_gig = gig.bulk_create_with(worker_invitation_filter, [gig_task1, gig_task2])
24+
created_gig = gig.bulk_create_with(worker_filter, [gig_task1, gig_task2])
2525

2626
expect(created_gig).to be_valid
2727
expect(created_gig.id).to eq('15')
28-
expect(created_gig.worker_invitation_filter.id).to eq('20')
28+
expect(created_gig.worker_filter.id).to eq('20')
2929
expect(created_gig.gig_tasks.map(&:id)).to eq(%w[24 25])
3030
end
3131
end

spec/fixtures/gig_with_filter_and_gig_tasks.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
"archive-at": "2020-12-30T10:27:18.000Z"
1515
},
1616
"relationships": {
17-
"worker-invitation-filter": {
17+
"worker-filter": {
1818
"data": {
19-
"type": "worker-invitation-filters",
19+
"type": "worker-filters",
2020
"id": "20"
2121
}
2222
},
@@ -41,9 +41,9 @@
4141
"included": [
4242
{
4343
"id": "20",
44-
"type": "worker-invitation-filters",
44+
"type": "worker-filters",
4545
"links": {
46-
"self": "/api/v1/worker-invitation-filters/20"
46+
"self": "/api/v1/worker-filters/20"
4747
},
4848
"attributes": {
4949
"filter-query": "{}"

0 commit comments

Comments
 (0)