keinaufwand 0.2.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85fc27f6be51f097cb90f5b363623015b061cdc49cea25114db66df76535d51f
4
- data.tar.gz: 96784cf520136fde81e42fbeb224d69938d786e9e23359779e3c39e3ad51763e
3
+ metadata.gz: a1e4d46773bcdf8844caeb78fc3e274fe03ffcea07a9998f83a0b17dbfb6dfe9
4
+ data.tar.gz: 61bc78903d08f704ed957d9a7c8c2c50b45f997a171a84ca9ed6c6f99df68bc6
5
5
  SHA512:
6
- metadata.gz: 3921df5370f13c87fd5e1dd51e4b54e64eabcd7b2481c25adad9981dac8f8d6a3e6460d3815cde33f25fbfe71fdccff91e7abf95af38cf9f83a3f6e04ad9f72d
7
- data.tar.gz: 5f9e5f1abe8a6e92c5f96c2c06c1ccca639b215a508e57c53fd9c4f055ef3b2d7e3b71a42590aaffb8a18d1f72643d636368f46bff459c9dbe45c732e74fab9c
6
+ metadata.gz: e4d73ca1222892ba427e96f5df70ff34ac8fc5f0f39a449981687eb55b417548da08a7da03294944f8f1a859ebecaca779d88015490b25cc405ac0953624e94a
7
+ data.tar.gz: 5c958ec4027b1775035ebe6e4eab279241f782ba58d21b1134dfcb04bfa877bf85494060639a3914bb574d77c53733157a7d8d92f18b9f5d7afcd2a52aa31896
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  Ruby client for the [Keinaufwand API](https://keinaufwand.com). Includes the API schema and typed nested records.
4
4
 
5
5
  ```ruby
6
- gem "keinaufwand", "~> 0.2.0"
6
+ gem "keinaufwand", "~> 0.3.1"
7
7
  ```
8
8
 
9
9
  ```ruby
@@ -23,6 +23,6 @@ end
23
23
  post = client.retrieve_post(123)
24
24
  ```
25
25
 
26
- Requests require an account API key. Collection methods return an enumerable page with pagination metadata; show methods return one record. HTTP failures raise `Keinaufwand::Api::Client::Error`.
26
+ Requests require an account API key. Collection methods return an enumerable page with pagination metadata; show methods return one record. HTTP failures raise `Keinaufwand::Api::Client::Error`. Listings return every record, archived, unpublished and cancelled ones included with their flags. With `updated_since`, they return the records changed since and `_deleted` tombstones of the records deleted since. The API keeps deletions for 90 days: an older `updated_since` answers `410 FULL_SYNC_REQUIRED`, raised as `Keinaufwand::Api::Client::FullSyncRequired`, after which a consumer lists everything again and treats records it no longer gets as deleted.
27
27
 
28
28
  For Rails persistence, local media, delta polling, and signed webhooks, install `keinaufwand-sync` as well.
@@ -22,6 +22,10 @@ module Keinaufwand
22
22
  nil
23
23
  end
24
24
  end
25
+
26
+ # A 410, the API's FULL_SYNC_REQUIRED: it no longer keeps the deletions since the given updated_since. List without
27
+ # updated_since and treat every record not listed as deleted.
28
+ class FullSyncRequired < Error; end
25
29
  end
26
30
  end
27
31
  end
@@ -91,6 +91,7 @@ module Keinaufwand
91
91
  request.body = JSON.generate(params) if verb != 'GET' && params.present?
92
92
 
93
93
  response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') { |http| http.request(request) }
94
+ raise FullSyncRequired, response if response.is_a?(Net::HTTPGone)
94
95
  raise Error, response unless response.is_a?(Net::HTTPSuccess)
95
96
 
96
97
  JSON.parse(response.body)
@@ -1,5 +1,5 @@
1
1
  module Keinaufwand
2
2
  module Api
3
- VERSION = '0.2.0'.freeze
3
+ VERSION = '0.3.1'.freeze
4
4
  end
5
5
  end
@@ -122,82 +122,6 @@
122
122
  }
123
123
  }
124
124
  },
125
- "Instructor": {
126
- "resource_name": "instructors",
127
- "attributes": {
128
- "id": "integer",
129
- "first_name": "virtual",
130
- "last_name": "virtual",
131
- "created_at": "datetime",
132
- "updated_at": "datetime"
133
- }
134
- },
135
- "InstructorDetail": {
136
- "resource_name": "instructor_details",
137
- "attributes": {
138
- "id": "integer",
139
- "instructor_id": "integer",
140
- "default": "virtual",
141
- "name": "virtual",
142
- "avatar_url": "virtual",
143
- "skills": "virtual",
144
- "created_at": "datetime",
145
- "updated_at": "datetime"
146
- },
147
- "associations": {
148
- "instructor": {
149
- "type": "belongs_to",
150
- "class_name": "Instructor",
151
- "inline": true
152
- }
153
- }
154
- },
155
- "InstructorGroup": {
156
- "resource_name": "instructor_groups",
157
- "attributes": {
158
- "id": "integer",
159
- "name": "virtual",
160
- "position": "virtual",
161
- "location_id": "integer",
162
- "created_at": "datetime",
163
- "updated_at": "datetime"
164
- },
165
- "associations": {
166
- "location": {
167
- "type": "belongs_to",
168
- "class_name": "Location",
169
- "inline": false
170
- },
171
- "instructor_group_members": {
172
- "type": "has_many",
173
- "class_name": "InstructorGroupMember",
174
- "inline": true
175
- }
176
- }
177
- },
178
- "InstructorGroupMember": {
179
- "resource_name": "instructor_group_members",
180
- "attributes": {
181
- "id": "integer",
182
- "instructor_group_id": "integer",
183
- "instructor_detail_id": "integer",
184
- "position": "virtual",
185
- "created_at": "datetime",
186
- "updated_at": "datetime"
187
- },
188
- "associations": {
189
- "instructor_group": {
190
- "type": "belongs_to",
191
- "class_name": "InstructorGroup",
192
- "inline": false
193
- },
194
- "instructor_detail": {
195
- "type": "belongs_to",
196
- "class_name": "InstructorDetail",
197
- "inline": true
198
- }
199
- }
200
- },
201
125
  "Location": {
202
126
  "resource_name": "locations",
203
127
  "attributes": {
@@ -271,6 +195,7 @@
271
195
  "interval_count": "virtual",
272
196
  "default": "virtual",
273
197
  "trial": "virtual",
198
+ "archived": "virtual",
274
199
  "created_at": "datetime",
275
200
  "updated_at": "datetime"
276
201
  }
@@ -314,9 +239,87 @@
314
239
  "max_age": "virtual",
315
240
  "grade": "virtual",
316
241
  "program": "virtual",
242
+ "archived": "virtual",
243
+ "created_at": "datetime",
244
+ "updated_at": "datetime"
245
+ }
246
+ },
247
+ "StaffMember": {
248
+ "resource_name": "staff_members",
249
+ "attributes": {
250
+ "id": "integer",
251
+ "first_name": "virtual",
252
+ "last_name": "virtual",
253
+ "archived": "virtual",
317
254
  "created_at": "datetime",
318
255
  "updated_at": "datetime"
319
256
  }
257
+ },
258
+ "StaffProfile": {
259
+ "resource_name": "staff_profiles",
260
+ "attributes": {
261
+ "id": "integer",
262
+ "staff_member_id": "integer",
263
+ "default": "virtual",
264
+ "name": "virtual",
265
+ "avatar_url": "virtual",
266
+ "skills": "virtual",
267
+ "created_at": "datetime",
268
+ "updated_at": "datetime"
269
+ },
270
+ "associations": {
271
+ "staff_member": {
272
+ "type": "belongs_to",
273
+ "class_name": "StaffMember",
274
+ "inline": true
275
+ }
276
+ }
277
+ },
278
+ "StaffTeam": {
279
+ "resource_name": "staff_teams",
280
+ "attributes": {
281
+ "id": "integer",
282
+ "name": "virtual",
283
+ "position": "virtual",
284
+ "location_id": "integer",
285
+ "created_at": "datetime",
286
+ "updated_at": "datetime"
287
+ },
288
+ "associations": {
289
+ "location": {
290
+ "type": "belongs_to",
291
+ "class_name": "Location",
292
+ "inline": false
293
+ },
294
+ "staff_team_members": {
295
+ "type": "has_many",
296
+ "class_name": "StaffTeamMember",
297
+ "inline": true
298
+ }
299
+ }
300
+ },
301
+ "StaffTeamMember": {
302
+ "resource_name": "staff_team_members",
303
+ "attributes": {
304
+ "id": "integer",
305
+ "staff_team_id": "integer",
306
+ "staff_profile_id": "integer",
307
+ "position": "virtual",
308
+ "created_at": "datetime",
309
+ "updated_at": "datetime"
310
+ },
311
+ "associations": {
312
+ "staff_team": {
313
+ "type": "belongs_to",
314
+ "class_name": "StaffTeam",
315
+ "inline": false
316
+ },
317
+ "staff_profile": {
318
+ "type": "belongs_to",
319
+ "class_name": "StaffProfile",
320
+ "inline": true
321
+ }
322
+ }
320
323
  }
321
324
  },
322
325
  "endpoints": {
@@ -331,84 +334,435 @@
331
334
  {
332
335
  "action": "index",
333
336
  "verb": "GET",
334
- "path": "/2026-07-02/locations"
337
+ "path": "/2026-07-02/locations",
338
+ "scope": "offers:read"
339
+ },
340
+ {
341
+ "action": "create",
342
+ "verb": "POST",
343
+ "path": "/2026-07-02/locations",
344
+ "scope": "offers:write",
345
+ "params": [
346
+ "archived",
347
+ {
348
+ "address_attributes": [
349
+ "street",
350
+ "zip",
351
+ "city",
352
+ "country_code",
353
+ "care_of"
354
+ ]
355
+ },
356
+ {
357
+ "contact_attributes": [
358
+ "first_name",
359
+ "last_name",
360
+ "email",
361
+ "phone",
362
+ "url"
363
+ ]
364
+ }
365
+ ]
335
366
  },
336
367
  {
337
368
  "action": "show",
338
369
  "verb": "GET",
339
- "path": "/2026-07-02/locations/:id"
370
+ "path": "/2026-07-02/locations/:id",
371
+ "scope": "offers:read"
372
+ },
373
+ {
374
+ "action": "update",
375
+ "verb": "PATCH",
376
+ "path": "/2026-07-02/locations/:id",
377
+ "scope": "offers:write",
378
+ "params": [
379
+ "archived",
380
+ {
381
+ "address_attributes": [
382
+ "street",
383
+ "zip",
384
+ "city",
385
+ "country_code",
386
+ "care_of"
387
+ ]
388
+ },
389
+ {
390
+ "contact_attributes": [
391
+ "first_name",
392
+ "last_name",
393
+ "email",
394
+ "phone",
395
+ "url"
396
+ ]
397
+ }
398
+ ]
340
399
  }
341
400
  ],
342
401
  "products": [
343
402
  {
344
403
  "action": "index",
345
404
  "verb": "GET",
346
- "path": "/2026-07-02/products"
405
+ "path": "/2026-07-02/products",
406
+ "scope": "offers:read"
407
+ },
408
+ {
409
+ "action": "create",
410
+ "verb": "POST",
411
+ "path": "/2026-07-02/products",
412
+ "scope": "offers:write",
413
+ "params": [
414
+ "position",
415
+ "product_type",
416
+ "session_type",
417
+ "regular_duration",
418
+ "step_duration",
419
+ "trial_duration",
420
+ "regular_prep_duration",
421
+ "regular_post_duration",
422
+ "trial_prep_duration",
423
+ "trial_post_duration",
424
+ "trial_requires_resource",
425
+ "accepts_trials",
426
+ "product_group_id",
427
+ "name",
428
+ "description",
429
+ "gender",
430
+ "min_age",
431
+ "max_age",
432
+ "archived"
433
+ ]
347
434
  },
348
435
  {
349
436
  "action": "show",
350
437
  "verb": "GET",
351
- "path": "/2026-07-02/products/:id"
438
+ "path": "/2026-07-02/products/:id",
439
+ "scope": "offers:read"
440
+ },
441
+ {
442
+ "action": "update",
443
+ "verb": "PATCH",
444
+ "path": "/2026-07-02/products/:id",
445
+ "scope": "offers:write",
446
+ "params": [
447
+ "position",
448
+ "product_type",
449
+ "session_type",
450
+ "regular_duration",
451
+ "step_duration",
452
+ "trial_duration",
453
+ "regular_prep_duration",
454
+ "regular_post_duration",
455
+ "trial_prep_duration",
456
+ "trial_post_duration",
457
+ "trial_requires_resource",
458
+ "accepts_trials",
459
+ "product_group_id",
460
+ "name",
461
+ "description",
462
+ "gender",
463
+ "min_age",
464
+ "max_age",
465
+ "archived"
466
+ ]
352
467
  }
353
468
  ],
354
469
  "sessions": [
355
470
  {
356
471
  "action": "index",
357
472
  "verb": "GET",
358
- "path": "/2026-07-02/sessions"
473
+ "path": "/2026-07-02/sessions",
474
+ "scope": "schedule:read"
475
+ },
476
+ {
477
+ "action": "create",
478
+ "verb": "POST",
479
+ "path": "/2026-07-02/sessions",
480
+ "scope": "schedule:write",
481
+ "params": [
482
+ "location_id",
483
+ "type",
484
+ "start_time",
485
+ "end_time",
486
+ "product_id",
487
+ "trial",
488
+ "max_seats",
489
+ "max_trials",
490
+ "program",
491
+ "grade",
492
+ "min_age",
493
+ "max_age",
494
+ "start_date",
495
+ "end_date",
496
+ "interval",
497
+ "day_id",
498
+ {
499
+ "holiday_ids": []
500
+ }
501
+ ]
359
502
  },
360
503
  {
361
504
  "action": "show",
362
505
  "verb": "GET",
363
- "path": "/2026-07-02/sessions/:id"
506
+ "path": "/2026-07-02/sessions/:id",
507
+ "scope": "schedule:read"
508
+ },
509
+ {
510
+ "action": "update",
511
+ "verb": "PATCH",
512
+ "path": "/2026-07-02/sessions/:id",
513
+ "scope": "schedule:write",
514
+ "params": [
515
+ "start_time",
516
+ "end_time",
517
+ "product_id",
518
+ "trial",
519
+ "max_seats",
520
+ "max_trials",
521
+ "program",
522
+ "grade",
523
+ "min_age",
524
+ "max_age",
525
+ "start_date",
526
+ "end_date",
527
+ "interval",
528
+ "day_id",
529
+ {
530
+ "holiday_ids": []
531
+ }
532
+ ]
533
+ },
534
+ {
535
+ "action": "destroy",
536
+ "verb": "DELETE",
537
+ "path": "/2026-07-02/sessions/:id",
538
+ "scope": "schedule:write"
364
539
  }
365
540
  ],
366
541
  "events": [
367
542
  {
368
543
  "action": "index",
369
544
  "verb": "GET",
370
- "path": "/2026-07-02/events"
545
+ "path": "/2026-07-02/events",
546
+ "scope": "schedule:read"
547
+ },
548
+ {
549
+ "action": "create",
550
+ "verb": "POST",
551
+ "path": "/2026-07-02/events",
552
+ "scope": "schedule:write",
553
+ "params": [
554
+ "event_detail_id",
555
+ "title",
556
+ "canceled",
557
+ "open_for_enrollment",
558
+ "enrollment_deadline_at",
559
+ {
560
+ "address_attributes": [
561
+ "street",
562
+ "zip",
563
+ "city",
564
+ "country_code"
565
+ ]
566
+ },
567
+ {
568
+ "event_parts_attributes": [
569
+ "id",
570
+ "_destroy",
571
+ "title",
572
+ "starts_at",
573
+ "ends_at"
574
+ ]
575
+ }
576
+ ]
371
577
  },
372
578
  {
373
579
  "action": "show",
374
580
  "verb": "GET",
375
- "path": "/2026-07-02/events/:id"
581
+ "path": "/2026-07-02/events/:id",
582
+ "scope": "schedule:read"
583
+ },
584
+ {
585
+ "action": "update",
586
+ "verb": "PATCH",
587
+ "path": "/2026-07-02/events/:id",
588
+ "scope": "schedule:write",
589
+ "params": [
590
+ "title",
591
+ "canceled",
592
+ "open_for_enrollment",
593
+ "enrollment_deadline_at",
594
+ {
595
+ "address_attributes": [
596
+ "street",
597
+ "zip",
598
+ "city",
599
+ "country_code"
600
+ ]
601
+ },
602
+ {
603
+ "event_parts_attributes": [
604
+ "id",
605
+ "_destroy",
606
+ "title",
607
+ "starts_at",
608
+ "ends_at"
609
+ ]
610
+ }
611
+ ]
612
+ },
613
+ {
614
+ "action": "destroy",
615
+ "verb": "DELETE",
616
+ "path": "/2026-07-02/events/:id",
617
+ "scope": "schedule:write"
376
618
  }
377
619
  ],
378
620
  "event_details": [
379
621
  {
380
622
  "action": "index",
381
623
  "verb": "GET",
382
- "path": "/2026-07-02/event_details"
624
+ "path": "/2026-07-02/event_details",
625
+ "scope": "offers:read"
626
+ },
627
+ {
628
+ "action": "create",
629
+ "verb": "POST",
630
+ "path": "/2026-07-02/event_details",
631
+ "scope": "offers:write",
632
+ "params": [
633
+ "position",
634
+ "title",
635
+ "event_category_id",
636
+ "slug",
637
+ "body",
638
+ {
639
+ "product_ids": []
640
+ }
641
+ ]
383
642
  },
384
643
  {
385
644
  "action": "show",
386
645
  "verb": "GET",
387
- "path": "/2026-07-02/event_details/:id"
646
+ "path": "/2026-07-02/event_details/:id",
647
+ "scope": "offers:read"
648
+ },
649
+ {
650
+ "action": "update",
651
+ "verb": "PATCH",
652
+ "path": "/2026-07-02/event_details/:id",
653
+ "scope": "offers:write",
654
+ "params": [
655
+ "position",
656
+ "title",
657
+ "event_category_id",
658
+ "slug",
659
+ "body",
660
+ {
661
+ "product_ids": []
662
+ }
663
+ ]
388
664
  }
389
665
  ],
390
666
  "posts": [
391
667
  {
392
668
  "action": "index",
393
669
  "verb": "GET",
394
- "path": "/2026-07-02/posts"
670
+ "path": "/2026-07-02/posts",
671
+ "scope": "website:read"
672
+ },
673
+ {
674
+ "action": "create",
675
+ "verb": "POST",
676
+ "path": "/2026-07-02/posts",
677
+ "scope": "website:write",
678
+ "params": [
679
+ "title",
680
+ "body",
681
+ "slug",
682
+ "published",
683
+ "rel_canonical",
684
+ {
685
+ "location_ids": []
686
+ },
687
+ {
688
+ "product_ids": []
689
+ },
690
+ "published_at"
691
+ ]
395
692
  },
396
693
  {
397
694
  "action": "show",
398
695
  "verb": "GET",
399
- "path": "/2026-07-02/posts/:id"
696
+ "path": "/2026-07-02/posts/:id",
697
+ "scope": "website:read"
698
+ },
699
+ {
700
+ "action": "update",
701
+ "verb": "PATCH",
702
+ "path": "/2026-07-02/posts/:id",
703
+ "scope": "website:write",
704
+ "params": [
705
+ "title",
706
+ "body",
707
+ "slug",
708
+ "published",
709
+ "rel_canonical",
710
+ {
711
+ "location_ids": []
712
+ },
713
+ {
714
+ "product_ids": []
715
+ },
716
+ "published_at"
717
+ ]
718
+ },
719
+ {
720
+ "action": "destroy",
721
+ "verb": "DELETE",
722
+ "path": "/2026-07-02/posts/:id",
723
+ "scope": "website:write"
400
724
  }
401
725
  ],
402
- "instructor_groups": [
726
+ "staff_teams": [
403
727
  {
404
728
  "action": "index",
405
729
  "verb": "GET",
406
- "path": "/2026-07-02/instructor_groups"
730
+ "path": "/2026-07-02/staff_teams",
731
+ "scope": "website:read"
732
+ },
733
+ {
734
+ "action": "create",
735
+ "verb": "POST",
736
+ "path": "/2026-07-02/staff_teams",
737
+ "scope": "website:write",
738
+ "params": [
739
+ "name",
740
+ "location_id",
741
+ "position"
742
+ ]
407
743
  },
408
744
  {
409
745
  "action": "show",
410
746
  "verb": "GET",
411
- "path": "/2026-07-02/instructor_groups/:id"
747
+ "path": "/2026-07-02/staff_teams/:id",
748
+ "scope": "website:read"
749
+ },
750
+ {
751
+ "action": "update",
752
+ "verb": "PATCH",
753
+ "path": "/2026-07-02/staff_teams/:id",
754
+ "scope": "website:write",
755
+ "params": [
756
+ "name",
757
+ "location_id",
758
+ "position"
759
+ ]
760
+ },
761
+ {
762
+ "action": "destroy",
763
+ "verb": "DELETE",
764
+ "path": "/2026-07-02/staff_teams/:id",
765
+ "scope": "website:write"
412
766
  }
413
767
  ]
414
768
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: keinaufwand
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Codegestalt