Class: Pinnacle::Brands::Client
- Inherits:
-
Object
- Object
- Pinnacle::Brands::Client
- Defined in:
- lib/pinnacle/brands/client.rb
Instance Method Summary collapse
-
#autofill(request_options: {}, **params) ⇒ Pinnacle::Types::OptionalBrandInfo
Automatically populate brand information based on partial input data you provide.
-
#get(request_options: {}, **params) ⇒ Pinnacle::Types::ExtendedBrandWithVetting
Retrieve detailed information for a specific brand in your account by ID.
- #initialize(client:) ⇒ void constructor
-
#list(request_options: {}, **params) ⇒ Pinnacle::Types::ListBrandsResponse
List all brands with optional filtering and pagination.
-
#submit(request_options: {}, **params) ⇒ Pinnacle::Types::SubmissionResults
Submit your brand for review and approval by the compliance team.
-
#upsert(request_options: {}, **params) ⇒ Pinnacle::Types::ExtendedBrand
Create a new brand or update an existing one.
-
#validate(request_options: {}, **params) ⇒ Pinnacle::Types::ValidationResults
Validate your brand information for compliance and correctness before submission or storage.
-
#vet(request_options: {}, **params) ⇒ Pinnacle::Types::VettingResults
Submit a brand for external vetting verification to enhance your brand’s trust score and improved message delivery rates.
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/pinnacle/brands/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#autofill(request_options: {}, **params) ⇒ Pinnacle::Types::OptionalBrandInfo
Automatically populate brand information based on partial input data you provide.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/pinnacle/brands/client.rb', line 24 def autofill(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "brands/autofill", body: Pinnacle::Brands::Types::AutofillBrandParams.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::OptionalBrandInfo.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get(request_options: {}, **params) ⇒ Pinnacle::Types::ExtendedBrandWithVetting
Retrieve detailed information for a specific brand in your account by ID.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
# File 'lib/pinnacle/brands/client.rb', line 101 def get(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[hide_ein] query_params = {} query_params["hideEIN"] = params[:hide_ein] if params.key?(:hide_ein) params = params.except(*query_param_names) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "brands/#{params[:id]}", query: query_params, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::ExtendedBrandWithVetting.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list(request_options: {}, **params) ⇒ Pinnacle::Types::ListBrandsResponse
List all brands with optional filtering and pagination. Results are sorted by creation date, newest first.
248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
# File 'lib/pinnacle/brands/client.rb', line 248 def list(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "brands/list", body: Pinnacle::Brands::Types::ListBrandsParams.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::ListBrandsResponse.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#submit(request_options: {}, **params) ⇒ Pinnacle::Types::SubmissionResults
Submit your brand for review and approval by the compliance team.
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/pinnacle/brands/client.rb', line 141 def submit(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "brands/#{params[:brand_id]}/submit", request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::SubmissionResults.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert(request_options: {}, **params) ⇒ Pinnacle::Types::ExtendedBrand
Create a new brand or update an existing one.
<Note> **To create a new brand:** Omit ‘id` — one will be generated automatically.
All fields are required except ‘description` and `dba`, and will be validated when [submitted](/api-reference/brands/submit). </Note>
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/pinnacle/brands/client.rb', line 65 def upsert(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "brands", body: Pinnacle::Brands::Types::UpsertBrandParams.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::ExtendedBrand.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#validate(request_options: {}, **params) ⇒ Pinnacle::Types::ValidationResults
Validate your brand information for compliance and correctness before submission or storage.
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 |
# File 'lib/pinnacle/brands/client.rb', line 174 def validate(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "brands/validate", body: Pinnacle::Types::OptionalBrandInfo.new(params).to_h, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::ValidationResults.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#vet(request_options: {}, **params) ⇒ Pinnacle::Types::VettingResults
Submit a brand for external vetting verification to enhance your brand’s trust score and improved message delivery rates.
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 |
# File 'lib/pinnacle/brands/client.rb', line 210 def vet(request_options: {}, **params) params = Pinnacle::Internal::Types::Utils.normalize_keys(params) request_data = Pinnacle::Brands::Types::VetBrandParams.new(params).to_h non_body_param_names = ["brandId"] body = request_data.except(*non_body_param_names) request = Pinnacle::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "brands/#{params[:brand_id]}/vet", body: body, request_options: ) begin response = @client.send(request) rescue Net::HTTPRequestTimeout raise Pinnacle::Errors::TimeoutError end code = response.code.to_i if code.between?(200, 299) Pinnacle::Types::VettingResults.load(response.body) else error_class = Pinnacle::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |