Class: Dodopayments::Resources::Brands

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

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:



118
119
120
# File 'lib/dodopayments/resources/brands.rb', line 118

def initialize(client:)
  @client = client
end

Instance Method Details

#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(request_options: {}) ⇒ Dodopayments::Models::BrandListResponse

Parameters:

Returns:

See Also:



88
89
90
91
92
93
94
95
# File 'lib/dodopayments/resources/brands.rb', line 88

def list(params = {})
  @client.request(
    method: :get,
    path: "brands",
    model: Dodopayments::Models::BrandListResponse,
    options: params[:request_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:



106
107
108
109
110
111
112
113
# File 'lib/dodopayments/resources/brands.rb', line 106

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