cirro-ruby-client 1.6.1 → 2.0.1

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: e6890f4b343eb4c3efc64fe9f75c644c7d706e9c19bae033d367e4aa0fd99987
4
- data.tar.gz: a84440266927041fc001db93c57c44bcf65ef0a2d16b87b2ccc443e1af041564
3
+ metadata.gz: 76097208caab26d55fe43bc4ca78e868d65c7fbd0aa0ab172cf76fbe51b769dc
4
+ data.tar.gz: 4e5db26e12fc65b9a8bb0da9a75ce846d9d8f5a0054f8cca47fe2ded2830a458
5
5
  SHA512:
6
- metadata.gz: 6ed00bfa6f1d74f95338c6537b8da72754c6c48ecf8d93078891120f8f7be94fba74b0f929646594da35d79583aea4ff6f15ff31ac096dee6663037ebd953640
7
- data.tar.gz: 1348492e075def7497a2734e170a3f8453fd1ef150b5473dc515e6dbcc0ede4c4612e0cf58edce08cdc65e293f31f7bf4f5e1a46f65155285a9f8514f77c0339
6
+ metadata.gz: c7af16a9900b76331bc9c248f8b22ca38f6e34b8affc1cbf54cf8d60eed55b915315b84e09bf654bc82b0a15ceb79cefbba8d88b3f1901739d87a57a0f000df8
7
+ data.tar.gz: 2299039507bef30f4bc613faf0107f2dec238c113903b92213f9f248d84ef276c6c4e5b31484c3b3839249de308afdabcb8e9ed8ffbfb173e03bc314aaaa31c8
data/.circleci/config.yml CHANGED
@@ -1,9 +1,18 @@
1
1
  version: 2.1
2
+ infra_container: &infra_container
3
+ eu.gcr.io/cirro-io/swissknife@sha256:1dceb221bfc058c4ba22fe4dcbf4f30dfdc10951bc2293d5c53aebc4f87037f3
4
+
5
+ # Configure authentication in private registry
6
+ infra_container_registry_auth:
7
+ &infra_container_registry_auth
8
+ auth:
9
+ username: _json_key # default username when using a JSON key file to authenticate
10
+ password: $GOOGLE_JSON_KEY
2
11
 
3
12
  jobs:
4
- build:
13
+ test:
5
14
  docker:
6
- - image: circleci/ruby:2.7.1-node
15
+ - image: cimg/ruby:2.7.1-node
7
16
  environment:
8
17
  - RAILS_ENV=test
9
18
  - RACK_ENV=test
@@ -25,9 +34,10 @@ jobs:
25
34
  - run:
26
35
  name: Check code style
27
36
  command: bundle exec rubocop
37
+
28
38
  deploy:
29
39
  docker:
30
- - image: circleci/ruby:2.7.1-node
40
+ - image: cimg/ruby:2.7.1-node
31
41
  steps:
32
42
  - checkout
33
43
  - run:
@@ -56,14 +66,76 @@ jobs:
56
66
  gem push cirro-ruby-client-$version.gem
57
67
  shred -u ~/.gem/credentials
58
68
 
69
+ defectdojo:
70
+ docker:
71
+ - image: *infra_container
72
+ <<: *infra_container_registry_auth
73
+ environment:
74
+ - DEFECTDOJO_URL: defectdojo.testcloud.io
75
+ - DEFECTDOJO_PRODUCT: Cirro Ruby Client
76
+ - DEFECTDOJO_ENG_NAME: CircleCI Scan
77
+ steps:
78
+ - checkout
79
+ - run:
80
+ name: Setup access to GCP
81
+ command: |
82
+ echo $GOOGLE_JSON_KEY > ${HOME}/gcloud-service-key.json && \
83
+ gcloud auth activate-service-account --key-file=${HOME}/gcloud-service-key.json
84
+ gcloud auth configure-docker
85
+ - run:
86
+ name: Scans
87
+ command: |
88
+ unset GITHUB_TOKEN && trivy fs --exit-code 0 --no-progress --ignorefile .trivyignore-fake --format json --output filesystem-scan.json .
89
+ gitleaks detect --no-git --exit-code 0 --report-format json --report-path gitleaks.json
90
+ - run:
91
+ name: Send data to DefectDojo
92
+ command: |
93
+ export DEFECTDOJO_TOKEN=$(gcloud secrets versions access latest \
94
+ --secret="defectdojo_token" \
95
+ --project=cirro-io \
96
+ --quiet)
97
+
98
+ # Send Trivy filesystem scan
99
+ curl --fail --request POST https://$DEFECTDOJO_URL/api/v2/reimport-scan/ \
100
+ --header "Authorization: Token $DEFECTDOJO_TOKEN" \
101
+ --form "active=true" \
102
+ --form "auto_create_context=true" \
103
+ --form "branch_tag=${CIRCLE_BRANCH}" \
104
+ --form "commit_hash=${CIRCLE_SHA1}" \
105
+ --form "close_old_findings=true" \
106
+ --form "scan_type=Trivy Scan" \
107
+ --form "test_title=Trivy application scan" \
108
+ --form "engagement_name=${DEFECTDOJO_ENG_NAME}" \
109
+ --form "product_name=${DEFECTDOJO_PRODUCT}" \
110
+ --form "file=@filesystem-scan.json"
111
+
112
+ # Send Gitleaks scan
113
+ curl --fail --request POST https://$DEFECTDOJO_URL/api/v2/reimport-scan/ \
114
+ --header "Authorization: Token $DEFECTDOJO_TOKEN" \
115
+ --form "active=true" \
116
+ --form "auto_create_context=true" \
117
+ --form "branch_tag=${CIRCLE_BRANCH}" \
118
+ --form "commit_hash=${CIRCLE_SHA1}" \
119
+ --form "close_old_findings=true" \
120
+ --form "scan_type=Gitleaks Scan" \
121
+ --form "test_title=Gitleaks Scan" \
122
+ --form "engagement_name=${DEFECTDOJO_ENG_NAME}" \
123
+ --form "product_name=${DEFECTDOJO_PRODUCT}" \
124
+ --form "file=@gitleaks.json"
125
+
59
126
  workflows:
60
127
  version: 2
61
128
  deploy_the_gem:
62
129
  jobs:
63
- - build
130
+ - test
64
131
  - deploy:
65
132
  requires:
66
- - build
133
+ - test
134
+ filters:
135
+ branches:
136
+ only:
137
+ - master
138
+ - defectdojo:
67
139
  filters:
68
140
  branches:
69
141
  only:
data/.gitignore CHANGED
@@ -6,6 +6,11 @@
6
6
  /pkg/
7
7
  /spec/reports/
8
8
  /tmp/
9
+ .idea/
9
10
 
10
11
  # rspec failure tracking
11
12
  .rspec_status
13
+
14
+ # vim artifacts
15
+ **.swp
16
+ **.swo
data/.rubocop.yml CHANGED
@@ -10,18 +10,26 @@ AllCops:
10
10
  - 'vendor/**/*'
11
11
  - 'spec/fixtures/**/*'
12
12
 
13
- Metrics/MethodLength:
14
- Max: 25
13
+ Metrics/AbcSize:
14
+ Enabled: false
15
+
16
+ Metrics/ClassLength:
17
+ Enabled: false
18
+
19
+ Metrics/CyclomaticComplexity:
20
+ Enabled: false
15
21
 
16
22
  Layout/LineLength:
17
23
  Max: 160
18
24
 
19
- # Details:
20
- # http://c2.com/cgi/wiki?AbcMetric
21
- Metrics/AbcSize:
22
- # The ABC size is a calculated magnitude, so this number can be a Fixnum or
23
- # a Float.
24
- Max: 20
25
+ Metrics/ModuleLength:
26
+ Enabled: false
27
+
28
+ Metrics/MethodLength:
29
+ Enabled: false
30
+
31
+ Metrics/PerceivedComplexity:
32
+ Enabled: false
25
33
 
26
34
  Style/StringLiterals:
27
35
  EnforcedStyle: single_quotes
@@ -35,9 +43,6 @@ Style/NumericLiterals:
35
43
  Style/SignalException:
36
44
  EnforcedStyle: only_raise
37
45
 
38
- Metrics/ClassLength:
39
- Max: 120
40
-
41
46
  # TODO: enable this when Ruby 3.0 is out.
42
47
  Style/FrozenStringLiteralComment:
43
48
  Enabled: false
@@ -107,6 +112,9 @@ Style/HashTransformValues:
107
112
  RSpec/FilePath:
108
113
  Enabled: true
109
114
  IgnoreMethods: true
115
+ Exclude:
116
+ - "spec/cirro_io_v2/**/*_spec.rb"
117
+
110
118
 
111
119
  Style/Documentation:
112
120
  Enabled: false
@@ -114,5 +122,14 @@ Style/Documentation:
114
122
  RSpec/ExampleLength:
115
123
  Enabled: false
116
124
 
125
+ RSpec/EmptyExampleGroup:
126
+ Enabled: false
127
+
117
128
  RSpec/MultipleExpectations:
118
129
  Enabled: false
130
+
131
+ Style/SymbolArray:
132
+ EnforcedStyle: brackets
133
+
134
+ Style/WordArray:
135
+ EnforcedStyle: brackets
data/CODE_OF_CONDUCT.md CHANGED
@@ -55,7 +55,7 @@ further defined and clarified by project maintainers.
55
55
  ## Enforcement
56
56
 
57
57
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at singhinther@gmail.com. All
58
+ reported by contacting the project team at devs@test.io. All
59
59
  complaints will be reviewed and investigated and will result in a response that
60
60
  is deemed necessary and appropriate to the circumstances. The project team is
61
61
  obligated to maintain confidentiality with regard to the reporter of an incident.
data/Gemfile.lock CHANGED
@@ -1,7 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cirro-ruby-client (1.6.1)
4
+ cirro-ruby-client (2.0.1)
5
+ activesupport
5
6
  faraday (< 1.2.0)
6
7
  faraday_middleware
7
8
  json_api_client (>= 1.10.0)
@@ -10,19 +11,19 @@ PATH
10
11
  GEM
11
12
  remote: https://rubygems.org/
12
13
  specs:
13
- activemodel (6.1.3.2)
14
- activesupport (= 6.1.3.2)
15
- activesupport (6.1.3.2)
14
+ activemodel (6.1.5)
15
+ activesupport (= 6.1.5)
16
+ activesupport (6.1.5)
16
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
17
18
  i18n (>= 1.6, < 2)
18
19
  minitest (>= 5.1)
19
20
  tzinfo (~> 2.0)
20
21
  zeitwerk (~> 2.3)
21
- addressable (2.7.0)
22
+ addressable (2.8.0)
22
23
  public_suffix (>= 2.0.2, < 5.0)
23
24
  ast (2.4.1)
24
25
  coderay (1.1.3)
25
- concurrent-ruby (1.1.7)
26
+ concurrent-ruby (1.1.10)
26
27
  crack (0.4.4)
27
28
  diff-lcs (1.4.4)
28
29
  faker (2.14.0)
@@ -30,21 +31,21 @@ GEM
30
31
  faraday (1.1.0)
31
32
  multipart-post (>= 1.2, < 3)
32
33
  ruby2_keywords
33
- faraday_middleware (1.0.0)
34
+ faraday_middleware (1.2.0)
34
35
  faraday (~> 1.0)
35
36
  hashdiff (1.0.1)
36
- i18n (1.8.5)
37
+ i18n (1.10.0)
37
38
  concurrent-ruby (~> 1.0)
38
- json_api_client (1.18.0)
39
+ json_api_client (1.21.0)
39
40
  activemodel (>= 3.2.0)
40
41
  activesupport (>= 3.2.0)
41
42
  addressable (~> 2.2)
42
- faraday (>= 0.15.2, < 1.2.0)
43
- faraday_middleware (>= 0.9.0, < 1.2.0)
43
+ faraday (>= 0.15.2, < 2.0)
44
+ faraday_middleware (>= 0.9.0, < 2.0)
44
45
  rack (>= 0.2)
45
- jwt (2.2.3)
46
+ jwt (2.3.0)
46
47
  method_source (1.0.0)
47
- minitest (5.14.4)
48
+ minitest (5.15.0)
48
49
  multipart-post (2.1.1)
49
50
  parallel (1.19.2)
50
51
  parser (2.7.2.0)
@@ -85,7 +86,7 @@ GEM
85
86
  rubocop-rspec (1.43.2)
86
87
  rubocop (~> 0.87)
87
88
  ruby-progressbar (1.10.1)
88
- ruby2_keywords (0.0.4)
89
+ ruby2_keywords (0.0.5)
89
90
  tzinfo (2.0.4)
90
91
  concurrent-ruby (~> 1.0)
91
92
  unicode-display_width (1.7.0)
@@ -93,7 +94,7 @@ GEM
93
94
  addressable (>= 2.3.6)
94
95
  crack (>= 0.3.2)
95
96
  hashdiff (>= 0.4.0, < 2.0.0)
96
- zeitwerk (2.4.2)
97
+ zeitwerk (2.5.4)
97
98
 
98
99
  PLATFORMS
99
100
  ruby
@@ -109,4 +110,4 @@ DEPENDENCIES
109
110
  webmock
110
111
 
111
112
  BUNDLED WITH
112
- 2.1.4
113
+ 2.3.4
data/README.md CHANGED
@@ -55,3 +55,356 @@ invitation = CirroIO::Client::GigInvitation.new(gig: gig)
55
55
 
56
56
  invitation.bulk_create_with(filter, auto_accept: true) # by default auto_accept is false
57
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
+ ## Configuration
77
+
78
+ ```ruby
79
+ # with key path
80
+ client = CirroIOV2::Client.new(private_key_path: "./storage/cirro_key.pem", client_id: "WULnc6Y0rlaTBCSiHAb0kGWKFuIxPWBXJysyZeG3Rtw", site: "https://api.staging.cirro.io")
81
+
82
+ # with key string
83
+ client = CirroIOV2::Client.new(private_key: Rails.application.credentials.cirro_private_key, client_id: "WULnc6Y0rlaTBCSiHAb0kGWKFuIxPWBXJysyZeG3Rtw", site: "https://api.staging.cirro.io")
84
+ ```
85
+
86
+ # Usage
87
+
88
+ ## User
89
+ ### Get user info
90
+
91
+ ```ruby
92
+ user = client.User.find(1)
93
+ # => User object
94
+
95
+ user.first_name
96
+ # => 'Grazyna'
97
+
98
+ user.worker
99
+ # => { billable: false, document: {...} }
100
+ ```
101
+
102
+ ### Get notification preferences for a user
103
+
104
+ ```ruby
105
+ preference = client.User.get_notification_preference(1)
106
+ # => NotificationPreference object
107
+
108
+ preference.id
109
+ # => '1'
110
+
111
+ preference.locale
112
+ # => 'de'
113
+
114
+ preference.channels
115
+ # => Array of NotificationTopicPreference objects
116
+ ```
117
+
118
+ ### Update notification preferences for a user
119
+
120
+ ```ruby
121
+ client.User.update_notification_preference({
122
+ locale: 'de',
123
+ channels: [
124
+ { id: '1', preferences: { email: 'immediately' } },
125
+ { id: '2', preferences: { email: 'digest_daily' } }
126
+ ]
127
+ })
128
+ ```
129
+
130
+ ## Gig
131
+ ### Create a gig
132
+
133
+ ```ruby
134
+ client.Gig.create(
135
+ title: "Favourite programming language?",
136
+ description: "Description of gig ...",
137
+ url: "http://heathcote.co/zina.gibson",
138
+ start_at: 1652285764,
139
+ end_at: 1653412329,
140
+ total_seats: 2,
141
+ invitation_mode: "auto",
142
+ filter_query: {
143
+ status: "active",
144
+ segment: "my_favorite_testers"
145
+ },
146
+ tasks: [
147
+ { title: "Ah, Wilderness!", base_price: 300 }
148
+ ],
149
+ notification_payload: {
150
+ project_title: "Corporate Tax",
151
+ task_title: "Add dataset",
152
+ task_type: "Review"
153
+ },
154
+ epam_options: {
155
+ extra_mile: true
156
+ }
157
+ )
158
+ # => Gig object
159
+ ```
160
+
161
+ ## GigInvitation
162
+ ### Get list of gig invitations
163
+
164
+ By default the response is paginated with 10 per page. The `has_more` attribute indicates whether there're more records to be fetched or not.
165
+ You can move from page to page using `after` or `before`.
166
+
167
+ ```ruby
168
+ # return all with max limit
169
+ client.GigInvitation.list(limit: 100)
170
+
171
+ # return paginated after gig invitation ID 100
172
+ client.GigInvitation.list(limit: 100, after: 100)
173
+
174
+ # return paginated before gig invitation ID 100
175
+ client.GigInvitation.list(limit: 100, before: 100)
176
+
177
+ # filter by user with ID 1 and gig with ID 1
178
+ client.GigInvitation.list(user_id: 1, gig_id: 1)
179
+
180
+ # filter by status
181
+ client.GigInvitation.list(status: ['pending', 'accepted'])
182
+ client.GigInvitation.list(status: 'accepted')
183
+
184
+ list = client.GigInvitation.list(limit: 100)
185
+ # => ListObject
186
+
187
+ list.has_more?
188
+ # => true
189
+
190
+ list.data
191
+ # => Array of GigInvitation objects
192
+ ```
193
+
194
+ ### Accept a gig invitation
195
+
196
+ ```ruby
197
+ client.GigInvitation.accept(1)
198
+ ```
199
+
200
+ ## Notification Locale
201
+ ### Create a notification locale
202
+
203
+ ```ruby
204
+ locale = client.NotificationLocale.create(locale: 'de')
205
+ # => NotificationLocale object
206
+
207
+ locale.locale
208
+ # => 'de'
209
+
210
+ locale.configurations
211
+ # => Array of NotificationConfiguration objects
212
+ ```
213
+
214
+ ### List all notification locales
215
+
216
+ ```ruby
217
+ list = client.NotificationLocale.list
218
+ # => ListObject
219
+
220
+ list.has_more?
221
+ # => true
222
+
223
+ list.data
224
+ # => Array of NotificationLocale objects
225
+
226
+ client.NotificationLocale.list(default: true) # filter by default
227
+ ```
228
+
229
+ ## Notification Configuration
230
+ ### List all notification configurations
231
+
232
+ ```ruby
233
+ list = client.NotificationConfiguration.list
234
+ # => ListObject
235
+
236
+ list.has_more?
237
+ # => true
238
+
239
+ list.data
240
+ # => Array of NotificationConfiguration objects
241
+
242
+ client.NotificationConfiguration.list(locale: 'de') # filter by locale
243
+
244
+ client.NotificationConfiguration.list(limit: 100, after: 100) # pagination
245
+ ```
246
+
247
+ ## Notification Layout
248
+ ### Create a notification layout
249
+
250
+ ```ruby
251
+ client.NotificationLayout.create(
252
+ name: 'custom_layout',
253
+ templates: [
254
+ { notification_configuration_id: '1', body: '<p>hello {{recipient}}</p>' },
255
+ { notification_configuration_id: '2', body: '<p>hallo {{recipient}}</p>' }
256
+ ]
257
+ )
258
+ ```
259
+
260
+ ### Update a notification layout
261
+
262
+ ```ruby
263
+ client.NotificationLayout.update('1', name: 'custom_layout')
264
+ ```
265
+
266
+ ### Create a new template
267
+
268
+ ```ruby
269
+ client.NotificationLayout.create_template(
270
+ '1',
271
+ { notification_configuration_id: '1', body: '<p>hello {{recipient}}</p>' }
272
+ )
273
+ # => NotificationLayoutTemplate object
274
+ ```
275
+
276
+ ## Notification Layout Template
277
+ ### Update a notification layout template
278
+
279
+ ```ruby
280
+ client.NotificationLayoutTemplate.update(
281
+ '1',
282
+ { notification_configuration_id: '1', body: '<p>hello {{recipient}}</p>' }
283
+ )
284
+ ```
285
+ ### Delete a notification layout template
286
+
287
+ ```ruby
288
+ client.NotificationLayoutTemplate.delete('1')
289
+ ```
290
+
291
+ ## Notification Topic
292
+ ### List all notification topics
293
+
294
+ ```ruby
295
+ list = client.NotificationTopic
296
+ # => ListObject
297
+
298
+ list.has_more?
299
+ # => true
300
+
301
+ list.data
302
+ # => Array of NotificationTopic objects
303
+
304
+ # filter by layout_id
305
+ client.NotificationTopic.list(notification_layout_id: 1)
306
+
307
+ # pagination
308
+ client.NotificationTopic.list(limit: 10, after: 10)
309
+ ```
310
+
311
+ ### Create a notification channel
312
+
313
+ ```ruby
314
+ client.NotificationTopic.create(
315
+ name: 'new_bug_comment',
316
+ notification_layout_id: 1,
317
+ preferences: {
318
+ email: 'immediately'
319
+ },
320
+ templates: [
321
+ {
322
+ "notification_configuration_id": "1",
323
+ "subject": "New Bug Comment",
324
+ "body": "Hello {{recipient_first_name}}, you got {{pluralize count, 'new comment', 'new comments'}}"
325
+ },
326
+ {
327
+ "notification_configuration_id": "2",
328
+ "subject": "Neuer Kommentar",
329
+ "body": "Hallo {{recipient_first_name}}, Du hast {{pluralize count, 'neuen Kommentar', 'neue Kommentare'}}"
330
+ }
331
+ ]
332
+ )
333
+ ```
334
+
335
+ ## Notification (Channel) Template
336
+ ### List all
337
+
338
+ ```ruby
339
+ list = client.NotificationTemplate
340
+ # => ListObject
341
+
342
+ list.has_more?
343
+ # => true
344
+
345
+ list.data
346
+ # => Array of NotificationTemplate objects
347
+
348
+ # filter by channel id
349
+ client.NotificationTemplate.list(notification_channel_id: 1)
350
+
351
+ # filter by configuration id
352
+ client.NotificationTemplate.list(notification_configuration_id: 1)
353
+
354
+ # pagination
355
+ client.NotificationTemplate.list(limit: 10, after: 10)
356
+ ```
357
+
358
+ ### Update a notification template
359
+
360
+ ```ruby
361
+ client.NotificationTemplate.update(
362
+ '1',
363
+ "subject": "New Bug Comment",
364
+ "body": "Hello {{recipient_first_name}}, you got {{pluralize count, 'new comment', 'new comments'}}"
365
+ )
366
+ ```
367
+
368
+ ### Delete a notification template
369
+
370
+ ```ruby
371
+ client.NotificationTemplate.delete('1')
372
+ ```
373
+ ## Notifcation Channel Preference
374
+ ### List all
375
+
376
+ ```ruby
377
+ list = client.NotificationTopicPreference.list
378
+ # => ListObject
379
+
380
+ list.has_more?
381
+ # => true
382
+
383
+ list.data
384
+ # => Array of NotificationTopicPreference objects
385
+
386
+ # filter by channel id
387
+ client.NotificationTopicPreference.list(notification_channel_id: 1)
388
+
389
+ # filter by user id
390
+ client.NotificationTopicPreference.list(user_id: 1)
391
+
392
+ # pagination
393
+ client.NotificationTopicPreference.list(limit: 10, after: 10)
394
+ ```
395
+
396
+ ## Notifcation Broadcast
397
+ ### Create a notifcation broadcast
398
+
399
+ ```ruby
400
+ client.NotificationBroadcast.create(
401
+ payload: {
402
+ foo: 'bar',
403
+ key: 'value'
404
+ },
405
+ recipients: {
406
+ user_ids: [1, 2, 3]
407
+ },
408
+ notification_channel_id: 1
409
+ )
410
+ ```
data/bin/console CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'bundler/setup'
4
4
  require 'cirro_io/client'
