Class: Dodopayments::Resources::Products::ShortLinks

Inherits:
Object
  • Object
show all
Defined in:
lib/dodopayments/resources/products/short_links.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ShortLinks

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

Parameters:



68
69
70
# File 'lib/dodopayments/resources/products/short_links.rb', line 68

def initialize(client:)
  @client = client
end

Instance Method Details

#create(id, slug:, static_checkout_params: nil, request_options: {}) ⇒ Dodopayments::Models::Products::ShortLinkCreateResponse

Some parameter documentations has been truncated, see Models::Products::ShortLinkCreateParams for more details.

Gives a Short Checkout URL with custom slug for a product. Uses a Static Checkout URL under the hood.

Parameters:

  • id (String)

    Product Id

  • slug (String)

    Slug for the short link.

  • static_checkout_params (Hash{Symbol=>String}, nil)

    Static Checkout URL parameters to apply to the resulting

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

Returns:

See Also:



26
27
28
29
30
31
32
33
34
35
# File 'lib/dodopayments/resources/products/short_links.rb', line 26

def create(id, params)
  parsed, options = Dodopayments::Products::ShortLinkCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["products/%1$s/short_links", id],
    body: parsed,
    model: Dodopayments::Models::Products::ShortLinkCreateResponse,
    options: options
  )
end

#list(page_number: nil, page_size: nil, product_id: nil, request_options: {}) ⇒ Dodopayments::Internal::DefaultPageNumberPagination<Dodopayments::Models::Products::ShortLinkListResponse>

Lists all short links created by the business.

Parameters:

  • page_number (Integer)

    Page number default is 0

  • page_size (Integer)

    Page size default is 10 max is 100

  • product_id (String)

    Filter by product ID

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

Returns:

See Also:



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/dodopayments/resources/products/short_links.rb', line 52

def list(params = {})
  parsed, options = Dodopayments::Products::ShortLinkListParams.dump_request(params)
  query = Dodopayments::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "products/short_links",
    query: query,
    page: Dodopayments::Internal::DefaultPageNumberPagination,
    model: Dodopayments::Models::Products::ShortLinkListResponse,
    options: options
  )
end