Class: AdvancedBilling::ProductFamiliesController
- Inherits:
-
BaseController
- Object
- BaseController
- AdvancedBilling::ProductFamiliesController
- Defined in:
- lib/advanced_billing/controllers/product_families_controller.rb
Overview
ProductFamiliesController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_product_family(body: nil) ⇒ ProductFamilyResponse
This method will create a Product Family within your Advanced Billing site.
-
#list_product_families(options = {}) ⇒ Array[ProductFamilyResponse]
This method allows to retrieve a list of Product Families for a site.
-
#list_products_for_product_family(options = {}) ⇒ Array[ProductResponse]
This method allows to retrieve a list of Products belonging to a Product Family.
-
#read_product_family(id) ⇒ ProductFamilyResponse
This method allows to retrieve a Product Family via the ‘product_family_id`.
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
#create_product_family(body: nil) ⇒ ProductFamilyResponse
This method will create a Product Family within your Advanced Billing site. Create a Product Family to act as a container for your products, components and coupons. Full documentation on how Product Families operate within the Advanced Billing UI can be located [here](maxio.zendesk.com/hc/en-us/articles/24261098936205-Product- Families).
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/advanced_billing/controllers/product_families_controller.rb', line 93 def create_product_family(body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/product_families.json', Server::DEFAULT) .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(ProductFamilyResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |
#list_product_families(options = {}) ⇒ Array[ProductFamilyResponse]
This method allows to retrieve a list of Product Families for a site. you would like to apply to your search. Use in query: ‘date_field=created_at`. YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site’s time zone will be used. If provided, this parameter will be used instead of start_date. (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site’s time zone will be used. If provided, this parameter will be used instead of end_date.
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
# File 'lib/advanced_billing/controllers/product_families_controller.rb', line 136 def list_product_families( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/product_families.json', Server::DEFAULT) .query_param(new_parameter(['date_field'], key: 'date_field')) .query_param(new_parameter(['start_date'], key: 'start_date')) .query_param(new_parameter(['end_date'], key: 'end_date')) .query_param(new_parameter(['start_datetime'], key: 'start_datetime')) .query_param(new_parameter(['end_datetime'], key: 'end_datetime')) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('BasicAuth'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(ProductFamilyResponse.method(:from_hash)) .is_response_array(true)) .execute end |
#list_products_for_product_family(options = {}) ⇒ Array[ProductResponse]
This method allows to retrieve a list of Products belonging to a Product Family. family’s id or its handle 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 20. The maximum allowed values is 200; any per_page value over 200 will be changed to 200. Use in query `per_page=200`. you would like to apply to your search. Use in query: `date_field=created_at`. List Products operations YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp at or after midnight (12:00:00 AM) in your site’s time zone on the date specified. YYYY-MM-DD) with which to filter the date_field. Returns products with a timestamp up to and including 11:59:59PM in your site’s time zone on the date specified. (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or after exact time provided in query. You can specify timezone in query - otherwise your site’s time zone will be used. If provided, this parameter will be used instead of start_date. (format YYYY-MM-DD HH:MM:SS) with which to filter the date_field. Returns products with a timestamp at or before exact time provided in query. You can specify timezone in query - otherwise your site’s time zone will be used. If provided, this parameter will be used instead of end_date. Include archived products additional data in the response. Use in query ‘include=prepaid_product_price_point`.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/advanced_billing/controllers/product_families_controller.rb', line 53 def list_products_for_product_family( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/product_families/{product_family_id}/products.json', Server::DEFAULT) .template_param(new_parameter(['product_family_id'], key: 'product_family_id') .is_required(true) .should_encode(true)) .query_param(new_parameter(['page'], key: 'page')) .query_param(new_parameter(['per_page'], key: 'per_page')) .query_param(new_parameter(['date_field'], key: 'date_field')) .query_param(new_parameter(['filter'], key: 'filter')) .query_param(new_parameter(['start_date'], key: 'start_date')) .query_param(new_parameter(['end_date'], key: 'end_date')) .query_param(new_parameter(['start_datetime'], key: 'start_datetime')) .query_param(new_parameter(['end_datetime'], key: 'end_datetime')) .query_param(new_parameter(['include_archived'], key: 'include_archived')) .query_param(new_parameter(['include'], key: 'include')) .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(ProductResponse.method(:from_hash)) .is_response_array(true) .local_error('404', 'Not Found', APIException)) .execute end |
#read_product_family(id) ⇒ ProductFamilyResponse
This method allows to retrieve a Product Family via the ‘product_family_id`. The response will contain a Product Family object. The product family can be specified either with the id number, or with the `handle:my-family` format. product family
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/advanced_billing/controllers/product_families_controller.rb', line 162 def read_product_family(id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/product_families/{id}.json', Server::DEFAULT) .template_param(new_parameter(id, key: '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(ProductFamilyResponse.method(:from_hash))) .execute end |