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
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,40 @@ on:
- 'stl-preview-base/**'

jobs:
build:
timeout-minutes: 10
name: build
permissions:
contents: read
id-token: write
runs-on: ${{ github.repository == 'stainless-sdks/courier-ruby' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: |-
github.repository == 'stainless-sdks/courier-ruby' &&
(github.event_name == 'push' || github.event.pull_request.head.repo.fork)
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: false
- run: |-
bundle install

- name: Get GitHub OIDC Token
if: github.repository == 'stainless-sdks/courier-ruby'
id: github-oidc
uses: actions/github-script@v8
with:
script: core.setOutput('github_token', await core.getIDToken());

- name: Build and upload gem artifacts
if: github.repository == 'stainless-sdks/courier-ruby'
env:
URL: https://pkg.stainless.com/s
AUTH: ${{ steps.github-oidc.outputs.github_token }}
SHA: ${{ github.sha }}
PACKAGE_NAME: courier
run: ./scripts/utils/upload-artifact.sh
lint:
timeout-minutes: 10
name: lint
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "4.7.1"
".": "4.8.0"
}
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 81
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-3fc1c86b4a83a16393aaf17d1fb3ac6098d30dd057ba872973b57285a7a3f0d0.yml
openapi_spec_hash: 02a545d217b13399f311e99561f9de1d
config_hash: 0789c3cddc625bb9712b3bded274ab6c
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/courier%2Fcourier-44c2e612f5d40e03f56712a4e123a193e6ea03cc64a91d0c34ee094563dafa1c.yml
openapi_spec_hash: 40bf6b3f7992d55f1bd543f32564ea86
config_hash: b1f6d0f43161b66d201043fcbe5c5695
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,28 @@
# Changelog

## 4.8.0 (2026-03-03)

Full Changelog: [v4.7.1...v4.8.0](https://github.com/trycourier/courier-ruby/compare/v4.7.1...v4.8.0)

### Features

* **api:** add provider_key/device/tracking to token params, remove body_token ([acb3031](https://github.com/trycourier/courier-ruby/commit/acb30313188a385e2ad39be4f4040e4e5836106d))
* **api:** remove brand field from ElementalContent model ([519fcc0](https://github.com/trycourier/courier-ruby/commit/519fcc0a2f35a1fd61e64362b5a2e7b2d8225232))


### Chores

* **ci:** add build step ([d07ae3d](https://github.com/trycourier/courier-ruby/commit/d07ae3dc073f38ac30af1311f1d70153e441bf51))
* **internal:** codegen related update ([1cce4a8](https://github.com/trycourier/courier-ruby/commit/1cce4a8be23782aae7fb9185b8ac2efd06516842))
* **internal:** remove mock server code ([a81351a](https://github.com/trycourier/courier-ruby/commit/a81351a2fde27b8a785a79436394a991e9048d97))
* update mock server docs ([62d69fc](https://github.com/trycourier/courier-ruby/commit/62d69fc657babf8ff535e150d74a2283ddb64459))


### Documentation

* add AUTO-GENERATED-OVERVIEW markers for README sync ([#75](https://github.com/trycourier/courier-ruby/issues/75)) ([ab86102](https://github.com/trycourier/courier-ruby/commit/ab86102437d2af03dc45beae7262371c70b6847f))
* sync README from mintlify-docs (2026-02-20 18:11 UTC) ([#76](https://github.com/trycourier/courier-ruby/issues/76)) ([cc67458](https://github.com/trycourier/courier-ruby/commit/cc6745816e152b890b84caaf666178bdbd9d3192))

## 4.7.1 (2026-02-07)

Full Changelog: [v4.7.0...v4.7.1](https://github.com/trycourier/courier-ruby/compare/v4.7.0...v4.7.1)
Expand Down
6 changes: 0 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,6 @@ $ bundle exec rake

## Running tests

Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests.

```bash
$ npx prism mock path/to/your/openapi.yml
```

```bash
$ bundle exec rake test
```
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:
trycourier (4.7.1)
trycourier (4.8.0)
cgi
connection_pool

Expand Down
31 changes: 31 additions & 0 deletions lib/courier/internal/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,37 @@ def writable_enum(&blk)
JSONL_CONTENT = %r{^application/(:?x-(?:n|l)djson)|(:?(?:x-)?jsonl)}

class << self
# @api private
#
# @param query [Hash{Symbol=>Object}]
#
# @return [Hash{Symbol=>Object}]
def encode_query_params(query)
out = {}
query.each { write_query_param_element!(out, _1, _2) }
out
end

# @api private
#
# @param collection [Hash{Symbol=>Object}]
# @param key [String]
# @param element [Object]
#
# @return [nil]
private def write_query_param_element!(collection, key, element)
case element
in Hash
element.each do |name, value|
write_query_param_element!(collection, "#{key}[#{name}]", value)
end
in Array
collection[key] = element.map(&:to_s).join(",")
else
collection[key] = element.to_s
end
end

# @api private
#
# @param y [Enumerator::Yielder]
Expand Down
9 changes: 1 addition & 8 deletions lib/courier/models/elemental_content.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,10 @@ class ElementalContent < Courier::Internal::Type::BaseModel
# @return [String]
required :version, String

# @!attribute brand
#
# @return [String, nil]
optional :brand, String, nil?: true

# @!method initialize(elements:, version:, brand: nil)
# @!method initialize(elements:, version:)
# @param elements [Array<Courier::Models::ElementalTextNodeWithType, Courier::Models::ElementalMetaNodeWithType, Courier::Models::ElementalChannelNodeWithType, Courier::Models::ElementalImageNodeWithType, Courier::Models::ElementalActionNodeWithType, Courier::Models::ElementalDividerNodeWithType, Courier::Models::ElementalQuoteNodeWithType>]
#
# @param version [String] For example, "2022-01-01"
#
# @param brand [String, nil]
end
end
end
163 changes: 161 additions & 2 deletions lib/courier/models/users/token_add_single_params.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Courier
module Models
module Users
# @see Courier::Resources::Users::Tokens#add_single
class TokenAddSingleParams < Courier::Models::Users::UserToken
class TokenAddSingleParams < Courier::Internal::Type::BaseModel
extend Courier::Internal::Type::RequestParameters::Converter
include Courier::Internal::Type::RequestParameters

Expand All @@ -13,9 +13,168 @@ class TokenAddSingleParams < Courier::Models::Users::UserToken
# @return [String]
required :user_id, String

# @!method initialize(user_id:, request_options: {})
# @!attribute provider_key
#
# @return [Symbol, Courier::Models::Users::TokenAddSingleParams::ProviderKey]
required :provider_key, enum: -> { Courier::Users::TokenAddSingleParams::ProviderKey }

# @!attribute device
# Information about the device the token came from.
#
# @return [Courier::Models::Users::TokenAddSingleParams::Device, nil]
optional :device, -> { Courier::Users::TokenAddSingleParams::Device }, nil?: true

# @!attribute expiry_date
# ISO 8601 formatted date the token expires. Defaults to 2 months. Set to false to
# disable expiration.
#
# @return [String, Boolean, nil]
optional :expiry_date, union: -> { Courier::Users::TokenAddSingleParams::ExpiryDate }, nil?: true

# @!attribute properties
# Properties about the token.
#
# @return [Object, nil]
optional :properties, Courier::Internal::Type::Unknown

# @!attribute tracking
# Tracking information about the device the token came from.
#
# @return [Courier::Models::Users::TokenAddSingleParams::Tracking, nil]
optional :tracking, -> { Courier::Users::TokenAddSingleParams::Tracking }, nil?: true

# @!method initialize(user_id:, provider_key:, device: nil, expiry_date: nil, properties: nil, tracking: nil, request_options: {})
# Some parameter documentations has been truncated, see
# {Courier::Models::Users::TokenAddSingleParams} for more details.
#
# @param user_id [String]
#
# @param provider_key [Symbol, Courier::Models::Users::TokenAddSingleParams::ProviderKey]
#
# @param device [Courier::Models::Users::TokenAddSingleParams::Device, nil] Information about the device the token came from.
#
# @param expiry_date [String, Boolean, nil] ISO 8601 formatted date the token expires. Defaults to 2 months. Set to false to
#
# @param properties [Object] Properties about the token.
#
# @param tracking [Courier::Models::Users::TokenAddSingleParams::Tracking, nil] Tracking information about the device the token came from.
#
# @param request_options [Courier::RequestOptions, Hash{Symbol=>Object}]

module ProviderKey
extend Courier::Internal::Type::Enum

FIREBASE_FCM = :"firebase-fcm"
APN = :apn
EXPO = :expo
ONESIGNAL = :onesignal

# @!method self.values
# @return [Array<Symbol>]
end

class Device < Courier::Internal::Type::BaseModel
# @!attribute ad_id
# Id of the advertising identifier
#
# @return [String, nil]
optional :ad_id, String, nil?: true

# @!attribute app_id
# Id of the application the token is used for
#
# @return [String, nil]
optional :app_id, String, nil?: true

# @!attribute device_id
# Id of the device the token is associated with
#
# @return [String, nil]
optional :device_id, String, nil?: true

# @!attribute manufacturer
# The device manufacturer
#
# @return [String, nil]
optional :manufacturer, String, nil?: true

# @!attribute model
# The device model
#
# @return [String, nil]
optional :model, String, nil?: true

# @!attribute platform
# The device platform i.e. android, ios, web
#
# @return [String, nil]
optional :platform, String, nil?: true

# @!method initialize(ad_id: nil, app_id: nil, device_id: nil, manufacturer: nil, model: nil, platform: nil)
# Information about the device the token came from.
#
# @param ad_id [String, nil] Id of the advertising identifier
#
# @param app_id [String, nil] Id of the application the token is used for
#
# @param device_id [String, nil] Id of the device the token is associated with
#
# @param manufacturer [String, nil] The device manufacturer
#
# @param model [String, nil] The device model
#
# @param platform [String, nil] The device platform i.e. android, ios, web
end

# ISO 8601 formatted date the token expires. Defaults to 2 months. Set to false to
# disable expiration.
module ExpiryDate
extend Courier::Internal::Type::Union

variant String

variant Courier::Internal::Type::Boolean

# @!method self.variants
# @return [Array(String, Boolean)]
end

class Tracking < Courier::Internal::Type::BaseModel
# @!attribute ip
# The IP address of the device
#
# @return [String, nil]
optional :ip, String, nil?: true

# @!attribute lat
# The latitude of the device
#
# @return [String, nil]
optional :lat, String, nil?: true

# @!attribute long
# The longitude of the device
#
# @return [String, nil]
optional :long, String, nil?: true

# @!attribute os_version
# The operating system version
#
# @return [String, nil]
optional :os_version, String, nil?: true

# @!method initialize(ip: nil, lat: nil, long: nil, os_version: nil)
# Tracking information about the device the token came from.
#
# @param ip [String, nil] The IP address of the device
#
# @param lat [String, nil] The latitude of the device
#
# @param long [String, nil] The longitude of the device
#
# @param os_version [String, nil] The operating system version
end
end
end
end
Expand Down
6 changes: 4 additions & 2 deletions lib/courier/resources/audiences.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,11 @@ def update(audience_id, params = {})
# @see Courier::Models::AudienceListParams
def list(params = {})
parsed, options = Courier::AudienceListParams.dump_request(params)
query = Courier::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "audiences",
query: parsed,
query: query,
model: Courier::Models::AudienceListResponse,
options: options
)
Expand Down Expand Up @@ -113,10 +114,11 @@ def delete(audience_id, params = {})
# @see Courier::Models::AudienceListMembersParams
def list_members(audience_id, params = {})
parsed, options = Courier::AudienceListMembersParams.dump_request(params)
query = Courier::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: ["audiences/%1$s/members", audience_id],
query: parsed,
query: query,
model: Courier::Models::AudienceListMembersResponse,
options: options
)
Expand Down
3 changes: 2 additions & 1 deletion lib/courier/resources/audit_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ def retrieve(audit_event_id, params = {})
# @see Courier::Models::AuditEventListParams
def list(params = {})
parsed, options = Courier::AuditEventListParams.dump_request(params)
query = Courier::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "audit-events",
query: parsed,
query: query,
model: Courier::Models::AuditEventListResponse,
options: options
)
Expand Down
3 changes: 2 additions & 1 deletion lib/courier/resources/automations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ class Automations
# @see Courier::Models::AutomationListParams
def list(params = {})
parsed, options = Courier::AutomationListParams.dump_request(params)
query = Courier::Internal::Util.encode_query_params(parsed)
@client.request(
method: :get,
path: "automations",
query: parsed,
query: query,
model: Courier::AutomationTemplateListResponse,
options: options
)
Expand Down
Loading