cirro-ruby-client 2.5.11 → 2.5.13

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: 2ce81e7b0822c3a040876d798246e58e6e3c1d4d53ae65a00d8f8c31a1b93376
4
- data.tar.gz: 2a6ba790c9021d73593c657de850874ee30483b9defbe909be87b4cd5af44d1a
3
+ metadata.gz: c75643dbc6c63d1b537edeb0d49d8f0d1b4049a30dd10c823e5dd681548029ba
4
+ data.tar.gz: 42db942af4c2eb64066904a6a9d49fb6f216b129e1abbcb23051ddf7fa0472ff
5
5
  SHA512:
6
- metadata.gz: 9e7c815ff399fce832806acd5e5e02af6f55c74de231390cbdf7f24cacc17eadf0c2608888e6e6a299c2eed96a3bb3c46ba0ad3a791509bb91bf732464e4194a
7
- data.tar.gz: 63ed1f73437dad7695725311b279c06b3dc57209d9a2211cfc305eafcacd7103ed110a933c7b3b524a5976b8eb55db24c6a256825a3c7c55adaccb76b2861e81
6
+ metadata.gz: 4cf217669485713bbb6da8f17f607cdf121a64d3bdc7f4ec4c4a36b4b4fa9b913ae14f407fdf524b0eb110e85d9be6b743d8e606a623178c4cc06a19d871d663
7
+ data.tar.gz: db83bb8efd1368fd8023d105fba6c8ba0e8f8c591e80ffc73a16e6251d7468937f0ab965cd1c561f681c2336ebd7e3cc69d33fb3107d07e03b8ab56c47d3bc99
data/.rubocop.yml CHANGED
@@ -128,6 +128,9 @@ RSpec/EmptyExampleGroup:
128
128
  RSpec/MultipleExpectations:
129
129
  Enabled: false
130
130
 
131
+ RSpec/MultipleMemoizedHelpers:
132
+ Max: 12
133
+
131
134
  Style/SymbolArray:
132
135
  EnforcedStyle: brackets
133
136
 
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirro-ruby-client (2.5.11)
4
+ cirro-ruby-client (2.5.13)
5
5
  activesupport
6
6
  faraday (< 1.2.0)
7
7
  faraday_middleware
@@ -44,7 +44,7 @@ GEM
44
44
  rack (>= 0.2)
45
45
  jwt (2.7.0)
46
46
  method_source (1.0.0)
47
- minitest (5.17.0)
47
+ minitest (5.18.0)
48
48
  multipart-post (2.3.0)
49
49
  parallel (1.19.2)
50
50
  parser (2.7.2.0)
@@ -53,7 +53,7 @@ GEM
53
53
  coderay (~> 1.1)
54
54
  method_source (~> 1.0)
55
55
  public_suffix (4.0.6)
56
- rack (3.0.4.1)
56
+ rack (3.0.7)
57
57
  rainbow (3.0.0)
58
58
  rake (12.3.3)
59
59
  regexp_parser (1.8.1)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # CirroIO::Client
1
+ # CirroIOV2::Client
2
2
 