5
+ require 'cirro_io_v2/client'
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -25,6 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
26
26
  spec.require_paths = ['lib']
27
27
 
28
+ spec.add_runtime_dependency 'activesupport'
28
29
  spec.add_runtime_dependency 'jwt'
29
30
  spec.add_runtime_dependency 'faraday', '< 1.2.0'
30
31
  spec.add_runtime_dependency 'faraday_middleware'
@@ -28,6 +28,26 @@ module CirroIO
28
28
  conn.use JsonApiClient::Middleware::Status, {}
29
29
  end
30
30
  end
31
+
32
+ # HACK: https://github.com/JsonApiClient/json_api_client/issues/390
33
+ # waiting for json_api_client to release a new version with the fix
34
+ # https://github.com/JsonApiClient/json_api_client/pull/398
35
+ # rubocop:disable all
36
+ def initialize(params = {})
37
+ params = params.with_indifferent_access
38
+ @persisted = nil
39
+ @destroyed = nil
40
+ self.links = self.class.linker.new(params.delete(:links) || {})
41
+ self.relationships = self.class.relationship_linker.new(self.class, params.delete(:relationships) || {})
42
+ self.attributes = self.class.default_attributes.merge params.except(*self.class.prefix_params)
43
+ self.forget_change!(:type)
44
+ self.__belongs_to_params = params.slice(*self.class.prefix_params)
45
+
46
+ setup_default_properties
47
+
48
+ self.request_params = self.class.request_params_class.new(self.class)
49
+ end
50
+ # rubocop:enable all
31
51
  end
32
52
  end
33
53
  end