cirro-ruby-client 1.6.2 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +5 -0
- data/.rubocop.yml +28 -11
- data/Gemfile.lock +8 -5
- data/README.md +338 -0
- data/bin/console +1 -0
- data/cirro-ruby-client.gemspec +1 -0
- data/lib/cirro_io/client/gig.rb +0 -2
- data/lib/cirro_io/client/notifications_broadcast.rb +1 -1
- data/lib/cirro_io/client/notifications_template.rb +1 -1
- data/lib/cirro_io/client/{notifications_channel.rb → notifications_topic.rb} +1 -1
- data/lib/cirro_io/client/version.rb +1 -1
- data/lib/cirro_io/client.rb +1 -1
- data/lib/cirro_io_v2/client.rb +106 -0
- data/lib/cirro_io_v2/errors/http_error.rb +17 -0
- data/lib/cirro_io_v2/errors/response_not_json_error.rb +17 -0
- data/lib/cirro_io_v2/request_clients/base.rb +21 -0
- data/lib/cirro_io_v2/request_clients/jwt.rb +42 -0
- data/lib/cirro_io_v2/resources/base.rb +21 -0
- data/lib/cirro_io_v2/resources/gig.rb +10 -0
- data/lib/cirro_io_v2/resources/gig_invitation.rb +18 -0
- data/lib/cirro_io_v2/resources/notification_broadcast.rb +13 -0
- data/lib/cirro_io_v2/resources/notification_configuration.rb +13 -0
- data/lib/cirro_io_v2/resources/notification_layout.rb +27 -0
- data/lib/cirro_io_v2/resources/notification_layout_template.rb +18 -0
- data/lib/cirro_io_v2/resources/notification_locale.rb +18 -0
- data/lib/cirro_io_v2/resources/notification_template.rb +25 -0
- data/lib/cirro_io_v2/resources/notification_topic.rb +24 -0
- data/lib/cirro_io_v2/resources/notification_topic_preference.rb +17 -0
- data/lib/cirro_io_v2/resources/user.rb +15 -0
- data/lib/cirro_io_v2/responses/base.rb +32 -0
- data/lib/cirro_io_v2/responses/responses.rb +101 -0
- metadata +36 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cb241151c08978a8fea7a2b594440dd63ea330620c3e2e75c392bf78c4e85a9a
|
4
|
+
data.tar.gz: 32028d6fd708791bb8ef147a6149d3eb8ee54739ee01d384c5929a2c56b6ba11
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afd6cc918fda461905fe9ffd2a91492c40fa7feaa7ae82f7fc6c216b8448e04fad95f510bc7da0e4fe33f90ec1bf27b73270d21f6027f02cd2e8154033d41c21
|
7
|
+
data.tar.gz: 53e4c74b781b0d695d9f85d08e9524bca54aa2a4c59c3bf7875e23051468df25320ff271df34c7af0985da9ea755ef180f94ff49deed44745b672c83cef0f490
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -10,18 +10,26 @@ AllCops:
|
|
10
10
|
- 'vendor/**/*'
|
11
11
|
- 'spec/fixtures/**/*'
|
12
12
|
|
13
|
-
Metrics/
|
14
|
-
|
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
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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/Gemfile.lock
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cirro-ruby-client (1.
|
4
|
+
cirro-ruby-client (2.1.0)
|
5
|
+
activesupport
|
5
6
|
faraday (< 1.2.0)
|
6
7
|
faraday_middleware
|
7
8
|
json_api_client (>= 1.10.0)
|
@@ -10,13 +11,14 @@ PATH
|
|
10
11
|
GEM
|
11
12
|
remote: https://rubygems.org/
|
12
13
|
specs:
|
13
|
-
activemodel (
|
14
|
-
activesupport (=
|
15
|
-
activesupport (
|
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)
|
21
|
+
zeitwerk (~> 2.3)
|
20
22
|
addressable (2.8.0)
|
21
23
|
public_suffix (>= 2.0.2, < 5.0)
|
22
24
|
ast (2.4.1)
|
@@ -92,6 +94,7 @@ GEM
|
|
92
94
|
addressable (>= 2.3.6)
|
93
95
|
crack (>= 0.3.2)
|
94
96
|
hashdiff (>= 0.4.0, < 2.0.0)
|
97
|
+
zeitwerk (2.5.4)
|
95
98
|
|
96
99
|
PLATFORMS
|
97
100
|
ruby
|
@@ -107,4 +110,4 @@ DEPENDENCIES
|
|
107
110
|
webmock
|
108
111
|
|
109
112
|
BUNDLED WITH
|
110
|
-
2.
|
113
|
+
2.3.20
|
data/README.md
CHANGED
@@ -70,3 +70,341 @@ CirroIO::Client::Payout.create(
|
|
70
70
|
billing_date: DateTime.now
|
71
71
|
)
|
72
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.topics
|
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
|
+
topics: [
|
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.list
|
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 topic
|
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 (Topic) Template
|
336
|
+
### List all
|
337
|
+
|
338
|
+
```ruby
|
339
|
+
list = client.NotificationTemplate.list
|
340
|
+
# => ListObject
|
341
|
+
|
342
|
+
list.has_more?
|
343
|
+
# => true
|
344
|
+
|
345
|
+
list.data
|
346
|
+
# => Array of NotificationTemplate objects
|
347
|
+
|
348
|
+
# filter by topic id
|
349
|
+
client.NotificationTemplate.list(notification_topic_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 Topic 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 topic id
|
387
|
+
client.NotificationTopicPreference.list(notification_topic_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_topic_id: 1
|
409
|
+
)
|
410
|
+
```
|
data/bin/console
CHANGED
data/cirro-ruby-client.gemspec
CHANGED
@@ -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'
|
data/lib/cirro_io/client/gig.rb
CHANGED
@@ -8,7 +8,6 @@ module CirroIO
|
|
8
8
|
has_many :gig_results
|
9
9
|
has_many :gig_time_activities
|
10
10
|
|
11
|
-
# rubocop:disable Metrics/AbcSize
|
12
11
|
def bulk_create_with(worker_filter, gig_tasks)
|
13
12
|
payload = { data: { attributes: attributes, relationships: {} } }
|
14
13
|
payload[:data][:relationships][:gig_tasks] = gig_tasks.map(&:attributes)
|
@@ -35,7 +34,6 @@ module CirroIO
|
|
35
34
|
|
36
35
|
self.class.parser.parse(self.class, response).first
|
37
36
|
end
|
38
|
-
# rubocop:enable Metrics/AbcSize
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|
data/lib/cirro_io/client.rb
CHANGED
@@ -16,7 +16,7 @@ require 'cirro_io/client/gig_time_activity'
|
|
16
16
|
require 'cirro_io/client/gig'
|
17
17
|
require 'cirro_io/client/payout'
|
18
18
|
require 'cirro_io/client/notifications_broadcast'
|
19
|
-
require 'cirro_io/client/
|
19
|
+
require 'cirro_io/client/notifications_topic'
|
20
20
|
require 'cirro_io/client/notifications_template'
|
21
21
|
|
22
22
|
module CirroIO
|
@@ -0,0 +1,106 @@
|
|
1
|
+
require 'cirro_io/client/version'
|
2
|
+
require 'cirro_io_v2/errors/http_error'
|
3
|
+
require 'cirro_io_v2/errors/response_not_json_error'
|
4
|
+
|
5
|
+
require 'cirro_io_v2/request_clients/base'
|
6
|
+
require 'cirro_io_v2/request_clients/jwt'
|
7
|
+
|
8
|
+
require 'cirro_io_v2/resources/base'
|
9
|
+
require 'cirro_io_v2/resources/gig'
|
10
|
+
require 'cirro_io_v2/resources/gig_invitation'
|
11
|
+
require 'cirro_io_v2/resources/user'
|
12
|
+
|
13
|
+
require 'cirro_io_v2/responses/base'
|
14
|
+
require 'cirro_io_v2/responses/responses'
|
15
|
+
|
16
|
+
require 'cirro_io_v2/resources/notification_broadcast'
|
17
|
+
require 'cirro_io_v2/resources/notification_topic_preference'
|
18
|
+
require 'cirro_io_v2/resources/notification_topic'
|
19
|
+
require 'cirro_io_v2/resources/notification_configuration'
|
20
|
+
require 'cirro_io_v2/resources/notification_layout_template'
|
21
|
+
require 'cirro_io_v2/resources/notification_layout'
|
22
|
+
require 'cirro_io_v2/resources/notification_locale'
|
23
|
+
require 'cirro_io_v2/resources/notification_template'
|
24
|
+
|
25
|
+
module CirroIOV2
|
26
|
+
class Client
|
27
|
+
attr_accessor :request_client
|
28
|
+
attr_reader :options
|
29
|
+
|
30
|
+
DEFAULT_OPTIONS = {
|
31
|
+
site: 'https://api.cirro.io',
|
32
|
+
api_version: 'v2',
|
33
|
+
auth_type: :jwt,
|
34
|
+
}.freeze
|
35
|
+
|
36
|
+
DEFINED_OPTIONS = (DEFAULT_OPTIONS.keys + [:private_key, :private_key_path, :client_id]).freeze
|
37
|
+
|
38
|
+
def initialize(options = {})
|
39
|
+
@options = DEFAULT_OPTIONS.merge(options)
|
40
|
+
|
41
|
+
unknown_options = @options.keys.reject { |o| DEFINED_OPTIONS.include?(o) }
|
42
|
+
raise ArgumentError, "Unknown option(s) given: #{unknown_options}" unless unknown_options.empty?
|
43
|
+
|
44
|
+
# TODO: for now we only have jwt
|
45
|
+
case @options[:auth_type]
|
46
|
+
when :jwt
|
47
|
+
private_key = OpenSSL::PKey::RSA.new(@options[:private_key]) if @options[:private_key]
|
48
|
+
private_key = OpenSSL::PKey::RSA.new(File.read(@options[:private_key_path])) if @options[:private_key_path]
|
49
|
+
@request_client = RequestClients::Jwt.new(base_url: "#{@options[:site]}/#{@options[:api_version]}",
|
50
|
+
client_id: @options[:client_id],
|
51
|
+
private_key: private_key)
|
52
|
+
else
|
53
|
+
raise ArgumentError, 'Options: ":auth_type" must be ":jwt"'
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# resources
|
58
|
+
# rubocop:disable Naming/MethodName
|
59
|
+
|
60
|
+
def User
|
61
|
+
Resources::User.new(self)
|
62
|
+
end
|
63
|
+
|
64
|
+
def GigInvitation
|
65
|
+
Resources::GigInvitation.new(self)
|
66
|
+
end
|
67
|
+
|
68
|
+
def Gig
|
69
|
+
Resources::Gig.new(self)
|
70
|
+
end
|
71
|
+
|
72
|
+
def NotificationBroadcast
|
73
|
+
Resources::NotificationBroadcast.new(self)
|
74
|
+
end
|
75
|
+
|
76
|
+
def NotificationTopicPreference
|
77
|
+
Resources::NotificationTopicPreference.new(self)
|
78
|
+
end
|
79
|
+
|
80
|
+
def NotificationTopic
|
81
|
+
Resources::NotificationTopic.new(self)
|
82
|
+
end
|
83
|
+
|
84
|
+
def NotificationConfiguration
|
85
|
+
Resources::NotificationConfiguration.new(self)
|
86
|
+
end
|
87
|
+
|
88
|
+
def NotificationLayoutTemplate
|
89
|
+
Resources::NotificationLayoutTemplate.new(self)
|
90
|
+
end
|
91
|
+
|
92
|
+
def NotificationLayout
|
93
|
+
Resources::NotificationLayout.new(self)
|
94
|
+
end
|
95
|
+
|
96
|
+
def NotificationLocale
|
97
|
+
Resources::NotificationLocale.new(self)
|
98
|
+
end
|
99
|
+
|
100
|
+
def NotificationTemplate
|
101
|
+
Resources::NotificationTopic.new(self)
|
102
|
+
end
|
103
|
+
|
104
|
+
# rubocop:enable Naming/MethodName
|
105
|
+
end
|
106
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
module CirroIOV2
|
4
|
+
module Errors
|
5
|
+
class HTTPError < StandardError
|
6
|
+
extend Forwardable
|
7
|
+
|
8
|
+
def_instance_delegators :@response, :code
|
9
|
+
attr_reader :response, :message
|
10
|
+
|
11
|
+
def initialize(response)
|
12
|
+
@response = response
|
13
|
+
@message = response.try(:message).presence || response.try(:body)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
module CirroIOV2
|
4
|
+
module Errors
|
5
|
+
class ResponseNotJsonError < StandardError
|
6
|
+
extend Forwardable
|
7
|
+
|
8
|
+
def_instance_delegators :@faraday_error, :message, :full_message, :response
|
9
|
+
|
10
|
+
attr_reader :faraday_error
|
11
|
+
|
12
|
+
def initialize(faraday_error)
|
13
|
+
@faraday_error = faraday_error
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module RequestClients
|
3
|
+
class Base
|
4
|
+
# Interface of all request clients. It returns the response if the request was successful (HTTP::2xx) and
|
5
|
+
# raises a CirroIOV2::HTTPError together with the response if the request was not successful
|
6
|
+
|
7
|
+
def request(*args, **named_args)
|
8
|
+
response = make_request(*args, **named_args)
|
9
|
+
raise Errors::HTTPError, response unless response.success?
|
10
|
+
|
11
|
+
response
|
12
|
+
rescue Faraday::ParsingError => e
|
13
|
+
raise Errors::ResponseNotJsonError, e
|
14
|
+
end
|
15
|
+
|
16
|
+
def make_request(*args)
|
17
|
+
raise NotImplementedError
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'jwt'
|
2
|
+
require 'openssl'
|
3
|
+
|
4
|
+
module CirroIOV2
|
5
|
+
module RequestClients
|
6
|
+
class Jwt < Base
|
7
|
+
attr_reader :base_url, :private_key, :client_id, :connection
|
8
|
+
|
9
|
+
def initialize(base_url:, private_key:, client_id:)
|
10
|
+
@base_url = base_url
|
11
|
+
@private_key = private_key
|
12
|
+
@client_id = client_id
|
13
|
+
|
14
|
+
@connection = Faraday.new(url: base_url) do |conn|
|
15
|
+
conn.request :json
|
16
|
+
conn.response :raise_error
|
17
|
+
conn.response :json
|
18
|
+
conn.adapter Faraday.default_adapter # testIO App is on older version of faraday and needs this line
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def make_request(http_method, url, body: nil, params: nil, _headers: {})
|
23
|
+
@connection.send(http_method, url) do |request|
|
24
|
+
request.params = params if params
|
25
|
+
request.body = body.to_json if body
|
26
|
+
request.headers['Authorization'] = bearer_token
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def bearer_token
|
31
|
+
payload = {
|
32
|
+
exp: Time.now.to_i + (10 * 60),
|
33
|
+
sub: client_id,
|
34
|
+
}
|
35
|
+
|
36
|
+
token = JWT.encode(payload, private_key, 'RS256')
|
37
|
+
|
38
|
+
"Bearer #{token}"
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'active_support/core_ext/string/inflections'
|
2
|
+
|
3
|
+
module CirroIOV2
|
4
|
+
module Resources
|
5
|
+
class Base
|
6
|
+
attr_reader :client
|
7
|
+
|
8
|
+
def initialize(client)
|
9
|
+
@client = client
|
10
|
+
end
|
11
|
+
|
12
|
+
def resource_root
|
13
|
+
self.class.name.demodulize.underscore.pluralize
|
14
|
+
end
|
15
|
+
|
16
|
+
def params_allowed?(params, allowed)
|
17
|
+
raise 'ParamNotAllowed' if (params.keys - allowed).any?
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class GigInvitation < Base
|
4
|
+
ALLOWED_PARAMS = [:user_id, :gig_id, :limit, :before, :after, :status].freeze
|
5
|
+
|
6
|
+
def list(params = nil)
|
7
|
+
params_allowed?(params, ALLOWED_PARAMS) if params
|
8
|
+
response = client.request_client.request(:get, resource_root, params: params)
|
9
|
+
Responses::GigInvitationListResponse.new(response.body)
|
10
|
+
end
|
11
|
+
|
12
|
+
def accept(id)
|
13
|
+
response = client.request_client.request(:post, "#{resource_root}/#{id}/accept")
|
14
|
+
Responses::GigInvitationResponse.new(response.body)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class NotificationBroadcast < Base
|
4
|
+
ALLOWED_PARAMS = [:payload, :recipients, :notification_topic_id].freeze
|
5
|
+
|
6
|
+
def create(params)
|
7
|
+
params_allowed?(params, ALLOWED_PARAMS)
|
8
|
+
response = client.request_client.request(:post, resource_root, body: params)
|
9
|
+
Responses::NotificationBroadcastResponse.new(response.body)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class NotificationConfiguration < Base
|
4
|
+
ALLOWED_PARAMS = [:locale, :limit, :before, :after].freeze
|
5
|
+
|
6
|
+
def list(params = nil)
|
7
|
+
params_allowed?(params, ALLOWED_PARAMS) if params
|
8
|
+
response = client.request_client.request(:get, resource_root, params: params)
|
9
|
+
Responses::NotificationConfigurationListResponse.new(response.body)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class NotificationLayout < Base
|
4
|
+
CREATE_ALLOWED_PARAMS = [:name, :templates].freeze
|
5
|
+
UPDATE_ALLOWED_PARAMS = [:name].freeze
|
6
|
+
CREATE_TEMPLATE_ALLOWED_PARAMS = [:notification_configuration_id, :body].freeze
|
7
|
+
|
8
|
+
def create(params)
|
9
|
+
params_allowed?(params, CREATE_ALLOWED_PARAMS)
|
10
|
+
response = client.request_client.request(:post, resource_root, body: params)
|
11
|
+
Responses::NotificationLayoutResponse.new(response.body)
|
12
|
+
end
|
13
|
+
|
14
|
+
def update(id, params)
|
15
|
+
params_allowed?(params, UPDATE_ALLOWED_PARAMS)
|
16
|
+
response = client.request_client.request(:post, "#{resource_root}/#{id}", body: params)
|
17
|
+
Responses::NotificationLayoutResponse.new(response.body)
|
18
|
+
end
|
19
|
+
|
20
|
+
def create_template(id, params)
|
21
|
+
params_allowed?(params, CREATE_TEMPLATE_ALLOWED_PARAMS)
|
22
|
+
response = client.request_client.request(:post, "#{resource_root}/#{id}/notification_layout_templates", body: params)
|
23
|
+
Responses::NotificationLayoutTemplateResponse.new(response.body)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class NotificationLayoutTemplate < Base
|
4
|
+
UPDATE_ALLOWED_PARAMS = [:notification_configuration_id, :body].freeze
|
5
|
+
|
6
|
+
def update(id, params)
|
7
|
+
params_allowed?(params, UPDATE_ALLOWED_PARAMS)
|
8
|
+
response = client.request_client.request(:post, "#{resource_root}/#{id}", body: params)
|
9
|
+
Responses::NotificationLayoutTemplateResponse.new(response.body)
|
10
|
+
end
|
11
|
+
|
12
|
+
def delete(id)
|
13
|
+
response = client.request_client.request(:delete, "#{resource_root}/#{id}")
|
14
|
+
Responses::NotificationLayoutTemplateDeleteResponse.new(response.body)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class NotificationLocale < Base
|
4
|
+
ALLOWED_PARAMS = [:locale].freeze
|
5
|
+
|
6
|
+
def create(params)
|
7
|
+
params_allowed?(params, ALLOWED_PARAMS)
|
8
|
+
response = client.request_client.request(:post, resource_root, body: params)
|
9
|
+
Responses::NotificationLocaleResponse.new(response.body)
|
10
|
+
end
|
11
|
+
|
12
|
+
def list
|
13
|
+
response = client.request_client.request(:get, resource_root)
|
14
|
+
Responses::NotificationLocaleListResponse.new(response.body)
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class NotificationTemplate < Base
|
4
|
+
LIST_ALLOWED_PARAMS = [:notification_configuration_id, :notification_topic_id, :limit, :before, :after].freeze
|
5
|
+
UPDATE_ALLOWED_PARAMS = [:subject, :body].freeze
|
6
|
+
|
7
|
+
def list(params = nil)
|
8
|
+
params_allowed?(params, LIST_ALLOWED_PARAMS) if params
|
9
|
+
response = client.request_client.request(:get, resource_root, params: params)
|
10
|
+
Responses::NotificationTemplateListResponse.new(response.body)
|
11
|
+
end
|
12
|
+
|
13
|
+
def update(id, params)
|
14
|
+
params_allowed?(params, UPDATE_ALLOWED_PARAMS)
|
15
|
+
response = client.request_client.request(:post, "#{resource_root}/#{id}", body: params)
|
16
|
+
Responses::NotificationTemplateResponse.new(response.body)
|
17
|
+
end
|
18
|
+
|
19
|
+
def delete(id)
|
20
|
+
response = client.request_client.request(:delete, "#{resource_root}/#{id}")
|
21
|
+
Responses::NotificationTemplateDeleteResponse.new(response.body)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class NotificationTopic < Base
|
4
|
+
ALLOWED_PARAMS = [:name, :notification_layout_id, :preferences, :templates].freeze
|
5
|
+
ALLOWED_LIST_PARAMS = [:notification_layout_id, :limit, :before, :after].freeze
|
6
|
+
|
7
|
+
def resource_root
|
8
|
+
'notification_topics'
|
9
|
+
end
|
10
|
+
|
11
|
+
def list(params = nil)
|
12
|
+
params_allowed?(params, ALLOWED_LIST_PARAMS) if params
|
13
|
+
response = client.request_client.request(:get, resource_root, params: params)
|
14
|
+
Responses::NotificationTopicListResponse.new(response.body)
|
15
|
+
end
|
16
|
+
|
17
|
+
def create(params)
|
18
|
+
params_allowed?(params, ALLOWED_PARAMS)
|
19
|
+
response = client.request_client.request(:post, resource_root, body: params)
|
20
|
+
Responses::NotificationTopicResponse.new(response.body)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class NotificationTopicPreference < Base
|
4
|
+
ALLOWED_PARAMS = [:user_id, :notification_topic_id, :limit, :before, :after].freeze
|
5
|
+
|
6
|
+
def resource_root
|
7
|
+
'notification_topic_preferences'
|
8
|
+
end
|
9
|
+
|
10
|
+
def list(params = nil)
|
11
|
+
params_allowed?(params, ALLOWED_PARAMS) if params
|
12
|
+
response = client.request_client.request(:get, resource_root, params: params)
|
13
|
+
Responses::NotificationTopicPreferenceListResponse.new(response.body)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Resources
|
3
|
+
class User < Base
|
4
|
+
def find(id)
|
5
|
+
response = client.request_client.request(:get, "#{resource_root}/#{id}")
|
6
|
+
CirroIOV2::Responses::UserResponse.new(response.body)
|
7
|
+
end
|
8
|
+
|
9
|
+
def notification_preferences(id, params)
|
10
|
+
response = client.request_client.request(:post, "#{resource_root}/#{id}/notification_preferences", body: params)
|
11
|
+
CirroIOV2::Responses::UserNotificationPreferenceResponse.new(response.body)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Responses
|
3
|
+
module Base
|
4
|
+
def initialize(body)
|
5
|
+
body = body.deep_symbolize_keys
|
6
|
+
if body[:object] == 'list'
|
7
|
+
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)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
def list_attribute(data)
|
23
|
+
data.keys.find { |key| data[key].is_a?(Hash) && data[key][:object] == 'list' }
|
24
|
+
end
|
25
|
+
|
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)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,101 @@
|
|
1
|
+
module CirroIOV2
|
2
|
+
module Responses
|
3
|
+
LIST_RESPONSES = [
|
4
|
+
:GigTaskListResponse,
|
5
|
+
:GigInvitationListResponse,
|
6
|
+
:NotificationTopicPreferenceListResponse,
|
7
|
+
:NotificationLocaleListResponse,
|
8
|
+
:NotificationConfigurationListResponse,
|
9
|
+
:NotificationLayoutTemplateListResponse,
|
10
|
+
:NotificationTopicListResponse,
|
11
|
+
:NotificationTemplateListResponse,
|
12
|
+
].freeze
|
13
|
+
|
14
|
+
UserResponse = Struct.new(:id, :object, :first_name, :last_name, :time_zone, :screen_name, :country_code, :epam, :worker) do
|
15
|
+
include Base
|
16
|
+
end
|
17
|
+
|
18
|
+
UserNotificationPreferenceResponse = Struct.new(:id, :object, :locale, :topics) do
|
19
|
+
self::NESTED_RESPONSES = { topics: :NotificationTopicListResponse }.freeze
|
20
|
+
include Base
|
21
|
+
end
|
22
|
+
|
23
|
+
GigResponse = Struct.new(:id,
|
24
|
+
:object,
|
25
|
+
:title,
|
26
|
+
:description,
|
27
|
+
:url,
|
28
|
+
:start_at,
|
29
|
+
:end_at,
|
30
|
+
:total_seats,
|
31
|
+
:invitation_mode,
|
32
|
+
:filter_query,
|
33
|
+
:tasks,
|
34
|
+
:notification_payload,
|
35
|
+
:epam_options) do
|
36
|
+
self::NESTED_RESPONSES = { tasks: :GigTaskListResponse }.freeze
|
37
|
+
include Base
|
38
|
+
end
|
39
|
+
|
40
|
+
GigTaskResponse = Struct.new(:id, :object, :title, :base_price) do
|
41
|
+
include Base
|
42
|
+
end
|
43
|
+
|
44
|
+
GigInvitationResponse = Struct.new(:id, :object, :status, :gig_id, :user_id) do
|
45
|
+
include Base
|
46
|
+
end
|
47
|
+
|
48
|
+
NotificationTopicPreferenceResponse = Struct.new(:id, :object, :preferences, :notification_topic_id, :user_id) do
|
49
|
+
self::NESTED_RESPONSES = { preferences: :NotificationTopicPreferenceListResponse }.freeze
|
50
|
+
include Base
|
51
|
+
end
|
52
|
+
|
53
|
+
NotificationLocaleResponse = Struct.new(:id, :object, :locale, :default, :configurations) do
|
54
|
+
self::NESTED_RESPONSES = { configurations: :NotificationConfigurationListResponse }.freeze
|
55
|
+
include Base
|
56
|
+
end
|
57
|
+
|
58
|
+
NotificationConfigurationResponse = Struct.new(:id, :object, :deliver_by, :format, :kind, :locale) do
|
59
|
+
include Base
|
60
|
+
end
|
61
|
+
|
62
|
+
NotificationLayoutResponse = Struct.new(:id, :object, :name, :templates) do
|
63
|
+
self::NESTED_RESPONSES = { templates: :NotificationLayoutTemplateListResponse }.freeze
|
64
|
+
include Base
|
65
|
+
end
|
66
|
+
|
67
|
+
NotificationLayoutTemplateResponse = Struct.new(:id, :notification_configuration_id, :notification_layout_id, :body) do
|
68
|
+
include Base
|
69
|
+
end
|
70
|
+
|
71
|
+
NotificationLayoutTemplateDeleteResponse = Struct.new(:id, :object, :deleted) do
|
72
|
+
include Base
|
73
|
+
end
|
74
|
+
|
75
|
+
NotificationTopicResponse = Struct.new(:id, :object, :name, :notification_layout_id, :preferences, :templates) do
|
76
|
+
self::NESTED_RESPONSES = { templates: :NotificationTemplateListResponse }.freeze
|
77
|
+
include Base
|
78
|
+
end
|
79
|
+
|
80
|
+
NotificationTemplateResponse = Struct.new(:id, :object, :notification_configuration_id, :notification_topic_id, :subject, :body) do
|
81
|
+
include Base
|
82
|
+
end
|
83
|
+
|
84
|
+
NotificationTemplateDeleteResponse = Struct.new(:id, :object, :deleted) do
|
85
|
+
include Base
|
86
|
+
end
|
87
|
+
|
88
|
+
NotificationBroadcastResponse = Struct.new(:id, :object, :payload, :recipients, :notification_topic_id) do
|
89
|
+
include Base
|
90
|
+
end
|
91
|
+
|
92
|
+
# cover the list responses
|
93
|
+
def self.const_missing(name)
|
94
|
+
return const_get(name) if const_defined? name
|
95
|
+
return unless LIST_RESPONSES.include? name
|
96
|
+
|
97
|
+
klass = Class.new(Struct.new(:object, :url, :has_more, :data)) { include Base }
|
98
|
+
const_set(name, klass)
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cirro-ruby-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 2.1.0
|
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: 2022-
|
11
|
+
date: 2022-08-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: activesupport
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: jwt
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -101,12 +115,31 @@ files:
|
|
101
115
|
- lib/cirro_io/client/gig_time_activity.rb
|
102
116
|
- lib/cirro_io/client/jwt_authentication.rb
|
103
117
|
- lib/cirro_io/client/notifications_broadcast.rb
|
104
|
-
- lib/cirro_io/client/notifications_channel.rb
|
105
118
|
- lib/cirro_io/client/notifications_template.rb
|
119
|
+
- lib/cirro_io/client/notifications_topic.rb
|
106
120
|
- lib/cirro_io/client/payout.rb
|
107
121
|
- lib/cirro_io/client/response_debugging_middleware.rb
|
108
122
|
- lib/cirro_io/client/version.rb
|
109
123
|
- lib/cirro_io/client/worker_filter.rb
|
124
|
+
- lib/cirro_io_v2/client.rb
|
125
|
+
- lib/cirro_io_v2/errors/http_error.rb
|
126
|
+
- lib/cirro_io_v2/errors/response_not_json_error.rb
|
127
|
+
- lib/cirro_io_v2/request_clients/base.rb
|
128
|
+
- lib/cirro_io_v2/request_clients/jwt.rb
|
129
|
+
- lib/cirro_io_v2/resources/base.rb
|
130
|
+
- lib/cirro_io_v2/resources/gig.rb
|
131
|
+
- lib/cirro_io_v2/resources/gig_invitation.rb
|
132
|
+
- lib/cirro_io_v2/resources/notification_broadcast.rb
|
133
|
+
- lib/cirro_io_v2/resources/notification_configuration.rb
|
134
|
+
- lib/cirro_io_v2/resources/notification_layout.rb
|
135
|
+
- lib/cirro_io_v2/resources/notification_layout_template.rb
|
136
|
+
- lib/cirro_io_v2/resources/notification_locale.rb
|
137
|
+
- lib/cirro_io_v2/resources/notification_template.rb
|
138
|
+
- lib/cirro_io_v2/resources/notification_topic.rb
|
139
|
+
- lib/cirro_io_v2/resources/notification_topic_preference.rb
|
140
|
+
- lib/cirro_io_v2/resources/user.rb
|
141
|
+
- lib/cirro_io_v2/responses/base.rb
|
142
|
+
- lib/cirro_io_v2/responses/responses.rb
|
110
143
|
homepage: https://cirro.io/api-docs/v1#cirro-api-documentation
|
111
144
|
licenses:
|
112
145
|
- MIT
|