3
- This gem provides access to the [Cirro REST API](https://staging.cirro.io/api-docs/v1#cirro-api-documentation).
3
+ This gem provides access to the [Cirro REST API v2](https://cirroapiv2.docs.apiary.io).
4
4
 
5
5
  [![CircleCI](https://circleci.com/gh/test-IO/cirro-ruby-client/tree/master.svg?style=svg&circle-token=a77e4eac5646768d681283763d2a29a55a221d7c)](https://circleci.com/gh/test-IO/cirro-ruby-client/tree/master)
6
6
 
@@ -20,59 +20,6 @@ Or install it yourself as:
20
20
 
21
21
  $ gem install cirro-ruby-client
22
22
 
23
-
24
- ## Configuration
25
-
26
- You need to create an initializer file in config/initializers.
27
-
28
- ```ruby
29
- CirroIO::Client.configure do |c|
30
- c.app_id 'WULnc6Y0rlaTBCSiHAb0kGWKFuIxPWBXJysyZeG3Rtw'
31
- c.private_key_path './storage/cirro.pem'
32
- c.site 'https://api.staging.cirro.io'
33
- end
34
- ```
35
-
36
-
37
- ## Development
38
-
39
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
40
-
41
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then wait for circle CI to complete, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
42
-
43
- ## License
44
-
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
- ```
58
-
59
- #### Creating Payouts for workers
60
-
61
- ```ruby
62
- app_worker = CirroIO::Client::AppWorker.load(id: 1234)
63
-
64
- CirroIO::Client::Payout.create(
65
- app_worker: app_worker,
66
- amount: 100, # € 1.00
67
- title: "Bonus for something",
68
- description: "Description of the bonus.",
69
- cost_center_key: "PROJECT-CODE",
70
- billing_date: DateTime.now
71
- )
72
- ```
73
-
74
- # CirroIOV2::Client
75
-
76
23
  ## Configuration
77
24
 
78
25
  ```ruby
@@ -99,26 +46,26 @@ user.worker
99
46
  # => { billable: false, document: {...} }
100
47
  ```
101
48
 
102
- ### Get notification preferences for a user
103
-
49
+ ### Create or update a worker document for a user
50
+ Will automatically create a worker account if not existing
104
51
  ```ruby
105
- preference = client.User.get_notification_preference(1)
106
- # => NotificationPreference object
52
+ user = client.User.worker(1, document: { foo: :bar })
53
+ # => User object
107
54
 
108
- preference.id
109
- # => '1'
55
+ user.worker.document
56
+ # => { foo: :bar }
57
+ ```
110
58
 
111
- preference.locale
112
- # => 'de'
59
+ ### Get notification preference of a user
113
60
 
114
- preference.topics
115
- # => Array of NotificationTopicPreference objects
61
+ ```ruby
62
+ client.User.notification_preference(1)
63
+ # => NotificationPreference object
116
64
  ```
117
-
118
- ### Update notification preferences for a user
65
+ ### Create or Update notification preferences for a user
119
66
 
120
67
  ```ruby
121
- client.User.update_notification_preference({
68
+ client.User.notification_preferences(1, {
122
69
  locale: 'de',
123
70
  topics: [
124
71
  { id: '1', preferences: { email: 'immediately' } },
@@ -165,11 +112,12 @@ client.Gig.create(
165
112
  url: "http://heathcote.co/zina.gibson",
166
113
  start_at: 1652285764,
167
114
  end_at: 1653412329,
168
- total_seats: 2,
115
+ seats_min: 2,
116
+ seats_max: 2,
169
117
  invitation_mode: "auto",
170
118
  filter_query: {
171
- status: "active",
172
- segment: "my_favorite_testers"
119
+ status: "active",
120
+ segment: "my_favorite_testers"
173
121
  },
174
122
  tasks: [
175
123
  { title: "Ah, Wilderness!", base_price: 300 }
@@ -186,9 +134,59 @@ client.Gig.create(
186
134
  # => Gig object
187
135
  ```
188
136
 
137
+ ### Update a gig
138
+ When your gig is already started, you can not update start_at anymore
139
+ ```ruby
140
+ gig_id = 1
141
+ client.Gig.update(gig_id,
142
+ title: "Favourite programming language?",
143
+ description: "Description of gig ...",
144
+ url: "http://heathcote.co/zina.gibson",
145
+ start_at: 1652285764,
146
+ end_at: 1653412329,
147
+ seats_min: 2,
148
+ seats_max: 2,
149
+ invitation_mode: "auto",
150
+ filter_query: {
151
+ status: "active",
152
+ segment: "my_favorite_testers"
153
+ },
154
+ notification_payload: {
155
+ project_title: "Corporate Tax",
156
+ task_title: "Add dataset",
157
+ task_type: "Review"
158
+ },
159
+ epam_options: {
160
+ extra_mile: true
161
+ }
162
+ )
163
+ # => Gig object
164
+ ```
165
+
166
+ ### Archive a gig
167
+
168
+ ```ruby
169
+ gig_id = 1
170
+
171
+ # archive now
172
+ client.Gig.archive(gig_id)
173
+
174
+ # archive later
175
+ client.Gig.archive(gig_id, archive_at: 1.day.from_now)
176
+ ```
177
+
178
+ ### Delete a gig
179
+
180
+ ```ruby
181
+ gig_id = 1
182
+
183
+ client.Gig.delete(gig_id)
184
+ ```
185
+
189
186
  ### Manually invite user to a gig
190
187
 
191
188
  ##### Invite single user
189
+
192
190
  ```ruby
193
191
  gig_id = 1
194
192
  app_user_id = 1
@@ -198,6 +196,7 @@ client.Gig.invite(gig_id, { user_id: app_user_id })
198
196
  ```
199
197
 
200
198
  ##### Invite multiple users and overwrite no_reward
199
+
201
200
  ```ruby
202
201
  gig_id = 1
203
202
  users = [{ id: 1, no_reward: true }, { id: 2, no_reward: true }]
@@ -206,6 +205,26 @@ client.Gig.invite(gig_id, { users: users })
206
205
  # => GigInvitationList object
207
206
  ```
208
207
 
208
+ ### GigTask
209
+ #### Add a new gig task to gig
210
+
211
+ ```ruby
212
+ gig_id = 1
213
+
214
+ client.Gig.tasks(gig_id, { title: "Critical Bug", base_price: 100 })
215
+ # => GigTask object
216
+ ```
217
+
218
+ #### Update a gig task
219
+
220
+ ```ruby
221
+ gig_id = 1
222
+ gig_task_id = 1
223
+
224
+ client.Gig.update_task(gig_id, gig_task_id, { base_price: 100 })
225
+ # => GigTask object
226
+ ```
227
+
209
228
  ## GigInvitation
210
229
  ### Get list of gig invitations
211
230
 
@@ -243,8 +262,143 @@ list.data
243
262
 
244
263
  ```ruby
245
264
  client.GigInvitation.accept(1)
265
+
266
+ # overwrite no_reward
267
+ client.GigInvitation.accept(1, no_reward: true)
268
+
269
+ ```
270
+
271
+ ### Reject a gig invitation
272
+
273
+ ```ruby
274
+ client.GigInvitation.reject(1)
275
+ ```
276
+
277
+ ### Expire a gig invitation
278
+
279
+ ```ruby
280
+ client.GigInvitation.expire(1)
281
+ ```
282
+
283
+ ### Reset an accepted or expired gig invitation
284
+
285
+ ```ruby
286
+ client.GigInvitation.reset(1)
287
+
288
+ # prevent reset notification
289
+ client.GigInvitation.reset(1, silent: true)
246
290
  ```
247
291
 
292
+ ## GigTimeActivity
293
+ ### List all gig time activities
294
+
295
+ ```ruby
296
+ list = client.GigTimeActivity.list
297
+ # => ListObject
298
+
299
+ list.has_more?
300
+ # => true
301
+
302
+ list.data
303
+ # => Array of GigTimeActivity objects
304
+
305
+ # filters
306
+ client.GigTimeActivity.list(gig_id: 1, user_id: 1)
307
+
308
+ # pagination
309
+ client.GigTimeActivity.list(limit: 100, after: 100)
310
+ ```
311
+
312
+ ### Create a gig time activity
313
+ You can't create gig time activity if the given user is not in your space or for the given user the gig invitation is set to no_reward
314
+
315
+ ```ruby
316
+ client.GigTimeActivity.create(
317
+ gig_id: 1,
318
+ user_id: 1,
319
+ date: "2023-04-10",
320
+ description: "Time Report for Space XYZ",
321
+ duration_in_ms: 1.hour.in_seconds * 1000 # make sure not to report > 8h per day
322
+ )
323
+ ```
324
+
325
+ ## GigResult
326
+ ### List all gig results
327
+
328
+ ```ruby
329
+ list = client.GigResult.list
330
+ # => ListObject
331
+
332
+ list.has_more?
333
+ # => true
334
+
335
+ list.data
336
+ # => Array of GigResult objects
337
+
338
+ # filters
339
+ client.GigResult.list(gig_id: 1, user_id: 1)
340
+
341
+ # pagination
342
+ client.GigResult.list(limit: 100, after: 100)
343
+ ```
344
+
345
+ ### Create a gig result
346
+ You can't create gig result if the given user is not in your space or for the given user the gig invitation is set to no_reward
347
+
348
+ ```ruby
349
+ client.GigResult.create(
350
+ gig_task_id: 1,
351
+ user_id: 1,
352
+ title: "Work for task1",
353
+ escription: "Good work for task1",
354
+ quantity: 2,
355
+ multiplier: 1.2,
356
+ delivery_date: "2023-04-10",
357
+ cost_center_key: "EPMTIO"
358
+ )
359
+ ```
360
+
361
+ ## BonusPayout
362
+ ### List all payouts
363
+
364
+ ```ruby
365
+ list = client.Payout.list
366
+ # => ListObject
367
+
368
+ list.has_more?
369
+ # => true
370
+
371
+ list.data
372
+ # => Array of Payout objects
373
+
374
+ # filters
375
+ client.Payout.list(reference_id: 1, reference_type: 'Gig', user_id: 1)
376
+
377
+ # pagination
378
+ client.Payout.list(limit: 100, after: 100)
379
+ ```
380
+
381
+ ### Create a bonus payout
382
+
383
+ ```ruby
384
+ client.Payout.create(
385
+ user_id: 1,
386
+ title: "Bonus Payment",
387
+ description: "Good work!",
388
+ amount: 1000,
389
+ billing_date: "2023-04-10",
390
+ cost_center_key: "EPMTIO"
391
+ )
392
+ ```
393
+
394
+ ### Delete a bonus payout
395
+ Only allowed for unbilled ones
396
+
397
+ ```ruby
398
+ client.Payout.delete(1)
399
+ ```
400
+
401
+ # Notifications
248
402
  ## Notification Locale
249
403
  ### Create a notification locale
250
404
 
@@ -293,6 +447,21 @@ client.NotificationConfiguration.list(limit: 100, after: 100) # pagination
293
447
  ```
294
448
 
295
449
  ## Notification Layout
450
+ ### List all notification layouts
451
+
452
+ ```ruby
453
+ list = client.NotificationLayout.list
454
+ # => ListObject
455
+
456
+ list.has_more?
457
+ # => true
458
+
459
+ list.data
460
+ # => Array of NotificationLayout objects
461
+
462
+ client.NotificationLayout.list(limit: 100, after: 100) # pagination
463
+ ```
464
+
296
465
  ### Create a notification layout
297
466
 
298
467
  ```ruby
@@ -380,6 +549,30 @@ client.NotificationTopic.create(
380
549
  )
381
550
  ```
382
551
 
552
+ ### Find a notification topic
553
+
554
+ ```ruby
555
+ client.NotificationTopic.find(1)
556
+ # => NotificationTopic object
557
+ ```
558
+
559
+ ### Update a notification topic
560
+
561
+ ```ruby
562
+ client.NotificationTopic.update(1, { name: "NewTopicName", preferences: { email: "daily" } })
563
+ # => NotificationTopic object
564
+ ```
565
+
566
+ ### Delete a notification topic
567
+
568
+ ```ruby
569
+ topic = client.NotificationTopic.delete(1)
570
+ # => NotificationTopicDelete object
571
+
572
+ topic.deleted
573
+ # => true
574
+ ```
575
+
383
576
  ## Notification (Topic) Template
384
577
  ### List all
385
578
 
@@ -416,8 +609,9 @@ client.NotificationTemplate.update(
416
609
  ### Delete a notification template
417
610
 
418
611
  ```ruby
419
- client.NotificationTemplate.delete('1')
612
+ client.NotificationTemplate.delete(1)
420
613
  ```
614
+
421
615
  ## Notifcation Topic Preference
422
616
  ### List all
423
617
 
@@ -456,3 +650,56 @@ client.NotificationBroadcast.create(
456
650
  notification_topic_id: 1
457
651
  )
458
652
  ```
653
+
654
+ # CirroIO::Client (DEPRECATED)
655
+
656
+ ## Configuration
657
+
658
+ You need to create an initializer file in config/initializers.
659
+
660
+ ```ruby
661
+ CirroIO::Client.configure do |c|
662
+ c.app_id 'WULnc6Y0rlaTBCSiHAb0kGWKFuIxPWBXJysyZeG3Rtw'
663
+ c.private_key_path './storage/cirro.pem'
664
+ c.site 'https://api.staging.cirro.io'
665
+ end
666
+ ```
667
+
668
+
669
+
670
+ ## Usage
671
+
672
+ #### Bulk create gig invitations
673
+
674
+ ```ruby
675
+ gig = CirroIO::Client::Gig.load(id: 1)
676
+ filter = CirroIO::Client::WorkerFilter.new(filter_query: '{ "app_worker_id": { "$in": [1,2,3] } }')
677
+ invitation = CirroIO::Client::GigInvitation.new(gig: gig)
678
+
679
+ invitation.bulk_create_with(filter, auto_accept: true) # by default auto_accept is false
680
+ ```
681
+
682
+ #### Creating Payouts for workers
683
+
684
+ ```ruby
685
+ app_worker = CirroIO::Client::AppWorker.load(id: 1234)
686
+
687
+ CirroIO::Client::Payout.create(
688
+ app_worker: app_worker,
689
+ amount: 100, # € 1.00
690
+ title: "Bonus for something",
691
+ description: "Description of the bonus.",
692
+ cost_center_key: "PROJECT-CODE",
693
+ billing_date: DateTime.now
694
+ )
695
+ ```
696
+
697
+ # Development
698
+
699
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
700
+
701
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then wait for circle CI to complete, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
702
+
703
+ # License
704
+
705
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -1,7 +1,7 @@
1
1
  # rubocop:disable Style/MutableConstant
2
2
  module CirroIO
3
3
  module Client
4
- VERSION = '2.5.11'
4
+ VERSION = '2.5.13'
5
5
  end
6
6
  end
7
7
  # rubocop:enable Style/MutableConstant
@@ -24,6 +24,11 @@ module CirroIOV2
24
24
  response = client.request_client.request(:post, resource_root, body: params)
25
25
  Responses::NotificationTopicResponse.new(response.body)
26
26
  end
27
+
28
+ def delete(id)
29
+ response = client.request_client.request(:delete, "#{resource_root}/#{id}")
30
+ Responses::NotificationTopicDeleteResponse.new(response.body)
31
+ end
27
32
  end
28
33
  end
29
34
  end
@@ -10,6 +10,11 @@ module CirroIOV2
10
10
  response = client.request_client.request(:post, resource_root, body: params)
11
11
  Responses::PayoutResponse.new(response.body)
12
12
  end
13
+
14
+ def delete(id)
15
+ response = client.request_client.request(:delete, "#{resource_root}/#{id}")
16
+ Responses::PayoutDeleteResponse.new(response.body)
17
+ end
13
18
  end
14
19
  end
15
20
  end
@@ -11,6 +11,11 @@ module CirroIOV2
11
11
  CirroIOV2::Responses::UserResponse.new(response.body)
12
12
  end
13
13
 
14
+ def notification_preference(id)
15
+ response = client.request_client.request(:get, "#{resource_root}/#{id}/notification_preference")
16
+ CirroIOV2::Responses::UserNotificationPreferenceResponse.new(response.body)
17
+ end
18
+
14
19
  def notification_preferences(id, params)
15
20
  response = client.request_client.request(:post, "#{resource_root}/#{id}/notification_preferences", body: params)
16
21
  CirroIOV2::Responses::UserNotificationPreferenceResponse.new(response.body)
@@ -3,29 +3,22 @@ module CirroIOV2
3
3
  module Base
4
4
  def initialize(body)
5
5
  body = body.deep_symbolize_keys
6
+
6
7
  if body[:object] == 'list'
7
8
  list_item_class = self.class.name.gsub('List', '').constantize
8
- values_hash = body.slice(*members.excluding(:data)).merge(
9
- data: body[:data].map { |list_item| list_item_class.new(list_item) },
10
- )
11
- super(*members.map { |attr| values_hash[attr] })
12
- elsif list_attribute(body)
13
- values_hash = body.slice(*members.excluding(list_attribute(body))).merge(
14
- list_attribute(body) => create_sub_resource(list_attribute(body), body[list_attribute(body)]),
15
- )
16
- super(*body.slice(*members).keys.map { |attr| values_hash[attr] })
17
- else
18
- super(*body.slice(*members).values)
9
+ body[:data] = body[:data].map { |list_item| list_item_class.new(list_item) }
19
10
  end
20
- end
21
11
 
22
- def list_attribute(data)
23
- data.keys.find { |key| data[key].is_a?(Hash) && data[key][:object] == 'list' }
24
- end
12
+ if self.class.const_defined?('NESTED_RESPONSES')
13
+ self.class::NESTED_RESPONSES.each do |attribute_name, class_name|
14
+ next unless members.include?(attribute_name)
15
+ next unless body[attribute_name]
16
+
17
+ body[attribute_name] = "CirroIOV2::Responses::#{class_name}".constantize.new(body[attribute_name])
18
+ end
19
+ end
25
20
 
26
- def create_sub_resource(resource_name, body)
27
- sub_resource_class = "CirroIOV2::Responses::#{self.class::NESTED_RESPONSES[resource_name]}".constantize
28
- sub_resource_class.new(body)
21
+ super(**body.slice(*members))
29
22
  end
30
23
  end
31
24
  end
@@ -15,16 +15,43 @@ module CirroIOV2
15
15
  :NotificationTemplateListResponse,
16
16
  ].freeze
17
17
 
18
- UserResponse = Struct.new(:id, :object, :first_name, :last_name, :time_zone, :birthday, :country_code, :epam, :worker, :anonymous_email) do
18
+ DELETE_RESPONSES = [
19
+ :GigDeleteResponse,
20
+ :PayoutDeleteResponse,
21
+ :NotificationTemplateDeleteResponse,
22
+ :NotificationLayoutTemplateDeleteResponse,
23
+ :NotificationTopicDeleteResponse,
24
+ ].freeze
25
+
26
+ UserResponse = Struct.new(:id,
27
+ :object,
28
+ :first_name,
29
+ :last_name,
30
+ :time_zone,
31
+ :birthday,
32
+ :country_code,
33
+ :epam,
34
+ :worker,
35
+ :anonymous_email,
36
+ keyword_init: true) do
19
37
  include Base
20
38
  end
21
39
 
22
- UserNotificationPreferenceResponse = Struct.new(:id, :object, :locale, :topics) do
40
+ UserNotificationPreferenceResponse = Struct.new(:id, :object, :locale, :topics, keyword_init: true) do
23
41
  self::NESTED_RESPONSES = { topics: :NotificationTopicPreferenceListResponse }.freeze
24
42
  include Base
25
43
  end
26
44
 
27
- SpaceInvitationResponse = Struct.new(:id, :object, :token, :subject, :email, :name, :inviter_name, :skip_background_check, :expires_at) do
45
+ SpaceInvitationResponse = Struct.new(:id,
46
+ :object,
47
+ :token,
48
+ :subject,
49
+ :email,
50
+ :name,
51
+ :inviter_name,
52
+ :skip_background_check,
53
+ :expires_at,
54
+ keyword_init: true) do
28
55
  include Base
29
56
  end
30
57
 
@@ -43,24 +70,21 @@ module CirroIOV2
43
70
  :filter_query,
44
71
  :tasks,
45
72
  :notification_payload,
46
- :epam_options) do
73
+ :epam_options,
74
+ keyword_init: true) do
47
75
  self::NESTED_RESPONSES = { tasks: :GigTaskListResponse }.freeze
48
76
  include Base
49
77
  end
50
78
 
51
- GigDeleteResponse = Struct.new(:id, :object, :deleted) do
79
+ GigTaskResponse = Struct.new(:id, :object, :title, :base_price, keyword_init: true) do
52
80
  include Base
53
81
  end
54
82
 
55
- GigTaskResponse = Struct.new(:id, :object, :title, :base_price) do
83
+ GigInvitationResponse = Struct.new(:id, :object, :status, :gig_id, :user_id, :no_reward, :epam_bench_status, keyword_init: true) do
56
84
  include Base
57
85
  end
58
86
 
59
- GigInvitationResponse = Struct.new(:id, :object, :status, :gig_id, :user_id, :no_reward) do
60
- include Base
61
- end
62
-
63
- GigTimeActivityResponse = Struct.new(:id, :object, :gig_id, :user_id, :description, :duration_in_ms, :date) do
87
+ GigTimeActivityResponse = Struct.new(:id, :object, :gig_id, :user_id, :description, :duration_in_ms, :date, keyword_init: true) do
64
88
  include Base
65
89
  end
66
90
 
@@ -74,7 +98,8 @@ module CirroIOV2
74
98
  :multiplier,
75
99
  :delivery_date,
76
100
  :cost_center_key,
77
- :cost_center_data) do
101
+ :cost_center_data,
102
+ keyword_init: true) do
78
103
  include Base
79
104
  end
80
105
 
@@ -88,63 +113,61 @@ module CirroIOV2
88
113
  :reference_type,
89
114
  :user_id,
90
115
  :cost_center_key,
91
- :cost_center_data) do
116
+ :cost_center_data,
117
+ keyword_init: true) do
92
118
  include Base
93
119
  end
94
120
 
95
- NotificationTopicPreferenceResponse = Struct.new(:id, :object, :preferences, :notification_topic_id, :user_id) do
121
+ NotificationTopicPreferenceResponse = Struct.new(:id, :object, :preferences, :notification_topic_id, :user_id, keyword_init: true) do
96
122
  include Base
97
123
  end
98
124
 
99
- NotificationLocaleResponse = Struct.new(:id, :object, :locale, :default, :configurations) do
125
+ NotificationLocaleResponse = Struct.new(:id, :object, :locale, :default, :configurations, keyword_init: true) do
100
126
  self::NESTED_RESPONSES = { configurations: :NotificationConfigurationListResponse }.freeze
101
127
  include Base
102
128
  end
103
129
 
104
- NotificationConfigurationResponse = Struct.new(:id, :object, :deliver_by, :format, :kind, :locale) do
130
+ NotificationConfigurationResponse = Struct.new(:id, :object, :deliver_by, :format, :kind, :locale, keyword_init: true) do
105
131
  include Base
106
132
  end
107
133
 
108
- NotificationLayoutResponse = Struct.new(:id, :object, :name, :templates) do
134
+ NotificationLayoutResponse = Struct.new(:id, :object, :name, :templates, keyword_init: true) do
109
135
  self::NESTED_RESPONSES = { templates: :NotificationLayoutTemplateListResponse }.freeze
110
136
  include Base
111
137
  end
112
138
 
113
- NotificationLayoutTemplateResponse = Struct.new(:id, :notification_configuration_id, :notification_layout_id, :body) do
139
+ NotificationLayoutTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_layout_id, :body, keyword_init: true) do
114
140
  include Base
115
141
  end
116
142
 
117
- NotificationLayoutTemplateDeleteResponse = Struct.new(:id, :object, :deleted) do
118
- include Base
119
- end
120
-
121
- NotificationTopicResponse = Struct.new(:id, :object, :name, :notification_layout_id, :preferences, :templates) do
143
+ NotificationTopicResponse = Struct.new(:id, :object, :name, :notification_layout_id, :preferences, :templates, keyword_init: true) do
122
144
  self::NESTED_RESPONSES = { templates: :NotificationTemplateListResponse }.freeze
123
145
  include Base
124
146
  end
125
147
 
126
- NotificationTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_topic_id, :subject, :body) do
127
- include Base
128
- end
129
-
130
- NotificationTemplateDeleteResponse = Struct.new(:id, :object, :deleted) do
148
+ NotificationTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_topic_id, :subject, :body, keyword_init: true) do
131
149
  include Base
132
150
  end
133
151
 
134
- NotificationBroadcastResponse = Struct.new(:id, :object, :payload, :recipients, :notification_topic_id) do
152
+ NotificationBroadcastResponse = Struct.new(:id, :object, :payload, :recipients, :notification_topic_id, keyword_init: true) do
135
153
  include Base
136
154
  end
137
155
 
138
- EpamHeroesBadgeResponse = Struct.new(:content, :refs, :paging, :hasMoreResults) do
156
+ EpamHeroesBadgeResponse = Struct.new(:content, :refs, :paging, :hasMoreResults, keyword_init: true) do
139
157
  include Base
140
158
  end
141
159
 
142
- # cover the list responses
160
+ # cover the list and delete responses
143
161
  def self.const_missing(name)
144
162
  return const_get(name) if const_defined? name
145
- return unless LIST_RESPONSES.include? name
146
163
 
147
- klass = Class.new(Struct.new(:object, :url, :has_more, :data)) { include Base }
164
+ struct = nil
165
+ struct = Struct.new(:object, :url, :has_more, :data, keyword_init: true) if LIST_RESPONSES.include?(name)
166
+ struct = Struct.new(:id, :object, :deleted, keyword_init: true) if DELETE_RESPONSES.include?(name)
167
+
168
+ return unless struct.present?
169
+
170
+ klass = Class.new(struct) { include Base }
148
171
  const_set(name, klass)
149
172
  end
150
173
  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: 2.5.11
4
+ version: 2.5.13
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: 2023-02-27 00:00:00.000000000 Z
11
+ date: 2023-04-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport