Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "1.16.0"
".": "1.17.0"
}
4 changes: 4 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ Metrics/BlockLength:
Metrics/ClassLength:
Enabled: false

Metrics/CollectionLiteralLength:
Exclude:
- "test/**/*"

Metrics/CyclomaticComplexity:
Enabled: false

Expand Down
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 89
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-fe051300804a0ee8b0212b288cec99c00918e570f4c4b8852f3f4a27afdddd1c.yml
openapi_spec_hash: d2f75f52ceb88b56e4fcf58bf876fe44
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-7e017b74e4af156a7dc03b3ee24e8a9d7bbd8854c4f383b8caa9cac0d5fd3efa.yml
openapi_spec_hash: 40c32d8afabbb41391f8ed91519ff7f6
config_hash: 658c551418df454aa40794f8ac679c18
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
# Changelog

## 1.17.0 (2025-10-15)

Full Changelog: [v1.16.0...v1.17.0](https://github.com/knocklabs/knock-ruby/compare/v1.16.0...v1.17.0)

### Features

* **api:** api update ([042c92a](https://github.com/knocklabs/knock-ruby/commit/042c92a80665539dfeda7c2b8de0acead59fcfb1))
* **api:** api update ([0f7fc4a](https://github.com/knocklabs/knock-ruby/commit/0f7fc4a35357d5cf6cb8394f0df9b60598d15e63))


### Bug Fixes

* absolutely qualified uris should always override the default ([2bb6341](https://github.com/knocklabs/knock-ruby/commit/2bb63414bbf3b9d9b4b996cd75341a183a6aa792))
* should not reuse buffers for `IO.copy_stream` interop ([6464681](https://github.com/knocklabs/knock-ruby/commit/64646819574a19a1eb4969dc4abbc1d718ed7f4f))


### Chores

* ignore linter error for tests having large collections ([20f8ea6](https://github.com/knocklabs/knock-ruby/commit/20f8ea6a8cae8b3463b48d48f4ad065df465cddb))
* simplify model references ([c126d85](https://github.com/knocklabs/knock-ruby/commit/c126d85300aa1ffe211fbc8e1c25eff4ca25ab7e))

## 1.16.0 (2025-10-07)

Full Changelog: [v1.15.0...v1.16.0](https://github.com/knocklabs/knock-ruby/compare/v1.15.0...v1.16.0)
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ GIT
PATH
remote: .
specs:
knockapi (1.16.0)
knockapi (1.17.0)
connection_pool

GEM
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ To use this gem, install via Bundler by adding the following to your application
<!-- x-release-please-start-version -->

```ruby
gem "knockapi", "~> 1.16.0"
gem "knockapi", "~> 1.17.0"
```

<!-- x-release-please-end -->
Expand Down
10 changes: 5 additions & 5 deletions lib/knockapi/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,9 @@ def join_parsed_uri(lhs, rhs)
base_path, base_query = lhs.fetch_values(:path, :query)
slashed = base_path.end_with?("/") ? base_path : "#{base_path}/"

parsed_path, parsed_query = parse_uri(rhs.fetch(:path)).fetch_values(:path, :query)
override = URI::Generic.build(**rhs.slice(:scheme, :host, :port), path: parsed_path)
merged = {**parse_uri(rhs.fetch(:path)), **rhs.except(:path, :query)}
parsed_path, parsed_query = merged.fetch_values(:path, :query)
override = URI::Generic.build(**merged.slice(:scheme, :host, :port), path: parsed_path)

joined = URI.join(URI::Generic.build(lhs.except(:path, :query)), slashed, override)
query = deep_merge(
Expand Down Expand Up @@ -473,10 +474,9 @@ class << self
# @return [Enumerable<String>]
def writable_enum(&blk)
Enumerator.new do |y|
buf = String.new
y.define_singleton_method(:write) do
self << buf.replace(_1)
buf.bytesize
self << _1.dup
_1.bytesize
end

blk.call(y)
Expand Down
97 changes: 94 additions & 3 deletions lib/knockapi/models/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ class Message < Knockapi::Internal::Type::BaseModel
required :_typename, String, api_name: :__typename

# @!attribute channel_id
# The ID for the channel the message was sent through.
# @deprecated
#
# Deprecated, use channel.id instead.
#
# @return [String]
required :channel_id, String
Expand Down Expand Up @@ -74,6 +76,12 @@ class Message < Knockapi::Internal::Type::BaseModel
# @return [Time, nil]
optional :archived_at, Time, nil?: true

# @!attribute channel
# A configured channel, which is a way to route messages to a provider.
#
# @return [Knockapi::Models::Message::Channel, nil]
optional :channel, -> { Knockapi::Message::Channel }

# @!attribute clicked_at
# Timestamp when the message was clicked.
#
Expand Down Expand Up @@ -141,7 +149,7 @@ class Message < Knockapi::Internal::Type::BaseModel
# @return [String, nil]
optional :workflow, String, nil?: true

# @!method initialize(id:, _typename:, channel_id:, engagement_statuses:, inserted_at:, recipient:, source:, status:, updated_at:, actors: nil, archived_at: nil, clicked_at: nil, data: nil, interacted_at: nil, link_clicked_at: nil, metadata: nil, read_at: nil, scheduled_at: nil, seen_at: nil, tenant: nil, workflow: nil)
# @!method initialize(id:, _typename:, channel_id:, engagement_statuses:, inserted_at:, recipient:, source:, status:, updated_at:, actors: nil, archived_at: nil, channel: nil, clicked_at: nil, data: nil, interacted_at: nil, link_clicked_at: nil, metadata: nil, read_at: nil, scheduled_at: nil, seen_at: nil, tenant: nil, workflow: nil)
# Some parameter documentations has been truncated, see
# {Knockapi::Models::Message} for more details.
#
Expand All @@ -152,7 +160,7 @@ class Message < Knockapi::Internal::Type::BaseModel
#
# @param _typename [String] The typename of the schema.
#
# @param channel_id [String] The ID for the channel the message was sent through.
# @param channel_id [String] Deprecated, use channel.id instead.
#
# @param engagement_statuses [Array<Symbol, Knockapi::Models::Message::EngagementStatus>] A list of engagement statuses.
#
Expand All @@ -170,6 +178,8 @@ class Message < Knockapi::Internal::Type::BaseModel
#
# @param archived_at [Time, nil] Timestamp when the message was archived.
#
# @param channel [Knockapi::Models::Message::Channel] A configured channel, which is a way to route messages to a provider.
#
# @param clicked_at [Time, nil] Timestamp when the message was clicked.
#
# @param data [Hash{Symbol=>Object}, nil] Data associated with the message’s workflow run. Includes the workflow trigger r
Expand Down Expand Up @@ -289,6 +299,87 @@ module Status
# @!method self.values
# @return [Array<Symbol>]
end

# @see Knockapi::Models::Message#channel
class Channel < Knockapi::Internal::Type::BaseModel
# @!attribute id
# The unique identifier for the channel.
#
# @return [String]
required :id, String

# @!attribute created_at
# The timestamp of when the channel was created.
#
# @return [Time]
required :created_at, Time

# @!attribute provider
# The ID of the provider that this channel uses to deliver messages.
#
# @return [String]
required :provider, String

# @!attribute type
# The type of channel, determining what kind of messages it can send.
#
# @return [Symbol, Knockapi::Models::Message::Channel::Type]
required :type, enum: -> { Knockapi::Message::Channel::Type }

# @!attribute updated_at
# The timestamp of when the channel was last updated.
#
# @return [Time]
required :updated_at, Time

# @!attribute key
# Unique identifier for the channel within a project (immutable once created).
#
# @return [String, nil]
optional :key, String, nil?: true

# @!attribute name
# The human-readable name of the channel.
#
# @return [String, nil]
optional :name, String, nil?: true

# @!method initialize(id:, created_at:, provider:, type:, updated_at:, key: nil, name: nil)
# A configured channel, which is a way to route messages to a provider.
#
# @param id [String] The unique identifier for the channel.
#
# @param created_at [Time] The timestamp of when the channel was created.
#
# @param provider [String] The ID of the provider that this channel uses to deliver messages.
#
# @param type [Symbol, Knockapi::Models::Message::Channel::Type] The type of channel, determining what kind of messages it can send.
#
# @param updated_at [Time] The timestamp of when the channel was last updated.
#
# @param key [String, nil] Unique identifier for the channel within a project (immutable once created).
#
# @param name [String, nil] The human-readable name of the channel.

# The type of channel, determining what kind of messages it can send.
#
# @see Knockapi::Models::Message::Channel#type
module Type
extend Knockapi::Internal::Type::Enum

EMAIL = :email
IN_APP = :in_app
IN_APP_FEED = :in_app_feed
IN_APP_GUIDE = :in_app_guide
SMS = :sms
PUSH = :push
CHAT = :chat
HTTP = :http

# @!method self.values
# @return [Array<Symbol>]
end
end
end
end
end
2 changes: 1 addition & 1 deletion lib/knockapi/models/messages/batch_archive_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Knockapi
module Models
module Messages
# @type [Knockapi::Internal::Type::Converter]
BatchArchiveResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }]
BatchArchiveResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }]
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Knockapi
module Models
module Messages
# @type [Knockapi::Internal::Type::Converter]
BatchMarkAsInteractedResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }]
BatchMarkAsInteractedResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }]
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Knockapi
module Models
module Messages
# @type [Knockapi::Internal::Type::Converter]
BatchMarkAsReadResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }]
BatchMarkAsReadResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }]
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Knockapi
module Models
module Messages
# @type [Knockapi::Internal::Type::Converter]
BatchMarkAsSeenResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }]
BatchMarkAsSeenResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }]
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Knockapi
module Models
module Messages
# @type [Knockapi::Internal::Type::Converter]
BatchMarkAsUnreadResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }]
BatchMarkAsUnreadResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }]
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Knockapi
module Models
module Messages
# @type [Knockapi::Internal::Type::Converter]
BatchMarkAsUnseenResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }]
BatchMarkAsUnseenResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }]
end
end
end
2 changes: 1 addition & 1 deletion lib/knockapi/models/messages/batch_unarchive_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Knockapi
module Models
module Messages
# @type [Knockapi::Internal::Type::Converter]
BatchUnarchiveResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Models::Message }]
BatchUnarchiveResponse = Knockapi::Internal::Type::ArrayOf[-> { Knockapi::Message }]
end
end
end
11 changes: 10 additions & 1 deletion lib/knockapi/models/recipients/preference_set_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ class PreferenceSetRequest < Knockapi::Internal::Type::BaseModel
# @return [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil]
optional :channel_types, -> { Knockapi::Recipients::PreferenceSetChannelTypes }, nil?: true

# @!attribute commercial_subscribed
# Whether the recipient is subscribed to commercial communications. When false,
# the recipient will not receive commercial workflow notifications.
#
# @return [Boolean, nil]
optional :commercial_subscribed, Knockapi::Internal::Type::Boolean, nil?: true

# @!attribute workflows
# An object where the key is the workflow key and the values are the preference
# settings for that workflow.
Expand All @@ -41,7 +48,7 @@ class PreferenceSetRequest < Knockapi::Internal::Type::BaseModel
},
nil?: true

# @!method initialize(_persistence_strategy: nil, categories: nil, channel_types: nil, workflows: nil)
# @!method initialize(_persistence_strategy: nil, categories: nil, channel_types: nil, commercial_subscribed: nil, workflows: nil)
# Some parameter documentations has been truncated, see
# {Knockapi::Models::Recipients::PreferenceSetRequest} for more details.
#
Expand All @@ -53,6 +60,8 @@ class PreferenceSetRequest < Knockapi::Internal::Type::BaseModel
#
# @param channel_types [Knockapi::Models::Recipients::PreferenceSetChannelTypes, nil] Channel type preferences.
#
# @param commercial_subscribed [Boolean, nil] Whether the recipient is subscribed to commercial communications. When false, th
#
# @param workflows [Hash{Symbol=>Boolean, Knockapi::Models::Recipients::PreferenceSetRequest::Workflow::PreferenceSetWorkflowCategorySettingObject}, nil] An object where the key is the workflow key and the values are the preference se

# Controls how the preference set is persisted. 'replace' will completely replace
Expand Down
14 changes: 7 additions & 7 deletions lib/knockapi/resources/messages/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def archive(params)
method: :post,
path: "v1/messages/batch/archived",
body: parsed,
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message],
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message],
options: options
)
end
Expand Down Expand Up @@ -72,7 +72,7 @@ def mark_as_interacted(params)
method: :post,
path: "v1/messages/batch/interacted",
body: parsed,
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message],
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message],
options: options
)
end
Expand All @@ -95,7 +95,7 @@ def mark_as_read(params)
method: :post,
path: "v1/messages/batch/read",
body: parsed,
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message],
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message],
options: options
)
end
Expand All @@ -119,7 +119,7 @@ def mark_as_seen(params)
method: :post,
path: "v1/messages/batch/seen",
body: parsed,
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message],
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message],
options: options
)
end
Expand All @@ -143,7 +143,7 @@ def mark_as_unread(params)
method: :post,
path: "v1/messages/batch/unread",
body: parsed,
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message],
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message],
options: options
)
end
Expand All @@ -167,7 +167,7 @@ def mark_as_unseen(params)
method: :post,
path: "v1/messages/batch/unseen",
body: parsed,
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message],
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message],
options: options
)
end
Expand All @@ -191,7 +191,7 @@ def unarchive(params)
method: :post,
path: "v1/messages/batch/unarchived",
body: parsed,
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Models::Message],
model: Knockapi::Internal::Type::ArrayOf[Knockapi::Message],
options: options
)
end
Expand Down
Loading