Class: Wavix::TenDlc::Brands::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/wavix/ten_dlc/brands/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void

Parameters:



10
11
12
# File 'lib/wavix/ten_dlc/brands/client.rb', line 10

def initialize(client:)
  @client = client
end

Instance Method Details

#create(request_options: {}, **params) ⇒ Wavix::TenDlc::Brands::Types::CreateBrandsResponse

Registers a 10DLC Brand. TCR automatically verifies the brand identity. Only brands with VERIFIED or VETTED_VERIFIED identity status can register 10DLC Campaigns.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/wavix/ten_dlc/brands/client.rb', line 87

def create(request_options: {}, **params)
  params = Wavix::Internal::Types::Utils.normalize_keys(params)
  request = Wavix::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "v3/10dlc/brands",
    body: Wavix::Types::TenDlcBrandCreateRequest.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Wavix::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Wavix::TenDlc::Brands::Types::CreateBrandsResponse.load(response.body)
  else
    error_class = Wavix::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#delete(request_options: {}, **params) ⇒ Wavix::TenDlc::Brands::Types::DeleteBrandsResponse

Deletes a 10DLC Brand. Brands with active campaigns cannot be deleted.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :brand_id (String)

Returns:



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/wavix/ten_dlc/brands/client.rb', line 197

def delete(request_options: {}, **params)
  params = Wavix::Internal::Types::Utils.normalize_keys(params)
  request = Wavix::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "DELETE",
    path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Wavix::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Wavix::TenDlc::Brands::Types::DeleteBrandsResponse.load(response.body)
  else
    error_class = Wavix::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get(request_options: {}, **params) ⇒ Wavix::TenDlc::Brands::Types::GetBrandsResponse

Returns the 10DLC Brand identified by brand_id.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :brand_id (String)

Returns:



122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/wavix/ten_dlc/brands/client.rb', line 122

def get(request_options: {}, **params)
  params = Wavix::Internal::Types::Utils.normalize_keys(params)
  request = Wavix::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Wavix::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Wavix::TenDlc::Brands::Types::GetBrandsResponse.load(response.body)
  else
    error_class = Wavix::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list(request_options: {}, **params) ⇒ Wavix::TenDlc::Brands::Types::ListBrandsResponse

Returns a paginated list of 10DLC Brands for the authenticated account, filtered by date, name, legal name, and status.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :dba_name (String, nil)
  • :company_name (String, nil)
  • :entity_type (String, nil)
  • :status (String, nil)
  • :country (String, nil)
  • :show_deleted (Boolean, nil)
  • :ein_taxid (String, nil)
  • :mock (Boolean, nil)
  • :created_before (String, nil)
  • :created_after (String, nil)
  • :page (Integer, nil)
  • :per_page (Integer, nil)

Returns:



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/wavix/ten_dlc/brands/client.rb', line 38

def list(request_options: {}, **params)
  params = Wavix::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["dba_name"] = params[:dba_name] if params.key?(:dba_name)
  query_params["company_name"] = params[:company_name] if params.key?(:company_name)
  query_params["entity_type"] = params[:entity_type] if params.key?(:entity_type)
  query_params["status"] = params[:status] if params.key?(:status)
  query_params["country"] = params[:country] if params.key?(:country)
  query_params["show_deleted"] = params[:show_deleted] if params.key?(:show_deleted)
  query_params["ein_taxid"] = params[:ein_taxid] if params.key?(:ein_taxid)
  query_params["mock"] = params[:mock] if params.key?(:mock)
  query_params["created_before"] = params[:created_before] if params.key?(:created_before)
  query_params["created_after"] = params[:created_after] if params.key?(:created_after)
  query_params["page"] = params[:page] if params.key?(:page)
  query_params["per_page"] = params[:per_page] if params.key?(:per_page)

  request = Wavix::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v3/10dlc/brands",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Wavix::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Wavix::TenDlc::Brands::Types::ListBrandsResponse.load(response.body)
  else
    error_class = Wavix::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#qualify_usecase(request_options: {}, **params) ⇒ Wavix::TenDlc::Brands::Types::QualifyUsecaseBrandsResponse

Returns the qualification results for a 10DLC Brand use case. Includes MNO-specific attributes, restrictions, and fees.

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
# File 'lib/wavix/ten_dlc/brands/client.rb', line 233

def qualify_usecase(request_options: {}, **params)
  params = Wavix::Internal::Types::Utils.normalize_keys(params)
  request = Wavix::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}/usecases/#{URI.encode_uri_component(params[:use_case].to_s)}",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Wavix::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Wavix::TenDlc::Brands::Types::QualifyUsecaseBrandsResponse.load(response.body)
  else
    error_class = Wavix::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#update(request_options: {}, **params) ⇒ Wavix::TenDlc::Brands::Types::UpdateBrandsResponse

Updates the 10DLC Brand identified by brand_id. Changing identity fields, including ein_taxid, ein_taxid_country, and entity_type, resets the Brand status to UNVERIFIED and triggers automatic re-submission. Brands in VETTED_VERIFIED status or with active Campaigns cannot be updated.

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :brand_id (String)

Returns:



158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/wavix/ten_dlc/brands/client.rb', line 158

def update(request_options: {}, **params)
  params = Wavix::Internal::Types::Utils.normalize_keys(params)
  request_data = Wavix::TenDlc::Brands::Types::TenDlcBrandUpdateRequest.new(params).to_h
  non_body_param_names = %w[brand_id]
  body = request_data.except(*non_body_param_names)

  request = Wavix::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}",
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Wavix::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Wavix::TenDlc::Brands::Types::UpdateBrandsResponse.load(response.body)
  else
    error_class = Wavix::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end