Class: Sentdm::Resources::Brands

Inherits:
Object
  • Object
show all
Defined in:
lib/sentdm/resources/brands.rb,
lib/sentdm/resources/brands/campaigns.rb

Overview

Register and manage 10DLC brands for SMS compliance

Defined Under Namespace

Classes: Campaigns

Instance Attribute Summary collapse

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:



124
125
126
127
# File 'lib/sentdm/resources/brands.rb', line 124

def initialize(client:)
  @client = client
  @campaigns = Sentdm::Resources::Brands::Campaigns.new(client: client)
end

Instance Attribute Details

#campaignsSentdm::Resources::Brands::Campaigns (readonly)

Register and manage 10DLC brands for SMS compliance



9
10
11
# File 'lib/sentdm/resources/brands.rb', line 9

def campaigns
  @campaigns
end

Instance Method Details

#create(brand:, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseBrandWithKYC

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

Creates a new brand and associated information. This endpoint automatically sets inheritTcrBrand=false when a brand is created.

Parameters:

  • brand (Sentdm::Models::BrandData)

    Body param: Brand and KYC information

  • test_mode (Boolean)

    Body param: Test mode flag - when true, the operation is simulated without side

  • idempotency_key (String)

    Header param: Unique key to ensure idempotent request processing. Must be 1-255

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

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/sentdm/resources/brands.rb', line 30

def create(params)
  parsed, options = Sentdm::BrandCreateParams.dump_request(params)
  header_params = {idempotency_key: "idempotency-key"}
  @client.request(
    method: :post,
    path: "v3/brands",
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Sentdm::APIResponseBrandWithKYC,
    options: options
  )
end

#delete(brand_id, body:, request_options: {}) ⇒ nil

Delete a brand by ID. The brand must belong to the authenticated customer.

Parameters:

Returns:

  • (nil)

See Also:



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/sentdm/resources/brands.rb', line 109

def delete(brand_id, params)
  parsed, options = Sentdm::BrandDeleteParams.dump_request(params)
  @client.request(
    method: :delete,
    path: ["v3/brands/%1$s", brand_id],
    headers: {"content-type" => "*/*"},
    body: parsed[:body],
    model: NilClass,
    options: options
  )
end

#list(request_options: {}) ⇒ Sentdm::Models::BrandListResponse

Retrieves all brands for the authenticated customer with information in a flattened structure. Includes inherited brands if inheritTcrBrand=true.

Parameters:

Returns:

See Also:



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

def list(params = {})
  @client.request(
    method: :get,
    path: "v3/brands",
    model: Sentdm::Models::BrandListResponse,
    options: params[:request_options]
  )
end

#update(brand_id, brand:, test_mode: nil, idempotency_key: nil, request_options: {}) ⇒ Sentdm::Models::APIResponseBrandWithKYC

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

Updates an existing brand and its associated information. Cannot update brands that have already been submitted to TCR or inherited brands.

Parameters:

  • brand_id (String)

    Path param: Brand ID from route

  • brand (Sentdm::Models::BrandData)

    Body param: Brand and KYC information

  • test_mode (Boolean)

    Body param: Test mode flag - when true, the operation is simulated without side

  • idempotency_key (String)

    Header param: Unique key to ensure idempotent request processing. Must be 1-255

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

Returns:

See Also:



64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/sentdm/resources/brands.rb', line 64

def update(brand_id, params)
  parsed, options = Sentdm::BrandUpdateParams.dump_request(params)
  header_params = {idempotency_key: "idempotency-key"}
  @client.request(
    method: :put,
    path: ["v3/brands/%1$s", brand_id],
    headers: parsed.slice(*header_params.keys).transform_keys(header_params),
    body: parsed.except(*header_params.keys),
    model: Sentdm::APIResponseBrandWithKYC,
    options: options
  )
end