Class: Courier::Resources::Tenants::Templates::Versions

Inherits:
Object
  • Object
show all
Defined in:
lib/courier/resources/tenants/templates/versions.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Versions

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Versions.

Parameters:



53
54
55
# File 'lib/courier/resources/tenants/templates/versions.rb', line 53

def initialize(client:)
  @client = client
end

Instance Method Details

#retrieve(version, tenant_id:, template_id:, request_options: {}) ⇒ Courier::Models::BaseTemplateTenantAssociation

Some parameter documentations has been truncated, see Models::Tenants::Templates::VersionRetrieveParams for more details.

Fetches a specific version of a tenant template.

Supports the following version formats:

  • ‘latest` - The most recent version of the template

  • ‘published` - The currently published version

  • ‘vversion` - A specific version (e.g., “v1”, “v2”, “v1.0.0”)

Parameters:

  • version (String)

    Version of the template to retrieve. Accepts “latest”, “published”, or a specifi

  • tenant_id (String)

    Id of the tenant for which to retrieve the template.

  • template_id (String)

    Id of the template to be retrieved.

  • request_options (Courier::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/courier/resources/tenants/templates/versions.rb', line 32

def retrieve(version, params)
  parsed, options = Courier::Tenants::Templates::VersionRetrieveParams.dump_request(params)
  tenant_id =
    parsed.delete(:tenant_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  template_id =
    parsed.delete(:template_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["tenants/%1$s/templates/%2$s/versions/%3$s", tenant_id, template_id, version],
    model: Courier::BaseTemplateTenantAssociation,
    options: options
  )
end