sendly 3.15.1 → 3.15.3

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: ea3ee275f9fb56425c1b7ffe027686a5785039377e58b2660c39bf61b5b7095c
4
- data.tar.gz: 17e4c8c2ef09c8ff0a5041e4288e4661b17a0233714527b4dd07984c3142129b
3
+ metadata.gz: 30d293bb000beb6cf55425cf890c5d1a2aaf1763fd0924200208e64ece66a6aa
4
+ data.tar.gz: b497dc439fab212a7b672f34912164909863dd5e6f3914b33e83d40bded4ca0e
5
5
  SHA512:
6
- metadata.gz: ee401755db04ba02207013d53b552a6ad433b241a2d1594c82d49fedb0641dc327aedf9e9d5dc38732b8d4f41a90e96464c19717dc8b37d702bedc9fe9255522
7
- data.tar.gz: d7da1728cc53d0a111429683d3151bc891aa2a2fc74a7fc67b49e812b97eceaee3b85c59f4e5685b5d191b1c78966aca1f1677ba64ad90b86cb100309142678f
6
+ metadata.gz: 753b7db85a40604103a4036348b2f847328c2cb7bf7ce92614e032854350f6061500a2eaca36342f1245ffdb576441e4525577601a335e766e28ec12cc511a66
7
+ data.tar.gz: c53e4e96bfb502a62250f36852239398c572a2770103fa559d077089e4649d064cbeabd4b04e9acf87260975d99571b1cdd3290539743320be67831d1d00bc85
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sendly (3.15.1)
4
+ sendly (3.15.3)
5
5
  faraday (~> 2.0)
6
6
  faraday-retry (~> 2.0)
7
7
 
data/README.md CHANGED
@@ -108,6 +108,13 @@ message = client.messages.send(
108
108
  message_type: "transactional"
109
109
  )
110
110
 
111
+ # With custom metadata (max 4KB)
112
+ message = client.messages.send(
113
+ to: "+15551234567",
114
+ text: "Your order #12345 has shipped!",
115
+ metadata: { order_id: "12345", customer_id: "cust_abc" }
116
+ )
117
+
111
118
  puts message.id
112
119
  puts message.status
113
120
  puts message.credits_used
@@ -94,5 +94,15 @@ module Sendly
94
94
 
95
95
  @client.delete("/account/keys/#{key_id}")
96
96
  end
97
+
98
+ def transfer_credits(target_organization_id:, amount:)
99
+ raise ArgumentError, "Target organization ID is required" if target_organization_id.nil? || target_organization_id.empty?
100
+ raise ArgumentError, "Amount must be a positive integer" if !amount.is_a?(Integer) || amount <= 0
101
+
102
+ @client.post("/credits/transfer", {
103
+ targetOrganizationId: target_organization_id,
104
+ amount: amount
105
+ })
106
+ end
97
107
  end
98
108
  end
@@ -15,6 +15,7 @@ module Sendly
15
15
  # @param to [String] Recipient phone number in E.164 format
16
16
  # @param text [String] Message content (max 1600 characters)
17
17
  # @param message_type [String] Message type: "marketing" (default) or "transactional"
18
+ # @param metadata [Hash] Custom JSON metadata to attach to the message (max 4KB)
18
19
  # @return [Sendly::Message] The sent message
19
20
  #
20
21
  # @raise [Sendly::ValidationError] If parameters are invalid
@@ -130,6 +131,7 @@ module Sendly
130
131
  # @param scheduled_at [String] ISO 8601 datetime for when to send
131
132
  # @param from [String] Sender ID or phone number (optional)
132
133
  # @param message_type [String] Message type: "marketing" (default) or "transactional"
134
+ # @param metadata [Hash] Custom JSON metadata to attach to the message (max 4KB)
133
135
  # @return [Hash] The scheduled message
134
136
  #
135
137
  # @raise [Sendly::ValidationError] If parameters are invalid
@@ -214,6 +216,7 @@ module Sendly
214
216
  # @param messages [Array<Hash>] Array of messages with :to and :text keys
215
217
  # @param from [String] Sender ID or phone number (optional, applies to all)
216
218
  # @param message_type [String] Message type: "marketing" (default) or "transactional"
219
+ # @param metadata [Hash] Shared metadata for all messages (max 4KB). Each message can also have its own metadata hash which takes priority.
217
220
  # @return [Hash] Batch response with batch_id and status
218
221
  #
219
222
  # @raise [Sendly::ValidationError] If parameters are invalid
data/lib/sendly/types.rb CHANGED
@@ -51,6 +51,9 @@ module Sendly
51
51
  # @return [Time, nil] Delivery timestamp
52
52
  attr_reader :delivered_at
53
53
 
54
+ # @return [Hash, nil] Custom metadata attached to the message
55
+ attr_reader :metadata
56
+
54
57
  # Message status constants (sending removed - doesn't exist in database)
55
58
  STATUSES = %w[queued sent delivered failed bounced].freeze
56
59
 
@@ -74,6 +77,7 @@ module Sendly
74
77
  @sender_note = data["senderNote"]
75
78
  @created_at = parse_time(data["createdAt"])
76
79
  @delivered_at = parse_time(data["deliveredAt"])
80
+ @metadata = data["metadata"]
77
81
  end
78
82
 
79
83
  # Check if message was delivered
@@ -113,7 +117,8 @@ module Sendly
113
117
  warning: warning,
114
118
  sender_note: sender_note,
115
119
  created_at: created_at&.iso8601,
116
- delivered_at: delivered_at&.iso8601
120
+ delivered_at: delivered_at&.iso8601,
121
+ metadata: metadata
117
122
  }.compact
118
123
  end
119
124
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sendly
4
- VERSION = "3.15.1"
4
+ VERSION = "3.15.3"
5
5
  end
@@ -101,6 +101,15 @@ module Sendly
101
101
  WebhookTestResult.new(response)
102
102
  end
103
103
 
104
+ # Reset the circuit breaker for a webhook
105
+ #
106
+ # @param webhook_id [String] Webhook ID
107
+ # @return [Hash] Reset confirmation with updated webhook
108
+ def reset_circuit(webhook_id)
109
+ validate_webhook_id!(webhook_id)
110
+ @client.post("/webhooks/#{webhook_id}/reset-circuit")
111
+ end
112
+
104
113
  # Rotate the webhook signing secret
105
114
  #
106
115
  # @param webhook_id [String] Webhook ID
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sendly
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.15.1
4
+ version: 3.15.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sendly
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-02-07 00:00:00.000000000 Z
11
+ date: 2026-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday