Class: Wavix::TenDlc::BrandAppeals::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void

Parameters:



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

def initialize(client:)
  @client = client
end

Instance Method Details

#create(request_options: {}, **params) ⇒ Wavix::TenDlc::BrandAppeals::Types::CreateBrandAppealsResponse

Submits an appeal for 10DLC brand identity verification. Provide any additional documentation to support the appeal. Use appeal_category to specify the appeal type:

  • VERIFY_TAX_ID — Use if the brand is UNVERIFIED due to a tax ID mismatch. Applies to private companies, public companies, non-profits, and government entities.
  • VERIFY_NON_PROFIT — Use if a non-profit brand is UNVERIFIED or VERIFIED but missing tax-exempt status.
  • VERIFY_GOVERNMENT — Use if a government brand is UNVERIFIED or VERIFIED but missing government entity status.

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:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/wavix/ten_dlc/brand_appeals/client.rb', line 64

def create(request_options: {}, **params)
  params = Wavix::Internal::Types::Utils.normalize_keys(params)
  request_data = Wavix::TenDlc::BrandAppeals::Types::CreateBrandAppealsRequest.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: "POST",
    path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}/appeals",
    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::BrandAppeals::Types::CreateBrandAppealsResponse.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) ⇒ Array[Wavix::Types::TenDlcBrandAppeal]

Returns the identity verification appeals submitted for 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:

Raises:

  • (error_class)


26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/wavix/ten_dlc/brand_appeals/client.rb', line 26

def list(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)}/appeals",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Wavix::Errors::TimeoutError
  end
  code = response.code.to_i
  return if code.between?(200, 299)

  error_class = Wavix::Errors::ResponseError.subclass_for_code(code)
  raise error_class.new(response.body, code: code)
end