kit-rb 0.1.0 → 0.3.0

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.githooks/pre-commit +21 -0
  3. data/.githooks/pre-push +6 -0
  4. data/CHANGELOG.md +83 -0
  5. data/README.md +58 -16
  6. data/docs/DESIGN.md +38 -14
  7. data/docs/TASKS.md +47 -0
  8. data/lib/kit/auth/api_key.rb +7 -0
  9. data/lib/kit/auth/credential.rb +22 -0
  10. data/lib/kit/auth/oauth.rb +7 -8
  11. data/lib/kit/connection.rb +53 -20
  12. data/lib/kit/errors.rb +52 -15
  13. data/lib/kit/oauth/token.rb +9 -0
  14. data/lib/kit/objects/account.rb +44 -3
  15. data/lib/kit/objects/broadcast_click.rb +17 -0
  16. data/lib/kit/objects/broadcast_stats.rb +30 -0
  17. data/lib/kit/objects/bulk_result.rb +39 -0
  18. data/lib/kit/objects/custom_field.rb +4 -2
  19. data/lib/kit/objects/email_stats.rb +25 -0
  20. data/lib/kit/objects/growth_stats.rb +20 -0
  21. data/lib/kit/objects/post.rb +4 -2
  22. data/lib/kit/objects/sequence_email.rb +5 -2
  23. data/lib/kit/objects/subscriber.rb +16 -9
  24. data/lib/kit/objects/subscriber_stats.rb +26 -0
  25. data/lib/kit/objects/tag.rb +5 -3
  26. data/lib/kit/objects/webhook_endpoint.rb +7 -2
  27. data/lib/kit/pagination.rb +47 -3
  28. data/lib/kit/resources/account.rb +9 -8
  29. data/lib/kit/resources/base.rb +46 -4
  30. data/lib/kit/resources/broadcasts.rb +39 -16
  31. data/lib/kit/resources/bulk.rb +18 -20
  32. data/lib/kit/resources/custom_fields.rb +2 -2
  33. data/lib/kit/resources/forms.rb +3 -3
  34. data/lib/kit/resources/posts.rb +1 -1
  35. data/lib/kit/resources/purchases.rb +10 -6
  36. data/lib/kit/resources/sequences.rb +49 -25
  37. data/lib/kit/resources/snippets.rb +13 -8
  38. data/lib/kit/resources/subscribers.rb +24 -11
  39. data/lib/kit/resources/tags.rb +6 -6
  40. data/lib/kit/resources/webhook_endpoints.rb +12 -4
  41. data/lib/kit/resources/webhooks.rb +1 -1
  42. data/lib/kit/version.rb +1 -1
  43. data/lib/kit/webhooks/delivery.rb +61 -0
  44. data/lib/kit/webhooks/events.rb +113 -0
  45. data/lib/kit/webhooks/signature.rb +100 -0
  46. data/lib/kit-rb.rb +10 -1
  47. data/sig/kit-rb.rbs +240 -37
  48. metadata +16 -2
  49. data/lib/kit/objects/raw.rb +0 -12
data/sig/kit-rb.rbs CHANGED
@@ -1,22 +1,35 @@
1
- # RBS type signatures for the public surface of kit-rb (P0: account slice).
2
- # Expanded per-resource as coverage grows in P1/P2.
1
+ # RBS type signatures for the public surface of kit-rb, checked by Steep
2
+ # (`bundle exec rake steep`). Keep in step with lib/.
3
3
 
4
4
  module Kit
5
5
  VERSION: String
6
6
  DEFAULT_BASE_URL: String
7
7
 
8
8
  class Error < StandardError
9
+ STATUS_CLASSES: Hash[Integer, singleton(APIError)]
9
10
  def self.class_for: (Integer status) -> singleton(APIError)
10
11
  end
11
12
  class ConfigurationError < Error
12
13
  end
14
+ class TransportError < Error
15
+ end
16
+ class TimeoutError < TransportError
17
+ end
18
+ class ConnectionError < TransportError
19
+ end
20
+ class UnexpectedResponseError < Error
21
+ attr_reader body: untyped
22
+ def initialize: (String message, ?body: untyped) -> void
23
+ end
13
24
 
14
25
  class APIError < Error
15
26
  attr_reader status: Integer
16
27
  attr_reader body: untyped
