Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🌿 Fern Regeneration -- December 27, 2024 #41

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
26 changes: 0 additions & 26 deletions .github/workflows/publish.yml

This file was deleted.

4 changes: 2 additions & 2 deletions trycourier.gemspec → courier.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require_relative "lib/gemconfig"

Gem::Specification.new do |spec|
spec.name = "trycourier"
spec.version = "3.1.2"
spec.name = "courier"
spec.version = "3.1.3"
spec.authors = Courier::Gemconfig::AUTHORS
spec.email = Courier::Gemconfig::EMAIL
spec.summary = Courier::Gemconfig::SUMMARY
Expand Down
39 changes: 21 additions & 18 deletions lib/trycourier.rb → lib/courier.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,27 @@
require_relative "environment"
require_relative "types_export"
require_relative "requests"
require_relative "trycourier/audiences/client"
require_relative "trycourier/audit_events/client"
require_relative "trycourier/auth_tokens/client"
require_relative "trycourier/automations/client"
require_relative "trycourier/brands/client"
require_relative "trycourier/bulk/client"
require_relative "trycourier/lists/client"
require_relative "trycourier/messages/client"
require_relative "trycourier/notifications/client"
require_relative "trycourier/profiles/client"
require_relative "trycourier/templates/client"
require_relative "trycourier/tenants/client"
require_relative "trycourier/translations/client"
require_relative "trycourier/users/client"
require_relative "trycourier/send/types/message"
require_relative "trycourier/types/send_message_response"
require_relative "courier/audiences/client"
require_relative "courier/audit_events/client"
require_relative "courier/auth_tokens/client"
require_relative "courier/automations/client"
require_relative "courier/brands/client"
require_relative "courier/bulk/client"
require_relative "courier/inbound/client"
require_relative "courier/lists/client"
require_relative "courier/messages/client"
require_relative "courier/notifications/client"
require_relative "courier/profiles/client"
require_relative "courier/templates/client"
require_relative "courier/tenants/client"
require_relative "courier/translations/client"
require_relative "courier/users/client"
require_relative "courier/send/types/message"
require_relative "courier/types/send_message_response"

module Courier
class Client
attr_reader :audiences, :audit_events, :auth_tokens, :automations, :brands, :bulk, :lists, :messages,
attr_reader :audiences, :audit_events, :auth_tokens, :automations, :brands, :bulk, :inbound, :lists, :messages,
:notifications, :profiles, :templates, :tenants, :translations, :users

# @param environment [Environment]
Expand All @@ -40,6 +41,7 @@ def initialize(authorization_token:, environment: Environment::PRODUCTION, max_r
@automations = AutomationsClient.new(request_client: @request_client)
@brands = BrandsClient.new(request_client: @request_client)
@bulk = BulkClient.new(request_client: @request_client)
@inbound = InboundClient.new(request_client: @request_client)
@lists = ListsClient.new(request_client: @request_client)
@messages = MessagesClient.new(request_client: @request_client)
@notifications = NotificationsClient.new(request_client: @request_client)
Expand Down Expand Up @@ -74,7 +76,7 @@ def send(message:, request_options: nil)
end

class AsyncClient
attr_reader :audiences, :audit_events, :auth_tokens, :automations, :brands, :bulk, :lists, :messages,
attr_reader :audiences, :audit_events, :auth_tokens, :automations, :brands, :bulk, :inbound, :lists, :messages,
:notifications, :profiles, :templates, :tenants, :translations, :users

# @param environment [Environment]
Expand All @@ -92,6 +94,7 @@ def initialize(authorization_token:, environment: Environment::PRODUCTION, max_r
@automations = AsyncAutomationsClient.new(request_client: @async_request_client)
@brands = AsyncBrandsClient.new(request_client: @async_request_client)
@bulk = AsyncBulkClient.new(request_client: @async_request_client)
@inbound = AsyncInboundClient.new(request_client: @async_request_client)
@lists = AsyncListsClient.new(request_client: @async_request_client)
@messages = AsyncMessagesClient.new(request_client: @async_request_client)
@notifications = AsyncNotificationsClient.new(request_client: @async_request_client)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
42 changes: 42 additions & 0 deletions lib/courier/automations/types/accessor_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# frozen_string_literal: true
require "json"

module Courier
class Automations
class AccessorType
attr_reader :ref, :additional_properties
# @param ref [String]
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
# @return [Automations::AccessorType]
def initialize(ref:, additional_properties: nil)
# @type [String]
@ref = ref
# @type [OpenStruct] Additional properties unmapped to the current class definition
@additional_properties = additional_properties
end
# Deserialize a JSON object to an instance of AccessorType
#
# @param json_object [JSON]
# @return [Automations::AccessorType]
def self.from_json(json_object:)
struct = JSON.parse(json_object, object_class: OpenStruct)
parsed_json = JSON.parse(json_object)
ref = struct.$ref
new(ref: ref, additional_properties: struct)
end
# Serialize an instance of AccessorType to a JSON object
#
# @return [JSON]
def to_json
{ "$ref": @ref }.to_json
end
# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
#
# @param obj [Object]
# @return [Void]
def self.validate_raw(obj:)
obj.ref.is_a?(String) != false || raise("Passed value for field obj.ref is not the expected type, validation failed.")
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# frozen_string_literal: true

require "json"

module Courier
class Automations
class AutomationAddToBatchMaxItemsType
# Deserialize a JSON object to an instance of AutomationAddToBatchMaxItemsType
#
# @param json_object [JSON]
# @return [Automations::AutomationAddToBatchMaxItemsType]
def self.from_json(json_object:)
struct = JSON.parse(json_object, object_class: OpenStruct)
begin
struct.is_a?(String) != false || raise("Passed value for field struct is not the expected type, validation failed.")
return json_object
rescue StandardError
# noop
end
begin
struct.is_a?(Integer) != false || raise("Passed value for field struct is not the expected type, validation failed.")
return json_object
rescue StandardError
# noop
end
struct
end

# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
#
# @param obj [Object]
# @return [Void]
def self.validate_raw(obj:)
begin
return obj.is_a?(String) != false || raise("Passed value for field obj is not the expected type, validation failed.")
rescue StandardError
# noop
end
begin
return obj.is_a?(Integer) != false || raise("Passed value for field obj is not the expected type, validation failed.")
rescue StandardError
# noop
end
raise("Passed value matched no type within the union, validation failed.")
end
end
end
end
63 changes: 63 additions & 0 deletions lib/courier/automations/types/automation_add_to_batch_retain.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# frozen_string_literal: true

require_relative "automation_add_to_batch_retain_type"
require "json"

module Courier
class Automations
# Defines what items should be retained and passed along to the next steps when the batch is released
class AutomationAddToBatchRetain
attr_reader :type, :count, :sort_key, :additional_properties

# @param type [Automations::AutomationAddToBatchRetainType] Keep N number of notifications based on the type. First/Last N based on notification received.
# highest/lowest based on a scoring key providing in the data accessed by sort_key
# @param count [Integer] The number of records to keep in batch. Default is 10 and only configurable by requesting from support.
# When configurable minimum is 2 and maximum is 100.
# @param sort_key [String] Defines the data value data[sort_key] that is used to sort the stored items. Required when type is set to highest or lowest.
# @param additional_properties [OpenStruct] Additional properties unmapped to the current class definition
# @return [Automations::AutomationAddToBatchRetain]
def initialize(type:, count:, sort_key: nil, additional_properties: nil)
# @type [Automations::AutomationAddToBatchRetainType] Keep N number of notifications based on the type. First/Last N based on notification received.
# highest/lowest based on a scoring key providing in the data accessed by sort_key
@type = type
# @type [Integer] The number of records to keep in batch. Default is 10 and only configurable by requesting from support.
# When configurable minimum is 2 and maximum is 100.
@count = count
# @type [String] Defines the data value data[sort_key] that is used to sort the stored items. Required when type is set to highest or lowest.
@sort_key = sort_key
# @type [OpenStruct] Additional properties unmapped to the current class definition
@additional_properties = additional_properties
end

# Deserialize a JSON object to an instance of AutomationAddToBatchRetain
#
# @param json_object [JSON]
# @return [Automations::AutomationAddToBatchRetain]
def self.from_json(json_object:)
struct = JSON.parse(json_object, object_class: OpenStruct)
JSON.parse(json_object)
type = struct.type
count = struct.count
sort_key = struct.sort_key
new(type: type, count: count, sort_key: sort_key, additional_properties: struct)
end

# Serialize an instance of AutomationAddToBatchRetain to a JSON object
#
# @return [JSON]
def to_json(*_args)
{ "type": @type, "count": @count, "sort_key": @sort_key }.to_json
end

# Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object's property definitions.
#
# @param obj [Object]
# @return [Void]
def self.validate_raw(obj:)
obj.type.is_a?(Automations::AutomationAddToBatchRetainType) != false || raise("Passed value for field obj.type is not the expected type, validation failed.")
obj.count.is_a?(Integer) != false || raise("Passed value for field obj.count is not the expected type, validation failed.")
obj.sort_key&.is_a?(String) != false || raise("Passed value for field obj.sort_key is not the expected type, validation failed.")
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# frozen_string_literal: true

module Courier
class Automations
class AutomationAddToBatchRetainType
FIRST = "first"
LAST = "last"
HIGHEST = "highest"
LOWEST = "lowest"
end
end
end
11 changes: 11 additions & 0 deletions lib/courier/automations/types/automation_add_to_batch_scope.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# frozen_string_literal: true

module Courier
class Automations
class AutomationAddToBatchScope
USER = "user"
GLOBAL = "global"
DYNAMIC = "dynamic"
end
end
end
Loading