Skip to content
Merged
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.2.0"
".": "1.3.0"
}
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-a552e94c4d04a0d44cb4052dbfbaadea6449c254d18eb0c9c93f4c0e8ee27ad3.yml
openapi_spec_hash: f4c271283f332a9868a0ee0cc2d9cd8b
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/knock%2Fknock-46f457b0a70074dc6b49569ab3c72a7aeedc111aabf2ffe84f64e5e2f386c14c.yml
openapi_spec_hash: e0fe11d0ae0a6be4f9c052fa649b2a1a
config_hash: 2ae8965d371a03bd30c6a56819c04cf2
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Changelog

## 1.3.0 (2025-05-28)

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

### Features

* **api:** api update ([c47c0e6](https://github.com/knocklabs/knock-ruby/commit/c47c0e68992f447af50889cd4435d136e5fa2904))
* **api:** api update ([346b571](https://github.com/knocklabs/knock-ruby/commit/346b571779ade48f5954f018ab3f7d8f8dbdbdd9))


### Bug Fixes

* prevent rubocop from mangling `===` to `is_a?` check ([9ddd5e9](https://github.com/knocklabs/knock-ruby/commit/9ddd5e93e0ffb56f07a5216f64ff7a4eaab43468))
* sorbet types for enums, and make tapioca detection ignore `tapioca dsl` ([83ce737](https://github.com/knocklabs/knock-ruby/commit/83ce737225a0be39758aa1affcef2352a7e02502))


### Chores

* **docs:** grammar improvements ([3913113](https://github.com/knocklabs/knock-ruby/commit/3913113994e8e2e203fe2ab60a6e5fd817a130c5))
* force utf-8 locale via `RUBYOPT` when formatting ([ec69c77](https://github.com/knocklabs/knock-ruby/commit/ec69c77c94ba059d577798a05098847bb304b36b))
* use fully qualified names for yard annotations and rbs aliases ([ef4ddca](https://github.com/knocklabs/knock-ruby/commit/ef4ddca29f6bfa5d707415ee12e18a08738a3293))

## 1.2.0 (2025-05-21)

Full Changelog: [v1.1.0...v1.2.0](https://github.com/knocklabs/knock-ruby/compare/v1.1.0...v1.2.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.2.0)
knockapi (1.3.0)
connection_pool

GEM
Expand Down
8 changes: 4 additions & 4 deletions 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.2.0"
gem "knockapi", "~> 1.3.0"
```

<!-- x-release-please-end -->
Expand Down Expand Up @@ -173,7 +173,7 @@ puts(user[:my_undocumented_property])

#### Undocumented request params

If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request as seen in examples above.
If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` under the `request_options:` parameter when making a request, as seen in the examples above.

#### Undocumented endpoints

Expand All @@ -191,7 +191,7 @@ response = client.request(

### Concurrency & connection pooling

The `Knockapi::Client` instances are threadsafe, but only are fork-safe when there are no in-flight HTTP requests.
The `Knockapi::Client` instances are threadsafe, but are only are fork-safe when there are no in-flight HTTP requests.

Each instance of `Knockapi::Client` has its own HTTP connection pool with a default size of 99. As such, we recommend instantiating the client once per application in most settings.

Expand Down Expand Up @@ -241,7 +241,7 @@ knock.users.feeds.list_items(
# …
)

# Literal values is also permissible:
# Literal values are also permissible:
knock.users.feeds.list_items(
archived: :exclude,
# …
Expand Down
6 changes: 3 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ multitask(:test) do
end

xargs = %w[xargs --no-run-if-empty --null --max-procs=0 --max-args=300 --]
locale = {"LC_ALL" => "C.UTF-8"}
ruby_opt = {"RUBYOPT" => [ENV["RUBYOPT"], "--encoding=UTF-8"].compact.join(" ")}

desc("Lint `*.rb(i)`")
multitask(:"lint:rubocop") do
Expand Down Expand Up @@ -64,7 +64,7 @@ desc("Format `*.rbi`")
multitask(:"format:rbi") do
find = %w[find ./rbi -type f -and -name *.rbi -print0]
fmt = xargs + %w[stree write --]
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}")
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}")
end

desc("Format `*.rbs`")
Expand Down Expand Up @@ -100,7 +100,7 @@ multitask(:"format:rbs") do
# transform class aliases to type aliases, which syntax tree has no trouble with
sh("#{find.shelljoin} | #{pre.shelljoin}")
# run syntax tree to format `*.rbs` files
sh(locale, "#{find.shelljoin} | #{fmt.shelljoin}") do
sh(ruby_opt, "#{find.shelljoin} | #{fmt.shelljoin}") do
success = _1
end
# transform type aliases back to class aliases
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ before making any information public.
## Reporting Non-SDK Related Security Issues

If you encounter security issues that are not directly related to SDKs but pertain to the services
or products provided by Knock please follow the respective company's security reporting guidelines.
or products provided by Knock, please follow the respective company's security reporting guidelines.

### Knock Terms and Policies

Please contact [email protected] for any questions or concerns regarding security of our services.
Please contact [email protected] for any questions or concerns regarding the security of our services.

---

Expand Down
4 changes: 3 additions & 1 deletion lib/knockapi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@

# We already ship the preferred sorbet manifests in the package itself.
# `tapioca` currently does not offer us a way to opt out of unnecessary compilation.
if Object.const_defined?(:Tapioca) && caller.chain([$PROGRAM_NAME]).chain(ARGV).grep(/tapioca/)
if Object.const_defined?(:Tapioca) &&
caller.chain([$PROGRAM_NAME]).chain(ARGV).any?(/tapioca/) &&
ARGV.none?(/dsl/)
return
end

Expand Down
4 changes: 2 additions & 2 deletions lib/knockapi/internal/items_cursor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module Internal
# end
#
# @example
# items_cursor.auto_paging_each do |message|
# puts(message)
# items_cursor.auto_paging_each do |user|
# puts(user)
# end
class ItemsCursor
include Knockapi::Internal::Type::BasePage
Expand Down
12 changes: 10 additions & 2 deletions lib/knockapi/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -600,11 +600,13 @@ class << self
#
# @return [Object]
def encode_content(headers, body)
# rubocop:disable Style/CaseEquality
# rubocop:disable Layout/LineLength
content_type = headers["content-type"]
case [content_type, body]
in [Knockapi::Internal::Util::JSON_CONTENT, Hash | Array | -> { primitive?(_1) }]
[headers, JSON.generate(body)]
in [Knockapi::Internal::Util::JSONL_CONTENT, Enumerable] unless body.is_a?(Knockapi::Internal::Type::FileInput)
in [Knockapi::Internal::Util::JSONL_CONTENT, Enumerable] unless Knockapi::Internal::Type::FileInput === body
[headers, body.lazy.map { JSON.generate(_1) }]
in [%r{^multipart/form-data}, Hash | Knockapi::Internal::Type::FileInput]
boundary, strio = encode_multipart_streaming(body)
Expand All @@ -619,6 +621,8 @@ def encode_content(headers, body)
else
[headers, body]
end
# rubocop:enable Layout/LineLength
# rubocop:enable Style/CaseEquality
end

# @api private
Expand Down Expand Up @@ -871,8 +875,12 @@ def to_sorbet_type(type)
case type
in Knockapi::Internal::Util::SorbetRuntimeSupport
type.to_sorbet_type
else
in Class | Module
type
in true | false
T::Boolean
else
type.class
end
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/knockapi/models/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Activity < Knockapi::Internal::Type::BaseModel
# @!attribute actor
# A recipient of a notification, which is either a user or an object.
#
# @return [Knockapi::User, Knockapi::Object, nil]
# @return [Knockapi::Models::User, Knockapi::Models::Object, nil]
optional :actor, union: -> { Knockapi::Recipient }, nil?: true

# @!attribute data
Expand All @@ -37,7 +37,7 @@ class Activity < Knockapi::Internal::Type::BaseModel
# @!attribute recipient
# A recipient of a notification, which is either a user or an object.
#
# @return [Knockapi::User, Knockapi::Object, nil]
# @return [Knockapi::Models::User, Knockapi::Models::Object, nil]
optional :recipient, union: -> { Knockapi::Recipient }

# @!attribute updated_at
Expand All @@ -56,13 +56,13 @@ class Activity < Knockapi::Internal::Type::BaseModel
#
# @param _typename [String] The typename of the schema.
#
# @param actor [Knockapi::User, Knockapi::Object, nil] A recipient of a notification, which is either a user or an object.
# @param actor [Knockapi::Models::User, Knockapi::Models::Object, nil] A recipient of a notification, which is either a user or an object.
#
# @param data [Hash{Symbol=>Object}, nil] The workflow trigger `data` payload associated with the activity.
#
# @param inserted_at [Time] Timestamp when the activity was created.
#
# @param recipient [Knockapi::User, Knockapi::Object] A recipient of a notification, which is either a user or an object.
# @param recipient [Knockapi::Models::User, Knockapi::Models::Object] A recipient of a notification, which is either a user or an object.
#
# @param updated_at [Time] Timestamp when the activity was last updated.
end
Expand Down
10 changes: 5 additions & 5 deletions lib/knockapi/models/audience_add_members_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ class AudienceAddMembersParams < Knockapi::Internal::Type::BaseModel
# @!attribute members
# A list of audience members to add.
#
# @return [Array<Knockapi::AudienceAddMembersParams::Member>]
# @return [Array<Knockapi::Models::AudienceAddMembersParams::Member>]
required :members, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::AudienceAddMembersParams::Member] }

# @!method initialize(members:, request_options: {})
# @param members [Array<Knockapi::AudienceAddMembersParams::Member>] A list of audience members to add.
# @param members [Array<Knockapi::Models::AudienceAddMembersParams::Member>] A list of audience members to add.
#
# @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}]

class Member < Knockapi::Internal::Type::BaseModel
# @!attribute user
# An object containing the user's ID.
#
# @return [Knockapi::AudienceAddMembersParams::Member::User]
# @return [Knockapi::Models::AudienceAddMembersParams::Member::User]
required :user, -> { Knockapi::AudienceAddMembersParams::Member::User }

# @!attribute tenant
Expand All @@ -34,11 +34,11 @@ class Member < Knockapi::Internal::Type::BaseModel
# @!method initialize(user:, tenant: nil)
# An audience member.
#
# @param user [Knockapi::AudienceAddMembersParams::Member::User] An object containing the user's ID.
# @param user [Knockapi::Models::AudienceAddMembersParams::Member::User] An object containing the user's ID.
#
# @param tenant [String, nil] The unique identifier for the tenant.

# @see Knockapi::AudienceAddMembersParams::Member#user
# @see Knockapi::Models::AudienceAddMembersParams::Member#user
class User < Knockapi::Internal::Type::BaseModel
# @!attribute id
# The ID for the user that you set when identifying them in Knock.
Expand Down
8 changes: 4 additions & 4 deletions lib/knockapi/models/audience_list_members_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ class AudienceListMembersResponse < Knockapi::Internal::Type::BaseModel
# @!attribute entries
# A list of audience members.
#
# @return [Array<Knockapi::AudienceMember>]
# @return [Array<Knockapi::Models::AudienceMember>]
required :entries, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::AudienceMember] }

# @!attribute page_info
# Pagination information for a list of resources.
#
# @return [Knockapi::PageInfo]
# @return [Knockapi::Models::PageInfo]
required :page_info, -> { Knockapi::PageInfo }

# @!method initialize(entries:, page_info:)
# A paginated list of audience members.
#
# @param entries [Array<Knockapi::AudienceMember>] A list of audience members.
# @param entries [Array<Knockapi::Models::AudienceMember>] A list of audience members.
#
# @param page_info [Knockapi::PageInfo] Pagination information for a list of resources.
# @param page_info [Knockapi::Models::PageInfo] Pagination information for a list of resources.
end
end
end
8 changes: 4 additions & 4 deletions lib/knockapi/models/audience_member.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class AudienceMember < Knockapi::Internal::Type::BaseModel
# receive notifications through Knock. Users are the most common recipients of
# notifications and are always referenced by your internal identifier.
#
# @return [Knockapi::User]
# @return [Knockapi::Models::User]
required :user, -> { Knockapi::User }

# @!attribute user_id
Expand All @@ -36,16 +36,16 @@ class AudienceMember < Knockapi::Internal::Type::BaseModel
optional :tenant, String, nil?: true

# @!method initialize(_typename:, added_at:, user:, user_id:, tenant: nil)
# Some parameter documentations has been truncated, see {Knockapi::AudienceMember}
# for more details.
# Some parameter documentations has been truncated, see
# {Knockapi::Models::AudienceMember} for more details.
#
# An audience member.
#
# @param _typename [String] The typename of the schema.
#
# @param added_at [Time] Timestamp when the resource was created.
#
# @param user [Knockapi::User] A [User](/concepts/users) represents an individual in your system who can receiv
# @param user [Knockapi::Models::User] A [User](/concepts/users) represents an individual in your system who can receiv
#
# @param user_id [String] The ID for the user that you set when identifying them in Knock.
#
Expand Down
10 changes: 5 additions & 5 deletions lib/knockapi/models/audience_remove_members_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ class AudienceRemoveMembersParams < Knockapi::Internal::Type::BaseModel
# @!attribute members
# A list of audience members to remove.
#
# @return [Array<Knockapi::AudienceRemoveMembersParams::Member>]
# @return [Array<Knockapi::Models::AudienceRemoveMembersParams::Member>]
required :members,
-> {
Knockapi::Internal::Type::ArrayOf[Knockapi::AudienceRemoveMembersParams::Member]
}

# @!method initialize(members:, request_options: {})
# @param members [Array<Knockapi::AudienceRemoveMembersParams::Member>] A list of audience members to remove.
# @param members [Array<Knockapi::Models::AudienceRemoveMembersParams::Member>] A list of audience members to remove.
#
# @param request_options [Knockapi::RequestOptions, Hash{Symbol=>Object}]

class Member < Knockapi::Internal::Type::BaseModel
# @!attribute user
# An object containing the user's ID.
#
# @return [Knockapi::AudienceRemoveMembersParams::Member::User]
# @return [Knockapi::Models::AudienceRemoveMembersParams::Member::User]
required :user, -> { Knockapi::AudienceRemoveMembersParams::Member::User }

# @!attribute tenant
Expand All @@ -37,11 +37,11 @@ class Member < Knockapi::Internal::Type::BaseModel
# @!method initialize(user:, tenant: nil)
# An audience member.
#
# @param user [Knockapi::AudienceRemoveMembersParams::Member::User] An object containing the user's ID.
# @param user [Knockapi::Models::AudienceRemoveMembersParams::Member::User] An object containing the user's ID.
#
# @param tenant [String, nil] The unique identifier for the tenant.

# @see Knockapi::AudienceRemoveMembersParams::Member#user
# @see Knockapi::Models::AudienceRemoveMembersParams::Member#user
class User < Knockapi::Internal::Type::BaseModel
# @!attribute id
# The ID for the user that you set when identifying them in Knock.
Expand Down
10 changes: 5 additions & 5 deletions lib/knockapi/models/bulk_operation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class BulkOperation < Knockapi::Internal::Type::BaseModel
# @!attribute status
# The status of the bulk operation.
#
# @return [Symbol, Knockapi::BulkOperation::Status]
# @return [Symbol, Knockapi::Models::BulkOperation::Status]
required :status, enum: -> { Knockapi::BulkOperation::Status }

# @!attribute success_count
Expand Down Expand Up @@ -73,7 +73,7 @@ class BulkOperation < Knockapi::Internal::Type::BaseModel
# @!attribute error_items
# A list of items that failed to be processed.
#
# @return [Array<Knockapi::BulkOperation::ErrorItem>, nil]
# @return [Array<Knockapi::Models::BulkOperation::ErrorItem>, nil]
optional :error_items, -> { Knockapi::Internal::Type::ArrayOf[Knockapi::BulkOperation::ErrorItem] }

# @!attribute failed_at
Expand Down Expand Up @@ -109,7 +109,7 @@ class BulkOperation < Knockapi::Internal::Type::BaseModel
#
# @param processed_rows [Integer] The number of rows processed so far.
#
# @param status [Symbol, Knockapi::BulkOperation::Status] The status of the bulk operation.
# @param status [Symbol, Knockapi::Models::BulkOperation::Status] The status of the bulk operation.
#
# @param success_count [Integer] The number of successful operations.
#
Expand All @@ -119,7 +119,7 @@ class BulkOperation < Knockapi::Internal::Type::BaseModel
#
# @param error_count [Integer] The number of failed operations.
#
# @param error_items [Array<Knockapi::BulkOperation::ErrorItem>] A list of items that failed to be processed.
# @param error_items [Array<Knockapi::Models::BulkOperation::ErrorItem>] A list of items that failed to be processed.
#
# @param failed_at [Time, nil] Timestamp when the bulk operation failed.
#
Expand All @@ -129,7 +129,7 @@ class BulkOperation < Knockapi::Internal::Type::BaseModel

# The status of the bulk operation.
#
# @see Knockapi::BulkOperation#status
# @see Knockapi::Models::BulkOperation#status
module Status
extend Knockapi::Internal::Type::Enum

Expand Down
Loading