Class: SquareConnect::CustomerCardApi
- Inherits:
-
Object
- Object
- SquareConnect::CustomerCardApi
- Defined in:
- lib/square_connect/api/customer_card_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_customer_card(authorization, customer_id, body, opts = {}) ⇒ CreateCustomerCardResponse
CreateCustomerCard Adds a card on file to an existing customer.
-
#create_customer_card_with_http_info(authorization, customer_id, body, opts = {}) ⇒ Array<(CreateCustomerCardResponse, Fixnum, Hash)>
CreateCustomerCard Adds a card on file to an existing customer.
-
#delete_customer_card(authorization, customer_id, card_id, opts = {}) ⇒ DeleteCustomerCardResponse
DeleteCustomerCard Removes a card on file from a customer.
-
#delete_customer_card_with_http_info(authorization, customer_id, card_id, opts = {}) ⇒ Array<(DeleteCustomerCardResponse, Fixnum, Hash)>
DeleteCustomerCard Removes a card on file from a customer.
-
#initialize(api_client = ApiClient.default) ⇒ CustomerCardApi
constructor
A new instance of CustomerCardApi.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ CustomerCardApi
Returns a new instance of CustomerCardApi.
17 18 19 |
# File 'lib/square_connect/api/customer_card_api.rb', line 17 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
15 16 17 |
# File 'lib/square_connect/api/customer_card_api.rb', line 15 def api_client @api_client end |
Instance Method Details
#create_customer_card(authorization, customer_id, body, opts = {}) ⇒ CreateCustomerCardResponse
CreateCustomerCard Adds a card on file to an existing customer.
28 29 30 31 |
# File 'lib/square_connect/api/customer_card_api.rb', line 28 def create_customer_card(, customer_id, body, opts = {}) data, status_code, headers = create_customer_card_with_http_info(, customer_id, body, opts) return data end |
#create_customer_card_with_http_info(authorization, customer_id, body, opts = {}) ⇒ Array<(CreateCustomerCardResponse, Fixnum, Hash)>
CreateCustomerCard Adds a card on file to an existing customer.
40 41 42 43 44 45 46 47 48 49 50 51 52 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 83 84 85 86 87 88 89 90 |
# File 'lib/square_connect/api/customer_card_api.rb', line 40 def create_customer_card_with_http_info(, customer_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CustomerCardApi#create_customer_card ..." end # verify the required parameter 'authorization' is set fail "Missing the required parameter 'authorization' when calling create_customer_card" if .nil? # verify the required parameter 'customer_id' is set fail "Missing the required parameter 'customer_id' when calling create_customer_card" if customer_id.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling create_customer_card" if body.nil? # resource path path = "/v2/customers/{customer_id}/cards".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) header_params[:'Authorization'] = # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(body) auth_names = [] data, status_code, headers = @api_client.call_api(:POST, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'CreateCustomerCardResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerCardApi#create_customer_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#delete_customer_card(authorization, customer_id, card_id, opts = {}) ⇒ DeleteCustomerCardResponse
DeleteCustomerCard Removes a card on file from a customer.
99 100 101 102 |
# File 'lib/square_connect/api/customer_card_api.rb', line 99 def delete_customer_card(, customer_id, card_id, opts = {}) data, status_code, headers = delete_customer_card_with_http_info(, customer_id, card_id, opts) return data end |
#delete_customer_card_with_http_info(authorization, customer_id, card_id, opts = {}) ⇒ Array<(DeleteCustomerCardResponse, Fixnum, Hash)>
DeleteCustomerCard Removes a card on file from a customer.
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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/square_connect/api/customer_card_api.rb', line 111 def delete_customer_card_with_http_info(, customer_id, card_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: CustomerCardApi#delete_customer_card ..." end # verify the required parameter 'authorization' is set fail "Missing the required parameter 'authorization' when calling delete_customer_card" if .nil? # verify the required parameter 'customer_id' is set fail "Missing the required parameter 'customer_id' when calling delete_customer_card" if customer_id.nil? # verify the required parameter 'card_id' is set fail "Missing the required parameter 'card_id' when calling delete_customer_card" if card_id.nil? # resource path path = "/v2/customers/{customer_id}/cards/{card_id}".sub('{format}','json').sub('{' + 'customer_id' + '}', customer_id.to_s).sub('{' + 'card_id' + '}', card_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) _header_accept = ['application/json'] _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result # HTTP header 'Content-Type' _header_content_type = ['application/json'] header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type) header_params[:'Authorization'] = # form parameters form_params = {} # http body (model) post_body = nil auth_names = [] data, status_code, headers = @api_client.call_api(:DELETE, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'DeleteCustomerCardResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: CustomerCardApi#delete_customer_card\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |