Class: Wavix::TenDlc::BrandVettings::Client
- Inherits:
-
Object
- Object
- Wavix::TenDlc::BrandVettings::Client
- Defined in:
- lib/wavix/ten_dlc/brand_vettings/client.rb
Instance Method Summary collapse
-
#create(request_options: {}, **params) ⇒ Wavix::Types::TenDlcBrandVetting
Requests external vetting for a 10DLC Brand.
-
#import(request_options: {}, **params) ⇒ Wavix::Types::TenDlcBrandVetting
Imports an existing external vetting record into the 10DLC Brand identified by
brand_id. - #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Array[Wavix::Types::TenDlcBrandVetting]
Returns the external vettings for the 10DLC Brand identified by
brand_id.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/wavix/ten_dlc/brand_vettings/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#create(request_options: {}, **params) ⇒ Wavix::Types::TenDlcBrandVetting
Requests external vetting for a 10DLC Brand. Supported providers: AEGIS, CV, WMC. Supported classes:
STANDARD, ENHANCED.
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/wavix/ten_dlc/brand_vettings/client.rb', line 59 def create(request_options: {}, **params) params = Wavix::Internal::Types::Utils.normalize_keys(params) request_data = Wavix::TenDlc::BrandVettings::Types::TenDlcBrandVettingCreateRequest.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: [:base_url], method: "POST", path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}/vettings", body: body, 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::Types::TenDlcBrandVetting.load(response.body) else error_class = Wavix::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#import(request_options: {}, **params) ⇒ Wavix::Types::TenDlcBrandVetting
Imports an existing external vetting record into the 10DLC Brand identified by brand_id.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/wavix/ten_dlc/brand_vettings/client.rb', line 98 def import(request_options: {}, **params) params = Wavix::Internal::Types::Utils.normalize_keys(params) request_data = Wavix::TenDlc::BrandVettings::Types::TenDlcBrandVettingImportRequest.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: [:base_url], method: "PUT", path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}/vettings", body: body, 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::Types::TenDlcBrandVetting.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::TenDlcBrandVetting]
Returns the external vettings for the 10DLC Brand identified by brand_id.
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_vettings/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: [:base_url], method: "GET", path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}/vettings", 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 |