Class: Wavix::TenDlc::BrandEvidence::Client
- Inherits:
-
Object
- Object
- Wavix::TenDlc::BrandEvidence::Client
- Defined in:
- lib/wavix/ten_dlc/brand_evidence/client.rb
Instance Method Summary collapse
-
#delete(request_options: {}, **params) ⇒ Wavix::TenDlc::BrandEvidence::Types::DeleteBrandEvidenceResponse
Deletes the Brand evidence file identified by the evidence ID.
-
#get(request_options: {}, **params) ⇒ untyped
Returns the Brand evidence file identified by the evidence ID.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Wavix::Types::ListBrandEvidenceResponse
Returns the evidence files uploaded for the 10DLC Brand identified by
brand_id. -
#upload(request_options: {}, **params) ⇒ Wavix::TenDlc::BrandEvidence::Types::UploadBrandEvidenceResponse
Uploads a supporting evidence file for the 10DLC Brand identified by
brand_id.
Constructor Details
#initialize(client:) ⇒ void
10 11 12 |
# File 'lib/wavix/ten_dlc/brand_evidence/client.rb', line 10 def initialize(client:) @client = client end |
Instance Method Details
#delete(request_options: {}, **params) ⇒ Wavix::TenDlc::BrandEvidence::Types::DeleteBrandEvidenceResponse
Deletes the Brand evidence file identified by the evidence ID. Deletion is permanent.
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/wavix/ten_dlc/brand_evidence/client.rb', line 134 def delete(request_options: {}, **params) params = Wavix::Internal::Types::Utils.normalize_keys(params) request = Wavix::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}/evidence/#{URI.encode_uri_component(params[:id].to_s)}", 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::BrandEvidence::Types::DeleteBrandEvidenceResponse.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) ⇒ untyped
Returns the Brand evidence file identified by the evidence ID.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/wavix/ten_dlc/brand_evidence/client.rb', line 101 def get(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)}/evidence/#{URI.encode_uri_component(params[:id].to_s)}", 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 |
#list(request_options: {}, **params) ⇒ Wavix::Types::ListBrandEvidenceResponse
Returns the evidence files uploaded 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 45 46 |
# File 'lib/wavix/ten_dlc/brand_evidence/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)}/evidence", 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::ListBrandEvidenceResponse.load(response.body) else error_class = Wavix::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upload(request_options: {}, **params) ⇒ Wavix::TenDlc::BrandEvidence::Types::UploadBrandEvidenceResponse
Uploads a supporting evidence file for the 10DLC Brand identified by brand_id. Supported formats include
.jpg, .png, and .pdf. Maximum size is 10 MB.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/wavix/ten_dlc/brand_evidence/client.rb', line 61 def upload(request_options: {}, **params) params = Wavix::Internal::Types::Utils.normalize_keys(params) body = Internal::Multipart::FormData.new body.add_part(params[:file].to_form_data_part(name: "file")) if params[:file] request = Wavix::Internal::Multipart::Request.new( base_url: [:base_url], method: "POST", path: "v3/10dlc/brands/#{URI.encode_uri_component(params[:brand_id].to_s)}/evidence", 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::TenDlc::BrandEvidence::Types::UploadBrandEvidenceResponse.load(response.body) else error_class = Wavix::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |