jobcelis 1.0.0 → 1.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f5e335df49a6f6251dc82ca2884ce9cfa1541ef94fe9936c19344069c1bf68f5
4
- data.tar.gz: a1dcc32aa94793cc608150b7533fec44fd4117f11224c8e389459529da2153c3
3
+ metadata.gz: 18652c3d3993f4f15832f5f1cce9237793ed75f386a10c7e832fd31c8df77172
4
+ data.tar.gz: 64a8e07040230289c044b229f209f390623bc35a0a0b49320c6dc49ce55f0475
5
5
  SHA512:
6
- metadata.gz: 20cb85eba443c66a9e28f6a13587803096a852c00faa66167e51810d8c55b375f29b5c4a1d6a591c29a3e40ed02ad33d160db9b40608f01a22fe20dd510f827b
7
- data.tar.gz: 0e1fdb03d0370f9e7903d58475ef8cd77fc995ae3e52f54da3adbeff0b6f5f65211bce5745cfab4e5b2ff7f2a31b44bd6aceced228799a8e5837e9f10c469171
6
+ metadata.gz: 2403be576993b276be7803e05e7b79043faac744628e5edd863ce9d7b67df78d811dd7543b85b52af38986514f0170b0273b4dc1c251b969c354eca5660cf73e
7
+ data.tar.gz: ab70d923ddd3c55aefda2b9d6b64d5e120e20e0e9adf6072b3913cba800308b9c4c3d0fd58cf502bee6923d4545e62718245c143422262d7f1c8207fe1d968ef
@@ -96,8 +96,10 @@ module Jobcelis
96
96
  # ------------------------------------------------------------------
97
97
 
98
98
  # Create a webhook.
99
- def create_webhook(url:, **kwargs)
100
- post("/api/v1/webhooks", { url: url, **kwargs })
99
+ def create_webhook(url:, rate_limit: nil, **kwargs)
100
+ body = { url: url, **kwargs }
101
+ body[:rate_limit] = rate_limit if rate_limit
102
+ post("/api/v1/webhooks", body)
101
103
  end
102
104
 
103
105
  # Get webhook details.
@@ -111,8 +113,10 @@ module Jobcelis
111
113
  end
112
114
 
113
115
  # Update a webhook.
114
- def update_webhook(webhook_id, **kwargs)
115
- patch("/api/v1/webhooks/#{webhook_id}", kwargs)
116
+ def update_webhook(webhook_id, rate_limit: nil, **kwargs)
117
+ body = { **kwargs }
118
+ body[:rate_limit] = rate_limit if rate_limit
119
+ patch("/api/v1/webhooks/#{webhook_id}", body)
116
120
  end
117
121
 
118
122
  # Deactivate a webhook.
@@ -130,6 +134,11 @@ module Jobcelis
130
134
  get("/api/v1/webhooks/templates")
131
135
  end
132
136
 
137
+ # Send a test delivery to a webhook.
138
+ def test_webhook(webhook_id)
139
+ post("/api/v1/webhooks/#{webhook_id}/test", {})
140
+ end
141
+
133
142
  # ------------------------------------------------------------------
134
143
  # Deliveries
135
144
  # ------------------------------------------------------------------
@@ -529,6 +538,73 @@ module Jobcelis
529
538
  do_delete("/api/v1/me/object")
530
539
  end
531
540
 
541
+ # ------------------------------------------------------------------
542
+ # Embed Tokens
543
+ # ------------------------------------------------------------------
544
+
545
+ # List embed tokens.
546
+ def list_embed_tokens
547
+ get("/api/v1/embed/tokens")
548
+ end
549
+
550
+ # Create an embed token.
551
+ def create_embed_token(config)
552
+ post("/api/v1/embed/tokens", config)
553
+ end
554
+
555
+ # Revoke an embed token.
556
+ def revoke_embed_token(id)
557
+ do_delete("/api/v1/embed/tokens/#{id}")
558
+ end
559
+
560
+ # ------------------------------------------------------------------
561
+ # Notification Channels
562
+ # ------------------------------------------------------------------
563
+
564
+ # Get the notification channel configuration.
565
+ def get_notification_channel
566
+ get("/api/v1/notification-channels")
567
+ end
568
+
569
+ # Create or update the notification channel configuration.
570
+ def upsert_notification_channel(config)
571
+ put("/api/v1/notification-channels", config)
572
+ end
573
+
574
+ # Delete the notification channel configuration.
575
+ def delete_notification_channel
576
+ do_delete("/api/v1/notification-channels")
577
+ end
578
+
579
+ # Test the notification channel configuration.
580
+ def test_notification_channel
581
+ post("/api/v1/notification-channels/test", {})
582
+ end
583
+
584
+ # ------------------------------------------------------------------
585
+ # Retention & Purge
586
+ # ------------------------------------------------------------------
587
+
588
+ # Get current retention policy.
589
+ def get_retention_policy
590
+ get("/api/v1/retention")
591
+ end
592
+
593
+ # Update retention policy.
594
+ def update_retention_policy(policy)
595
+ patch("/api/v1/retention", policy)
596
+ end
597
+
598
+ # Preview a purge operation.
599
+ def preview_purge(params)
600
+ post("/api/v1/purge/preview", params)
601
+ end
602
+
603
+ # Execute a purge operation.
604
+ def purge_data(params)
605
+ post("/api/v1/purge", params)
606
+ end
607
+
532
608
  # ------------------------------------------------------------------
533
609
  # Health
534
610
  # ------------------------------------------------------------------
@@ -561,6 +637,10 @@ module Jobcelis
561
637
  request("PATCH", path, body: body)
562
638
  end
563
639
 
640
+ def put(path, body)
641
+ request("PUT", path, body: body)
642
+ end
643
+
564
644
  def do_delete(path)
565
645
  request("DELETE", path)
566
646
  end
@@ -638,6 +718,7 @@ module Jobcelis
638
718
  when "GET" then Net::HTTP::Get.new(request_path)
639
719
  when "POST" then Net::HTTP::Post.new(request_path)
640
720
  when "PATCH" then Net::HTTP::Patch.new(request_path)
721
+ when "PUT" then Net::HTTP::Put.new(request_path)
641
722
  when "DELETE" then Net::HTTP::Delete.new(request_path)
642
723
  else raise ArgumentError, "Unsupported HTTP method: #{method}"
643
724
  end
@@ -1,20 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "openssl"
4
+ require "base64"
4
5
 
5
6
  module Jobcelis
6
7
  module WebhookVerifier
7
- # Verify a webhook signature using HMAC-SHA256.
8
+ # Verify a webhook signature using HMAC-SHA256 (Base64, no padding).
8
9
  #
9
10
  # @param secret [String] The webhook signing secret.
10
11
  # @param body [String] The raw request body.
11
- # @param signature [String] The signature from the X-Signature header.
12
+ # @param signature [String] The signature from the X-Signature header (format: "sha256=<base64>").
12
13
  # @return [Boolean] true if the signature is valid.
13
14
  def self.verify(secret:, body:, signature:)
14
- expected = OpenSSL::HMAC.hexdigest("SHA256", secret, body)
15
15
  return false if signature.nil? || signature.empty?
16
16
 
17
- OpenSSL.secure_compare(expected, signature)
17
+ prefix = "sha256="
18
+ return false unless signature.start_with?(prefix)
19
+
20
+ received_sig = signature[prefix.length..]
21
+ digest = OpenSSL::HMAC.digest("SHA256", secret, body)
22
+ expected = Base64.strict_encode64(digest).delete("=")
23
+
24
+ OpenSSL.secure_compare(expected, received_sig)
18
25
  end
19
26
  end
20
27
  end
data/lib/jobcelis.rb CHANGED
@@ -5,5 +5,5 @@ require_relative "jobcelis/webhook_verifier"
5
5
  require_relative "jobcelis/client"
6
6
 
7
7
  module Jobcelis
8
- VERSION = "1.0.0"
8
+ VERSION = "1.2.0"
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jobcelis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jobcelis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-03-07 00:00:00.000000000 Z
11
+ date: 2026-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-http
@@ -26,7 +26,7 @@ dependencies:
26
26
  version: '0'
27
27
  description: Ruby client for the Jobcelis API — events, webhooks, jobs, pipelines,
28
28
  and more. Connects to https://jobcelis.com by default.
29
- email: vladiceli6@gmail.com
29
+ email: support@jobcelis.com
30
30
  executables: []
31
31
  extensions: []
32
32
  extra_rdoc_files: []