Class: AdvancedBilling::SubscriptionNotesController
- Inherits:
-
BaseController
- Object
- BaseController
- AdvancedBilling::SubscriptionNotesController
- Defined in:
- lib/advanced_billing/controllers/subscription_notes_controller.rb
Overview
SubscriptionNotesController
Constant Summary
Constants inherited from BaseController
Instance Attribute Summary
Attributes inherited from BaseController
Instance Method Summary collapse
-
#create_subscription_note(subscription_id, body: nil) ⇒ SubscriptionNoteResponse
Use the following method to create a note for a subscription.
-
#delete_subscription_note(subscription_id, note_id) ⇒ void
Use the following method to delete a note for a Subscription.
-
#list_subscription_notes(options = {}) ⇒ Array[SubscriptionNoteResponse]
Use this method to retrieve a list of Notes associated with a Subscription.
-
#read_subscription_note(subscription_id, note_id) ⇒ SubscriptionNoteResponse
Once you have obtained the ID of the note you wish to read, use this method to show a particular note attached to a subscription.
-
#update_subscription_note(subscription_id, note_id, body: nil) ⇒ SubscriptionNoteResponse
Use the following method to update a note for a Subscription.
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_subscription_note(subscription_id, body: nil) ⇒ SubscriptionNoteResponse
Use the following method to create a note for a subscription. ## How to Use Subscription Notes Notes allow you to record information about a particular Subscription in a free text format. If you have structured data such as birth date, color, etc., consider using Metadata instead. Full documentation on how to use Notes in the Advanced Billing UI can be located [here](maxio.zendesk.com/hc/en-us/articles/24251712214413-Subscrip tion-Summary-Overview). the subscription
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/advanced_billing/controllers/subscription_notes_controller.rb', line 23 def create_subscription_note(subscription_id, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/subscriptions/{subscription_id}/notes.json', Server::PRODUCTION) .template_param(new_parameter(subscription_id, key: 'subscription_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(SubscriptionNoteResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |
#delete_subscription_note(subscription_id, note_id) ⇒ void
This method returns an undefined value.
Use the following method to delete a note for a Subscription. the subscription the note
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
# File 'lib/advanced_billing/controllers/subscription_notes_controller.rb', line 154 def delete_subscription_note(subscription_id, note_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::DELETE, '/subscriptions/{subscription_id}/notes/{note_id}.json', Server::PRODUCTION) .template_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(note_id, key: 'note_id') .is_required(true) .should_encode(true)) .auth(Single.new('BasicAuth'))) .response(new_response_handler .is_response_void(true)) .execute end |
#list_subscription_notes(options = {}) ⇒ Array[SubscriptionNoteResponse]
Use this method to retrieve a list of Notes associated with a Subscription. The response will be an array of Notes. the subscription 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`.
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/advanced_billing/controllers/subscription_notes_controller.rb', line 63 def list_subscription_notes( = {}) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/subscriptions/{subscription_id}/notes.json', Server::PRODUCTION) .template_param(new_parameter(['subscription_id'], key: 'subscription_id') .is_required(true) .should_encode(true)) .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'))) .response(new_response_handler .deserializer(APIHelper.method(:custom_type_deserializer)) .deserialize_into(SubscriptionNoteResponse.method(:from_hash)) .is_response_array(true) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |
#read_subscription_note(subscription_id, note_id) ⇒ SubscriptionNoteResponse
Once you have obtained the ID of the note you wish to read, use this method to show a particular note attached to a subscription. the subscription the note
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/advanced_billing/controllers/subscription_notes_controller.rb', line 93 def read_subscription_note(subscription_id, note_id) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/subscriptions/{subscription_id}/notes/{note_id}.json', Server::PRODUCTION) .template_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(note_id, key: 'note_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(SubscriptionNoteResponse.method(:from_hash))) .execute end |
#update_subscription_note(subscription_id, note_id, body: nil) ⇒ SubscriptionNoteResponse
Use the following method to update a note for a Subscription. the subscription the note
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/advanced_billing/controllers/subscription_notes_controller.rb', line 120 def update_subscription_note(subscription_id, note_id, body: nil) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/subscriptions/{subscription_id}/notes/{note_id}.json', Server::PRODUCTION) .template_param(new_parameter(subscription_id, key: 'subscription_id') .is_required(true) .should_encode(true)) .template_param(new_parameter(note_id, key: 'note_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(SubscriptionNoteResponse.method(:from_hash)) .local_error_template('422', 'HTTP Response Not OK. Status code: {$statusCode}.'\ ' Response: \'{$response.body}\'.', ErrorListResponseException)) .execute end |