Class: AdvancedBilling::ProductPricePointsController
- Inherits:
-
BaseController
- Object
- BaseController
- AdvancedBilling::ProductPricePointsController
- Defined in:
- lib/advanced_billing/controllers/product_price_points_controller.rb
Overview
ProductPricePointsController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#archive_product_price_point(product_id, price_point_id) ⇒ ProductPricePointResponse
Use this endpoint to archive a product price point.
-
#bulk_create_product_price_points(product_id, body: nil) ⇒ BulkCreateProductPricePointsResponse
Use this endpoint to create multiple product price points in one request.
-
#create_product_currency_prices(product_price_point_id, body: nil) ⇒ CurrencyPricesResponse
This endpoint allows you to create currency prices for a given currency that has been defined on the site level in your settings.
-
#create_product_price_point(product_id, body: nil) ⇒ ProductPricePointResponse
[Product Price Point Documentation](maxio.zendesk.com/hc/en-us/articles/24261111947789- Product-Price-Points) of the product.
-
#list_all_product_price_points(options = {}) ⇒ ListProductPricePointsResponse
This method allows retrieval of a list of Products Price Points belonging to a Site.
-
#list_product_price_points(options = {}) ⇒ ListProductPricePointsResponse
Use this endpoint to retrieve a list of product price points.
-
#promote_product_price_point_to_default(product_id, price_point_id) ⇒ ProductResponse
Use this endpoint to make a product price point the default for the product.
-
#read_product_price_point(product_id, price_point_id, currency_prices: nil) ⇒ ProductPricePointResponse
Use this endpoint to retrieve details for a specific product price point.
-
#unarchive_product_price_point(product_id, price_point_id) ⇒ ProductPricePointResponse
Use this endpoint to unarchive an archived product price point.
-
#update_product_currency_prices(product_price_point_id, body: nil) ⇒ CurrencyPricesResponse
This endpoint allows you to update the ‘price`s of currency prices for a given currency that exists on the product price point.
-
#update_product_price_point(product_id, price_point_id, body: nil) ⇒ ProductPricePointResponse
Use this endpoint to update a product price point.
Methods inherited from BaseController
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from AdvancedBilling::BaseController
Instance Method Details
#archive_product_price_point(product_id, price_point_id) ⇒ ProductPricePointResponse
Use this endpoint to archive a product price point. of the product. When using the handle, it must be prefixed with ‘handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle. handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-price-point-handle` for a string handle.
199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 199 def archive_product_price_point(product_id, price_point_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/products/{product_id}/price_points/{price_point_id}.json', Server::DEFAULT) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true) .validator(proc do |value| UnionTypeLookUp.get(:ArchiveProductPricePointProductId) .validate(value) end)) .template_param(new_parameter(price_point_id, key: 'price_point_id') .is_required(true) .should_encode(true) .validator(proc do |value| UnionTypeLookUp.get(:ArchiveProductPricePointPricePointId) .validate(value) end)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ProductPricePointResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |
#bulk_create_product_price_points(product_id, body: nil) ⇒ BulkCreateProductPricePointsResponse
Use this endpoint to create multiple product price points in one request. the product to which the price points belong Example:
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 292 def bulk_create_product_price_points(product_id, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/products/{product_id}/price_points/bulk.json', Server::DEFAULT) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(BulkCreateProductPricePointsResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', APIException)) .execute end |
#create_product_currency_prices(product_price_point_id, body: nil) ⇒ CurrencyPricesResponse
This endpoint allows you to create currency prices for a given currency that has been defined on the site level in your settings. When creating currency prices, they need to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. Note: Currency Prices are not able to be created for custom product price points. Billing id of the product price point Example:
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 328 def create_product_currency_prices(product_price_point_id, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/product_price_points/{product_price_point_id}/currency_prices.json', Server::DEFAULT) .template_param(new_parameter(product_price_point_id, key: 'product_price_point_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(CurrencyPricesResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorArrayMapResponseException)) .execute end |
#create_product_price_point(product_id, body: nil) ⇒ ProductPricePointResponse
[Product Price Point Documentation](maxio.zendesk.com/hc/en-us/articles/24261111947789- Product-Price-Points) of the product. When using the handle, it must be prefixed with ‘handle:` Example:
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 18 def create_product_price_point(product_id, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/products/{product_id}/price_points.json', Server::DEFAULT) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true) .validator(proc do |value| UnionTypeLookUp.get(:CreateProductPricePointProductId) .validate(value) end)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ProductPricePointResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ProductPricePointErrorResponseException)) .execute end |
#list_all_product_price_points(options = {}) ⇒ ListProductPricePointsResponse
This method allows retrieval of a list of Products Price Points belonging to a Site. in which results are returned. Use in query ‘direction=asc`. for List PricePoints operations including additional data in the response. Use in query: `include=currency_prices`. pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned. Use in query `page=1`. many records to fetch in each request. Default value is 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200. Use in query `per_page=200`.
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 408 def list_all_product_price_points( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/products_price_points.json', Server::DEFAULT) .query_param(new_parameter(['direction'], key: 'direction')) .query_param(new_parameter(['filter'], key: 'filter')) .query_param(new_parameter(['include'], key: 'include')) .query_param(new_parameter(['page'], key: 'page')) .query_param(new_parameter(['per_page'], key: 'per_page')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth')) .array_serialization_format(ArraySerializationFormat::CSV)) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ListProductPricePointsResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |
#list_product_price_points(options = {}) ⇒ ListProductPricePointsResponse
Use this endpoint to retrieve a list of product price points. of the product. When using the handle, it must be prefixed with ‘handle:` pages. By default, the first page of results is displayed. The page parameter specifies a page number of results to fetch. You can start navigating through the pages to consume the results. You do this by passing in a page parameter. Retrieve the next page by adding ?page=2 to the query string. If there are no results to return, then an empty result set will be returned. Use in query `page=1`. many records to fetch in each request. Default value is 10. The maximum allowed values is 200; any per_page value over 200 will be changed to 200. fetching a product’s price points, if you have defined multiple currencies at the site level, you can optionally pass the ?currency_prices=true query param to include an array of currency price data in the response. If the product price point is set to use_site_exchange_rate: true, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency. query: ‘filter=catalog,default`.
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 71 def list_product_price_points( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/products/{product_id}/price_points.json', Server::DEFAULT) .template_param(new_parameter(['product_id'], key: 'product_id') .is_required(true) .should_encode(true) .validator(proc do |value| UnionTypeLookUp.get(:ListProductPricePointsInputProductId) .validate(value) end)) .query_param(new_parameter(['page'], key: 'page')) .query_param(new_parameter(['per_page'], key: 'per_page')) .query_param(new_parameter(['currency_prices'], key: 'currency_prices')) .query_param(new_parameter(['filter_type'], key: 'filter[type]')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth')) .array_serialization_format(ArraySerializationFormat::CSV)) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ListProductPricePointsResponse.method(:from_hash))) .execute end |
#promote_product_price_point_to_default(product_id, price_point_id) ⇒ ProductResponse
Use this endpoint to make a product price point the default for the product. Note: Custom product price points are not able to be set as the default for a product. the product to which the price point belongs id of the product price point
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 266 def promote_product_price_point_to_default(product_id, price_point_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PATCH, '/products/{product_id}/price_points/{price_point_id}/default.json', Server::DEFAULT) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(price_point_id, key: 'price_point_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ProductResponse.method(:from_hash))) .execute end |
#read_product_price_point(product_id, price_point_id, currency_prices: nil) ⇒ ProductPricePointResponse
Use this endpoint to retrieve details for a specific product price point. You can achieve this by using either the product price point ID or handle. of the product. When using the handle, it must be prefixed with ‘handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle. handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-price-point-handle` for a string handle. fetching a product’s price points, if you have defined multiple currencies at the site level, you can optionally pass the ?currency_prices=true query param to include an array of currency price data in the response. If the product price point is set to use_site_exchange_rate: true, it will return pricing based on the current exchange rate. If the flag is set to false, it will return all of the defined prices for each currency.
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 184 185 186 187 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 159 def read_product_price_point(product_id, price_point_id, currency_prices: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/products/{product_id}/price_points/{price_point_id}.json', Server::DEFAULT) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true) .validator(proc do |value| UnionTypeLookUp.get(:ReadProductPricePointProductId) .validate(value) end)) .template_param(new_parameter(price_point_id, key: 'price_point_id') .is_required(true) .should_encode(true) .validator(proc do |value| UnionTypeLookUp.get(:ReadProductPricePointPricePointId) .validate(value) end)) .query_param(new_parameter(currency_prices, key: 'currency_prices')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ProductPricePointResponse.method(:from_hash))) .execute end |
#unarchive_product_price_point(product_id, price_point_id) ⇒ ProductPricePointResponse
Use this endpoint to unarchive an archived product price point. the product to which the price point belongs id of the product price point
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 237 def unarchive_product_price_point(product_id, price_point_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PATCH, '/products/{product_id}/price_points/{price_point_id}/unarchive.json', Server::DEFAULT) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(price_point_id, key: 'price_point_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ProductPricePointResponse.method(:from_hash))) .execute end |
#update_product_currency_prices(product_price_point_id, body: nil) ⇒ CurrencyPricesResponse
This endpoint allows you to update the ‘price`s of currency prices for a given currency that exists on the product price point. When updating the pricing, it needs to mirror the structure of your primary pricing. If the product price point defines a trial and/or setup fee, each currency must also define a trial and/or setup fee. Note: Currency Prices are not able to be updated for custom product price points. Billing id of the product price point
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 363 def update_product_currency_prices(product_price_point_id, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/product_price_points/{product_price_point_id}/currency_prices.json', Server::DEFAULT) .template_param(new_parameter(product_price_point_id, key: 'product_price_point_id') .is_required(true) .should_encode(true)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(CurrencyPricesResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorArrayMapResponseException)) .execute end |
#update_product_price_point(product_id, price_point_id, body: nil) ⇒ ProductPricePointResponse
Use this endpoint to update a product price point. Note: Custom product price points are not able to be updated. of the product. When using the handle, it must be prefixed with ‘handle:`. Example: `123` for an integer ID, or `handle:example-product-handle` for a string handle. handle of the price point. When using the handle, it must be prefixed with `handle:`. Example: `123` for an integer ID, or `handle:example-product-price-point-handle` for a string handle. Example:
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/advanced_billing/controllers/product_price_points_controller.rb', line 109 def update_product_price_point(product_id, price_point_id, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/products/{product_id}/price_points/{price_point_id}.json', Server::DEFAULT) .template_param(new_parameter(product_id, key: 'product_id') .is_required(true) .should_encode(true) .validator(proc do |value| UnionTypeLookUp.get(:UpdateProductPricePointProductId) .validate(value) end)) .template_param(new_parameter(price_point_id, key: 'price_point_id') .is_required(true) .should_encode(true) .validator(proc do |value| UnionTypeLookUp.get(:UpdateProductPricePointPricePointId) .validate(value) end)) .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ProductPricePointResponse.method(:from_hash))) .execute end |