17
28
  attr_reader errors: Array[untyped]
18
29
  attr_reader response: untyped
19
- def initialize: (?String? message, status: Integer, ?body: untyped, ?response: untyped) -> void
30
+ attr_reader method: Symbol?
31
+ attr_reader path: String?
32
+ def initialize: (?String? message, status: Integer, ?body: untyped, ?response: untyped, ?method: Symbol?, ?path: String?) -> void
20
33
  end
21
34
  class AuthenticationError < APIError
22
35
  end
@@ -24,11 +37,15 @@ module Kit
24
37
  end
25
38
  class NotFoundError < APIError
26
39
  end
40
+ class ConflictError < APIError
41
+ end
42
+ class PayloadTooLargeError < APIError
43
+ end
27
44
  class UnprocessableEntityError < APIError
28
45
  end
29
46
  class RateLimitError < APIError
30
47
  attr_reader retry_after: Integer?
31
- def initialize: (?String? message, status: Integer, ?body: untyped, ?response: untyped, ?retry_after: Integer?) -> void
48
+ def initialize: (?String? message, status: Integer, ?body: untyped, ?response: untyped, ?method: Symbol?, ?path: String?, ?retry_after: Integer?) -> void
32
49
  end
33
50
  class ServerError < APIError
34
51
  end
@@ -57,6 +74,8 @@ module Kit
57
74
  attr_reader scope: String?
58
75
  attr_reader created_at: Integer?
59
76
  def self.from: (Hash[String, untyped] hash) -> Token
77
+ def inspect: () -> String
78
+ def to_s: () -> String
60
79
  def expires_at: () -> Integer?
61
80
  def expired?: (?now: Integer, ?leeway: Integer) -> bool
62
81
  end
@@ -72,18 +91,70 @@ module Kit
72
91
  end
73
92
  end
74
93
 
94
+ module Webhooks
95
+ class SignatureError < Error
96
+ end
97
+ module Signature
98
+ HEADER: String
99
+ SCHEME: String
100
+ DEFAULT_TOLERANCE: Integer
101
+ class Parsed
102
+ attr_reader timestamp: Integer
103
+ attr_reader signatures: Array[String]
104
+ end
105
+ def self.compute: (String secret, Integer | String timestamp, String payload) -> String
106
+ def self.parse: (String? header) -> Parsed
107
+ def self.verify?: (String payload, String? header, secret: String | Array[String], ?tolerance: Integer?, ?now: Integer) -> bool
108
+ def self.verify!: (String payload, String? header, secret: String | Array[String], ?tolerance: Integer?, ?now: Integer) -> bool
109
+ end
110
+ class Event
111
+ attr_reader id: String?
112
+ attr_reader type: String?
113
+ attr_reader created: String?
114
+ attr_reader data: Hash[String, untyped]
115
+ def self.from: (Hash[String, untyped] hash) -> Event
116
+ end
117
+ module Events
118
+ DATA_KEYS: Hash[String, Array[String]]
119
+ PLANNED: Array[String]
120
+ ALL: Array[String]
121
+ AVAILABLE: Array[String]
122
+ end
123
+ module LegacyEvents
124
+ REQUIRED_PARAM: Hash[String, Symbol]
125
+ ALL: Array[String]
126
+ end
127
+ DELIVERY_HEADER: String
128
+ class Delivery
129
+ attr_reader delivery_id: Integer?
130
+ attr_reader events: Array[Event]
131
+ def self.from: (Hash[String, untyped] hash) -> Delivery
132
+ def self.parse: (String payload) -> Delivery
133
+ def self.from_request: (String payload, String? signature_header, secret: String | Array[String], ?tolerance: Integer?, ?now: Integer) -> Delivery
134
+ def type: () -> String?
135
+ end
136
+ end
137
+
75
138
  module Auth
139
+ module Credential
140
+ MASK: String
141
+ VISIBLE: Integer
142
+ def self.mask: (untyped secret) -> String
143
+ end
144
+
76
145
  class ApiKey
77
146
  HEADER: String
78
147
  def initialize: (String key) -> void
79
148
  def headers: () -> Hash[String, String]
149
+ def inspect: () -> String
150
+ def to_s: () -> String
80
151
  end
81
152
 
82
153
  class OAuth
83
- AUTHORIZE_URL: String
84
- TOKEN_URL: String
85
154
  def initialize: (String access_token) -> void
86
155
  def headers: () -> Hash[String, String]
156
+ def inspect: () -> String
157
+ def to_s: () -> String
87
158
  end
88
159
  end
89
160
 
@@ -100,9 +171,12 @@ module Kit
100
171
 
101
172
  class Connection
102
173
  JSON_TYPE: String
103
- RETRYABLE: Array[singleton(APIError)]
174
+ RETRYABLE: Array[singleton(Error)]
175
+ IDEMPOTENT: Array[Symbol]
104
176
  def initialize: (Configuration config) -> void
105
177
  def request: (Symbol method, String path, ?params: Hash[untyped, untyped], ?body: Hash[untyped, untyped]?) -> untyped
178
+ def request_with_status: (Symbol method, String path, ?params: Hash[untyped, untyped], ?body: Hash[untyped, untyped]?) -> [Integer, untyped]
179
+ def inspect: () -> String
106
180
  end
107
181
 
108
182
  class Pagination
@@ -111,11 +185,20 @@ module Kit
111
185
  attr_reader start_cursor: String?
112
186
  attr_reader end_cursor: String?
113
187
  attr_reader per_page: Integer?
188
+ attr_reader total_count: Integer?
114
189
  def self.from: (Hash[String, untyped] hash) -> Pagination
115
190
  end
116
191
 
117
192
  class Collection[T]
118
193
  include Enumerable[T]
194
+ FIRST_PAGE_ONLY: Array[Symbol]
195
+ def self.next_page_params: (Hash[Symbol, untyped] params, String? after) -> Hash[Symbol, untyped]
196
+ def total_count: () -> Integer?
197
+ def size: () -> Integer
198
+ def length: () -> Integer
199
+ def empty?: () -> bool
200
+ def []: (Integer index) -> T?
201
+ def inspect: () -> String
119
202
  attr_reader data: Array[T]
120
203
  attr_reader pagination: Pagination
121
204
  def initialize: (data: Array[T], pagination: Pagination) { (String end_cursor) -> Collection[T] } -> void
@@ -126,20 +209,45 @@ module Kit
126
209
  end
127
210
 
128
211
  module Objects
129
- module Raw
130
- def self.from: (Hash[String, untyped] hash) -> Hash[String, untyped]
131
- end
132
212
  class User
133
213
  attr_reader email: String?
134
214
  attr_reader id: Integer?
135
215
  def self.from: (Hash[String, untyped] hash) -> User
136
216
  end
217
+ class Timezone
218
+ attr_reader name: String?
219
+ attr_reader friendly_name: String?
220
+ attr_reader utc_offset: String?
221
+ def self.from: (Hash[String, untyped] hash) -> Timezone
222
+ end
223
+ class Plan
224
+ attr_reader plan_type: String?
225
+ attr_reader interval: String?
226
+ attr_reader subscriber_limit: Integer?
227
+ attr_reader on_trial: bool?
228
+ attr_reader trial_lapse_date: String?
229
+ attr_reader renews_at: String?
230
+ attr_reader cancels_at: String?
231
+ def self.from: (Hash[String, untyped] hash) -> Plan
232
+ end
233
+ class SendingAddress
234
+ attr_reader email_address: String?
235
+ attr_reader from_name: String?
236
+ attr_reader status: String?
237
+ attr_reader is_default: bool?
238
+ attr_reader is_verified: bool?
239
+ attr_reader is_dmarc_configured: bool?
240
+ def self.from: (Hash[String, untyped] hash) -> SendingAddress
241
+ end
137
242
  class Account
138
243
  attr_reader id: Integer?
139
244
  attr_reader name: String?
140
245
  attr_reader plan_type: String?
141
246
  attr_reader primary_email_address: String?
142
247
  attr_reader created_at: String?
248
+ attr_reader timezone: Timezone?
249
+ attr_reader plan: Plan?
250
+ attr_reader sending_addresses: Array[SendingAddress]
143
251
  def self.from: (Hash[String, untyped] hash) -> Account
144
252
  end
145
253
  class AccountInfo
@@ -160,6 +268,7 @@ module Kit
160
268
  attr_reader name: String?
161
269
  attr_reader created_at: String?
162
270
  attr_reader subscriber_count: Integer?
271
+ attr_reader tagged_at: String?
163
272
  def self.from: (Hash[String, untyped] hash) -> Tag
164
273
  end
165
274
  class CustomField
@@ -167,6 +276,7 @@ module Kit
167
276
  attr_reader name: String?
168
277
  attr_reader key: String?
169
278
  attr_reader label: String?
279
+ attr_reader created_at: String?
170
280
  def self.from: (Hash[String, untyped] hash) -> CustomField
171
281
  end
172
282
  class Form
@@ -239,6 +349,7 @@ module Kit
239
349
  attr_reader created_by_app: untyped
240
350
  attr_reader created_at: String?
241
351
  attr_reader previous_secret_expires_at: String?
352
+ attr_reader secret: String?
242
353
  def self.from: (Hash[String, untyped] hash) -> WebhookEndpoint
243
354
  end
244
355
  class EmailTemplate
@@ -269,6 +380,7 @@ module Kit
269
380
  attr_reader thumbnail_url: String?
270
381
  attr_reader is_paid: bool?
271
382
  attr_reader public_url: String?
383
+ attr_reader content: String?
272
384
  def self.from: (Hash[String, untyped] hash) -> Post
273
385
  end
274
386
  class Snippet
@@ -283,6 +395,19 @@ module Kit
283
395
  attr_reader document: untyped
284
396
  def self.from: (Hash[String, untyped] hash) -> Snippet
285
397
  end
398
+ class BulkFailure
399
+ attr_reader item: untyped
400
+ attr_reader errors: Array[String]
401
+ def self.from: (Hash[String, untyped] hash) -> BulkFailure
402
+ end
403
+ class BulkResult
404
+ attr_reader items: Array[Hash[String, untyped]]
405
+ attr_reader failures: Array[BulkFailure]
406
+ attr_reader async: bool
407
+ def self.from: (Integer status, untyped body, String? key) -> BulkResult
408
+ def async?: () -> bool
409
+ def success?: () -> bool
410
+ end
286
411
  class Purchase
287
412
  attr_reader id: Integer?
288
413
  attr_reader transaction_id: String?
@@ -312,8 +437,74 @@ module Kit
312
437
  attr_reader delay_unit: String?
313
438
  attr_reader send_days: Array[untyped]?
314
439
  attr_reader stats: Hash[String, untyped]?
440
+ attr_reader content: String?
315
441
  def self.from: (Hash[String, untyped] hash) -> SequenceEmail
316
442
  end
443
+ class BroadcastStats
444
+ attr_reader id: Integer?
445
+ attr_reader subject: String?
446
+ attr_reader send_at: String?
447
+ attr_reader recipients: Integer?
448
+ attr_reader open_rate: Numeric?
449
+ attr_reader emails_opened: Integer?
450
+ attr_reader click_rate: Numeric?
451
+ attr_reader unsubscribe_rate: Numeric?
452
+ attr_reader unsubscribes: Integer?
453
+ attr_reader total_clicks: Integer?
454
+ attr_reader show_total_clicks: bool?
455
+ attr_reader status: String?
456
+ attr_reader progress: Numeric?
457
+ attr_reader open_tracking_disabled: bool?
458
+ attr_reader click_tracking_disabled: bool?
459
+ def self.from: (Hash[String, untyped] hash) -> BroadcastStats
460
+ end
461
+ class BroadcastClick
462
+ attr_reader id: Integer?
463
+ attr_reader url: String?
464
+ attr_reader unique_clicks: Integer?
465
+ attr_reader click_to_delivery_rate: Numeric?
466
+ attr_reader click_to_open_rate: Numeric?
467
+ def self.from: (Hash[String, untyped] hash) -> BroadcastClick
468
+ end
469
+ class SubscriberStats
470
+ attr_reader id: Integer?
471
+ attr_reader sent: Integer?
472
+ attr_reader opened: Integer?
473
+ attr_reader clicked: Integer?
474
+ attr_reader bounced: Integer?
475
+ attr_reader open_rate: Numeric?
476
+ attr_reader click_rate: Numeric?
477
+ attr_reader last_sent: String?
478
+ attr_reader last_opened: String?
479
+ attr_reader last_clicked: String?
480
+ attr_reader sends_since_last_open: Integer?
481
+ attr_reader sends_since_last_click: Integer?
482
+ def self.from: (Hash[String, untyped] hash) -> SubscriberStats
483
+ end
484
+ class EmailStats
485
+ attr_reader sent: Integer?
486
+ attr_reader clicked: Integer?
487
+ attr_reader opened: Integer?
488
+ attr_reader email_stats_mode: String?
489
+ attr_reader open_tracking_enabled: bool?
490
+ attr_reader click_tracking_enabled: bool?
491
+ attr_reader starting: String?
492
+ attr_reader ending: String?
493
+ attr_reader open_rate: Numeric?
494
+ attr_reader click_rate: Numeric?
495
+ attr_reader unsubscribe_rate: Numeric?
496
+ attr_reader bounce_rate: Numeric?
497
+ def self.from: (Hash[String, untyped] hash) -> EmailStats
498
+ end
499
+ class GrowthStats
500
+ attr_reader cancellations: Integer?
501
+ attr_reader net_new_subscribers: Integer?
502
+ attr_reader new_subscribers: Integer?
503
+ attr_reader subscribers: Integer?
504
+ attr_reader starting: String?
505
+ attr_reader ending: String?
506
+ def self.from: (Hash[String, untyped] hash) -> GrowthStats
507
+ end
317
508
  class Subscriber
318
509
  attr_reader id: Integer?
319
510
  attr_reader first_name: String?
@@ -323,12 +514,22 @@ module Kit
323
514
  attr_reader canceled_at: String?
324
515
  attr_reader location: Hash[String, untyped]?
325
516
  attr_reader fields: Hash[String, untyped]?
517
+ attr_reader added_at: String?
518
+ attr_reader tagged_at: String?
519
+ attr_reader referrer: String?
520
+ attr_reader referrer_utm_parameters: Hash[String, untyped]?
521
+ attr_reader attribution: Hash[String, untyped]?
522
+ attr_reader tags: Array[Hash[String, untyped]]?
523
+ attr_reader tag_names: Array[String]?
524
+ attr_reader tag_ids: Array[Integer]?
525
+ attr_reader stats: Hash[String, untyped]?
326
526
  def self.from: (Hash[String, untyped] hash) -> Subscriber
327
527
  end
328
528
  end
329
529
 
330
530
  module Resources
331
531
  class Base
532
+ OMIT: Object
332
533
  def initialize: (Connection connection) -> void
333
534
  end
334
535
  class Account < Base
@@ -336,19 +537,20 @@ module Kit
336
537
  def colors: () -> Array[String]
337
538
  def update_colors: (Array[String] colors) -> Array[String]
338
539
  def creator_profile: () -> Objects::CreatorProfile
339
- def email_stats: () -> Hash[String, untyped]
340
- def growth_stats: (**untyped params) -> Hash[String, untyped]
540
+ def email_stats: () -> Objects::EmailStats
541
+ def growth_stats: (**untyped params) -> Objects::GrowthStats
341
542
  end
342
543
  class Subscribers < Base
343
544
  def list: (**untyped params) -> Collection[Objects::Subscriber]
344
545
  def get: (Integer id) -> Objects::Subscriber
345
546
  def create: (email_address: String, ?first_name: String?, ?state: String?, ?fields: Hash[untyped, untyped]?) -> Objects::Subscriber
346
547
  def update: (Integer id, ?first_name: String?, ?email_address: String?, ?fields: Hash[untyped, untyped]?) -> Objects::Subscriber
347
- def unsubscribe: (Integer id) -> Objects::Subscriber
548
+ def unsubscribe: (Integer id) -> Objects::Subscriber?
348
549
  def filter: (**untyped params) -> Collection[Objects::Subscriber]
349
550
  def tags: (Integer id, **untyped params) -> Collection[Objects::Tag]
350
- def stats: (Integer id) -> Hash[String, untyped]
551
+ def stats: (Integer id, ?email_sent_after: String?, ?email_sent_before: String?) -> Objects::SubscriberStats
351
552
  def set_location: (Integer id, location: Hash[untyped, untyped]) -> Objects::Subscriber
553
+ def update_location: (Integer id, location: Hash[untyped, untyped]) -> Objects::Subscriber
352
554
  def remove_location: (Integer id) -> void
353
555
  end
354
556
  class Tags < Base
@@ -375,28 +577,28 @@ module Kit
375
577
  end
376
578
  class Sequences < Base
377
579
  def list: (**untyped params) -> Collection[Objects::Sequence]
378
- def get: (Integer id) -> Objects::Sequence
379
- def create: (name: String, **untyped attributes) -> Objects::Sequence
380
- def update: (Integer id, **untyped attributes) -> Objects::Sequence
580
+ def get: (Integer id, ?include: String?) -> Objects::Sequence
581
+ def create: (name: String, ?email_address: String?, ?email_template_id: Integer?, ?send_days: Array[String]?, ?send_hour: Integer?, ?time_zone: String?, ?active: bool?, ?repeat: bool?, ?hold: bool?, ?exclude_subscriber_sources: Array[Hash[Symbol | String, untyped]]?) -> Objects::Sequence
582
+ def update: (Integer id, ?name: String?, ?email_address: String?, ?email_template_id: Integer?, ?send_days: Array[String]?, ?send_hour: Integer?, ?time_zone: String?, ?active: bool?, ?repeat: bool?, ?hold: bool?, ?exclude_subscriber_sources: Array[Hash[Symbol | String, untyped]]?) -> Objects::Sequence
381
583
  def delete: (Integer id) -> void
382
584
  def subscribers: (Integer sequence_id, **untyped params) -> Collection[Objects::Subscriber]
383
585
  def add_subscriber: (Integer sequence_id, Integer subscriber_id) -> Objects::Subscriber
384
586
  def add_subscriber_by_email: (Integer sequence_id, email_address: String) -> Objects::Subscriber
385
587
  def emails: (Integer sequence_id, **untyped params) -> Collection[Objects::SequenceEmail]
386
- def email: (Integer sequence_id, Integer id) -> Objects::SequenceEmail
387
- def create_email: (Integer sequence_id, **untyped attributes) -> Objects::SequenceEmail
388
- def update_email: (Integer sequence_id, Integer id, **untyped attributes) -> Objects::SequenceEmail
588
+ def email: (Integer sequence_id, Integer id, ?include: String?) -> Objects::SequenceEmail
589
+ def create_email: (Integer sequence_id, subject: String, delay_value: Integer, delay_unit: String, ?preview_text: String?, ?content: String?, ?email_template_id: Integer?, ?published: bool?, ?send_days: Array[String]?, ?position: Integer?) -> Objects::SequenceEmail
590
+ def update_email: (Integer sequence_id, Integer id, ?subject: String?, ?delay_value: Integer?, ?delay_unit: String?, ?preview_text: String?, ?content: String?, ?email_template_id: Integer?, ?published: bool?, ?send_days: Array[String]?, ?position: Integer?) -> Objects::SequenceEmail
389
591
  def delete_email: (Integer sequence_id, Integer id) -> void
390
592
  end
391
593
  class Broadcasts < Base
392
594
  def list: (**untyped params) -> Collection[Objects::Broadcast]
393
595
  def get: (Integer id) -> Objects::Broadcast
394
- def create: (**untyped attributes) -> Objects::Broadcast
395
- def update: (Integer id, **untyped attributes) -> Objects::Broadcast
596
+ def create: (?subject: String?, ?preview_text: String?, ?content: String?, ?description: String?, ?public: bool?, ?published_at: String?, ?send_at: String?, ?email_address: String?, ?email_template_id: Integer?, ?thumbnail_alt: String?, ?thumbnail_url: String?, ?subscriber_filter: Array[Hash[Symbol | String, untyped]]?) -> Objects::Broadcast
597
+ def update: (Integer id, ?subject: String?, ?preview_text: String?, ?content: String?, ?description: String?, ?public: bool?, ?published_at: String?, ?send_at: String?, ?email_address: String?, ?email_template_id: Integer?, ?thumbnail_alt: String?, ?thumbnail_url: String?, ?subscriber_filter: Array[Hash[Symbol | String, untyped]]?) -> Objects::Broadcast
396
598
  def delete: (Integer id) -> void
397
- def stats_list: (**untyped params) -> Collection[Hash[String, untyped]]
398
- def stats: (Integer id) -> Hash[String, untyped]
399
- def clicks: (Integer id, **untyped params) -> Hash[String, untyped]
599
+ def stats_list: (**untyped params) -> Collection[Objects::BroadcastStats]
600
+ def stats: (Integer id) -> Objects::BroadcastStats
601
+ def clicks: (Integer id, **untyped params) -> Collection[Objects::BroadcastClick]
400
602
  end
401
603
  class EmailTemplates < Base
402
604
  def list: (**untyped params) -> Collection[Objects::EmailTemplate]
@@ -408,23 +610,23 @@ module Kit
408
610
  class Purchases < Base
409
611
  def list: (**untyped params) -> Collection[Objects::Purchase]
410
612
  def get: (Integer id) -> Objects::Purchase
411
- def create: (**untyped attributes) -> Objects::Purchase
613
+ def create: (email_address: String, transaction_id: String, status: String, currency: String, ?transaction_time: String?, ?subtotal: Numeric?, ?tax: Numeric?, ?shipping: Numeric?, ?discount: Numeric?, ?total: Numeric?, ?products: Array[Hash[Symbol | String, untyped]]?) -> Objects::Purchase
412
614
  end
413
615
  class Bulk < Base
414
- def create_subscribers: (Array[untyped] subscribers, ?callback_url: String?) -> Hash[String, untyped]
415
- def create_custom_fields: (Array[untyped] custom_fields, ?callback_url: String?) -> Hash[String, untyped]
416
- def update_custom_field_values: (Array[untyped] custom_field_values, ?callback_url: String?) -> Hash[String, untyped]
417
- def add_subscribers_to_forms: (Array[untyped] additions, ?callback_url: String?) -> Hash[String, untyped]
418
- def create_tags: (Array[untyped] tags, ?callback_url: String?) -> Hash[String, untyped]
419
- def delete_tags: (Array[untyped] tags, ?callback_url: String?) -> Hash[String, untyped]
420
- def tag_subscribers: (Array[untyped] taggings, ?callback_url: String?) -> Hash[String, untyped]
421
- def remove_tag_subscribers: (Array[untyped] taggings, ?callback_url: String?) -> Hash[String, untyped]
616
+ def create_subscribers: (Array[untyped] subscribers, ?callback_url: String?) -> Objects::BulkResult
617
+ def create_custom_fields: (Array[untyped] custom_fields, ?callback_url: String?) -> Objects::BulkResult
618
+ def update_custom_field_values: (Array[untyped] custom_field_values, ?callback_url: String?) -> Objects::BulkResult
619
+ def add_subscribers_to_forms: (Array[untyped] additions, ?callback_url: String?) -> Objects::BulkResult
620
+ def create_tags: (Array[untyped] tags, ?callback_url: String?) -> Objects::BulkResult
621
+ def delete_tags: (Array[untyped] tags, ?callback_url: String?) -> Objects::BulkResult
622
+ def tag_subscribers: (Array[untyped] taggings, ?callback_url: String?) -> Objects::BulkResult
623
+ def remove_tag_subscribers: (Array[untyped] taggings, ?callback_url: String?) -> Objects::BulkResult
422
624
  end
423
625
  class Snippets < Base
424
626
  def list: (**untyped params) -> Collection[Objects::Snippet]
425
627
  def get: (Integer id) -> Objects::Snippet
426
- def create: (**untyped attributes) -> Objects::Snippet
427
- def update: (Integer id, **untyped attributes) -> Objects::Snippet
628
+ def create: (name: String, snippet_type: String, ?content: String?, ?document_attributes: Hash[Symbol | String, untyped]?) -> Objects::Snippet
629
+ def update: (Integer id, ?name: String?, ?archived: bool?, ?content: String?, ?document_attributes: Hash[Symbol | String, untyped]?) -> Objects::Snippet
428
630
  end
429
631
  class Segments < Base
430
632
  def list: (**untyped params) -> Collection[Objects::Segment]
@@ -438,6 +640,7 @@ module Kit
438
640
  def list: (**untyped params) -> Collection[Objects::WebhookEndpoint]
439
641
  def get: (Integer id) -> Objects::WebhookEndpoint
440
642
  def create: (url: String, events: Array[untyped], ?name: String?, ?description: String?) -> Objects::WebhookEndpoint
643
+ def update: (Integer id, ?name: String?, ?url: String?, ?description: String?, ?status: String?, ?events: Array[String]?) -> Objects::WebhookEndpoint
441
644
  def delete: (Integer id) -> void
442
645
  def rotate_secret: (Integer id, ?force: bool?) -> Objects::WebhookEndpoint
443
646
  def revoke_previous_secret: (Integer id) -> Objects::WebhookEndpoint
@@ -446,7 +649,7 @@ module Kit
446
649
 
447
650
  class Client
448
651
  attr_reader config: Configuration
449
- def initialize: (?api_key: String?, ?access_token: String?, **untyped options) -> void
652
+ def initialize: (?api_key: String?, ?access_token: String?, ?base_url: String, ?open_timeout: Integer, ?read_timeout: Integer, ?max_retries: Integer, ?retry_backoff: Float, ?max_backoff: Numeric) -> void
450
653
  def account: () -> Resources::Account
451
654
  def subscribers: () -> Resources::Subscribers
452
655
  def tags: () -> Resources::Tags
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kit-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lawrence Lin
@@ -31,14 +31,18 @@ executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []
33
33
  files:
34
+ - ".githooks/pre-commit"
35
+ - ".githooks/pre-push"
34
36
  - CHANGELOG.md
35
37
  - LICENSE.txt
36
38
  - README.md
37
39
  - Rakefile
38
40
  - Steepfile
39
41
  - docs/DESIGN.md
42
+ - docs/TASKS.md
40
43
  - lib/kit-rb.rb
41
44
  - lib/kit/auth/api_key.rb
45
+ - lib/kit/auth/credential.rb
42
46
  - lib/kit/auth/oauth.rb
43
47
  - lib/kit/client.rb
44
48
  - lib/kit/configuration.rb
@@ -49,18 +53,23 @@ files:
49
53
  - lib/kit/oauth/token.rb
50
54
  - lib/kit/objects/account.rb
51
55
  - lib/kit/objects/broadcast.rb
56
+ - lib/kit/objects/broadcast_click.rb
57
+ - lib/kit/objects/broadcast_stats.rb
58
+ - lib/kit/objects/bulk_result.rb
52
59
  - lib/kit/objects/creator_profile.rb
53
60
  - lib/kit/objects/custom_field.rb
61
+ - lib/kit/objects/email_stats.rb
54
62
  - lib/kit/objects/email_template.rb
55
63
  - lib/kit/objects/form.rb
64
+ - lib/kit/objects/growth_stats.rb
56
65
  - lib/kit/objects/post.rb
57
66
  - lib/kit/objects/purchase.rb
58
- - lib/kit/objects/raw.rb
59
67
  - lib/kit/objects/segment.rb
60
68
  - lib/kit/objects/sequence.rb
61
69
  - lib/kit/objects/sequence_email.rb
62
70
  - lib/kit/objects/snippet.rb
63
71
  - lib/kit/objects/subscriber.rb
72
+ - lib/kit/objects/subscriber_stats.rb
64
73
  - lib/kit/objects/tag.rb
65
74
  - lib/kit/objects/webhook.rb
66
75
  - lib/kit/objects/webhook_endpoint.rb
@@ -82,6 +91,9 @@ files:
82
91
  - lib/kit/resources/webhook_endpoints.rb
83
92
  - lib/kit/resources/webhooks.rb
84
93
  - lib/kit/version.rb
94
+ - lib/kit/webhooks/delivery.rb
95
+ - lib/kit/webhooks/events.rb
96
+ - lib/kit/webhooks/signature.rb
85
97
  - sig/kit-rb.rbs
86
98
  homepage: https://github.com/linyiru/kit-rb
87
99
  licenses:
@@ -90,6 +102,8 @@ metadata:
90
102
  homepage_uri: https://github.com/linyiru/kit-rb
91
103
  source_code_uri: https://github.com/linyiru/kit-rb
92
104
  changelog_uri: https://github.com/linyiru/kit-rb/blob/main/CHANGELOG.md
105
+ bug_tracker_uri: https://github.com/linyiru/kit-rb/issues
106
+ documentation_uri: https://github.com/linyiru/kit-rb#readme
93
107
  rubygems_mfa_required: 'true'
94
108
  rdoc_options: []
95
109
  require_paths:
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Kit
4
- module Objects
5
- # Identity "object" for endpoints that return plain analytics hashes rather
6
- # than a modelled resource (e.g. the broadcast-stats list). Lets those lists
7
- # flow through Base#collection unchanged while keeping .from uniform.
8
- module Raw
9
- def self.from(hash) = hash
10
- end
11
- end
12
- end