Class: Dodopayments::Resources::Brands

Inherits:
Object
  • Object
show all
Defined in:
lib/dodopayments/resources/brands.rb,
sig/dodopayments/resources/brands.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Brands

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

Parameters:



151
152
153
# File 'lib/dodopayments/resources/brands.rb', line 151

def initialize(client:)
  @client = client
end

Instance Method Details

#archive(id, move_products_to: nil, request_options: {}) ⇒ Dodopayments::Models::BrandArchiveResponse

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

Archive a brand. Its products, live subscriptions, and product collections move to the move_products_to brand. Archive is permanent.

Parameters:

  • id (String)

    Brand Id

  • move_products_to (String, nil)

    Brand that takes over the products and the live subscriptions of the

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

Returns:

See Also:



119
120
121
122
123
124
125
126
127
128
# File 'lib/dodopayments/resources/brands.rb', line 119

def archive(id, params = {})
  parsed, options = Dodopayments::BrandArchiveParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["brands/%1$s/archive", id],
    body: parsed,
    model: Dodopayments::Models::BrandArchiveResponse,
    options: options
  )
end

#create(description: nil, name: nil, statement_descriptor: nil, support_email: nil, url: nil, request_options: {}) ⇒ Dodopayments::Models::Brand

Parameters:

  • description (String, nil)
  • name (String, nil)
  • statement_descriptor (String, nil)
  • support_email (String, nil)
  • url (String, nil)
  • request_options (Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



18
19
20
21
22
23
24
25
26
27
# File 'lib/dodopayments/resources/brands.rb', line 18

def create(params = {})
  parsed, options = Dodopayments::BrandCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "brands",
    body: parsed,
    model: Dodopayments::Brand,
    options: options
  )
end

#list(include_archived: nil, request_options: {}) ⇒ Dodopayments::Models::BrandListResponse

Parameters:

  • include_archived (Boolean)

    Set to true to also list archived brands. Default false.

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

Returns:

See Also:



90
91
92
93
94
95
96
97
98
99
100
# File 'lib/dodopayments/resources/brands.rb', line 90

def list(params = {})
  parsed, options = Dodopayments::BrandListParams.dump_request(params)
  query = Dodopayments::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "brands",
    query: query,
    model: Dodopayments::Models::BrandListResponse,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ Dodopayments::Models::Brand

Thin handler just calls get_brand and wraps in Json(...)

Parameters:

Returns:

See Also:



40
41
42
43
44
45
46
47
# File 'lib/dodopayments/resources/brands.rb', line 40

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["brands/%1$s", id],
    model: Dodopayments::Brand,
    options: params[:request_options]
  )
end

#update(id, description: nil, image_id: nil, name: nil, statement_descriptor: nil, support_email: nil, url: nil, request_options: {}) ⇒ Dodopayments::Models::Brand

Parameters:

  • id (String)

    Brand Id

  • description (String, nil)
  • image_id (String, nil)

    The UUID you got back from the presigned‐upload call

  • name (String, nil)
  • statement_descriptor (String, nil)
  • support_email (String, nil)
  • url (String, nil)
  • request_options (Dodopayments::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



70
71
72
73
74
75
76
77
78
79
# File 'lib/dodopayments/resources/brands.rb', line 70

def update(id, params = {})
  parsed, options = Dodopayments::BrandUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["brands/%1$s", id],
    body: parsed,
    model: Dodopayments::Brand,
    options: options
  )
end

#update_images(id, request_options: {}) ⇒ Dodopayments::Models::BrandUpdateImagesResponse

Parameters:

Returns:

See Also:



139
140
141
142
143
144
145
146
# File 'lib/dodopayments/resources/brands.rb', line 139

def update_images(id, params = {})
  @client.request(
    method: :put,
    path: ["brands/%1$s/images", id],
    model: Dodopayments::Models::BrandUpdateImagesResponse,
    options: params[:request_options]
  )
end