Class: Trycourier::Resources::Tenants::Templates

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Templates

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 Templates.

Parameters:



63
64
65
# File 'lib/trycourier/resources/tenants/templates.rb', line 63

def initialize(client:)
  @client = client
end

Instance Method Details

#list(tenant_id, cursor: nil, limit: nil, request_options: {}) ⇒ Trycourier::Models::Tenants::TemplateListResponse

List Templates in Tenant

Parameters:

  • tenant_id (String)

    Id of the tenant for which to retrieve the templates.

  • cursor (String, nil)

    Continue the pagination with the next cursor

  • limit (Integer, nil)

    The number of templates to return (defaults to 20, maximum value of 100)

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

Returns:

See Also:



49
50
51
52
53
54
55
56
57
58
# File 'lib/trycourier/resources/tenants/templates.rb', line 49

def list(tenant_id, params = {})
  parsed, options = Trycourier::Tenants::TemplateListParams.dump_request(params)
  @client.request(
    method: :get,
    path: ["tenants/%1$s/templates", tenant_id],
    query: parsed,
    model: Trycourier::Models::Tenants::TemplateListResponse,
    options: options
  )
end

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

Get a Template in Tenant

Parameters:

  • template_id (String)

    Id of the template to be retrieved.

  • tenant_id (String)

    Id of the tenant for which to retrieve the template.

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

Returns:

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/trycourier/resources/tenants/templates.rb', line 20

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