Class: SquareConnect::RefundApi
- Inherits:
-
Object
- Object
- SquareConnect::RefundApi
- Defined in:
- lib/square_connect/api/refund_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_refund(authorization, location_id, transaction_id, body, opts = {}) ⇒ CreateRefundResponse
CreateRefund Initiates a refund for a previously charged tender.
-
#create_refund_with_http_info(authorization, location_id, transaction_id, body, opts = {}) ⇒ Array<(CreateRefundResponse, Fixnum, Hash)>
CreateRefund Initiates a refund for a previously charged tender.
-
#initialize(api_client = ApiClient.default) ⇒ RefundApi
constructor
A new instance of RefundApi.
-
#list_refunds(authorization, location_id, opts = {}) ⇒ ListRefundsResponse
ListRefunds Lists refunds for one of a business's locations.
-
#list_refunds_with_http_info(authorization, location_id, opts = {}) ⇒ Array<(ListRefundsResponse, Fixnum, Hash)>
ListRefunds Lists refunds for one of a business's locations.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
15 16 17 |
# File 'lib/square_connect/api/refund_api.rb', line 15 def api_client @api_client end |
Instance Method Details
#create_refund(authorization, location_id, transaction_id, body, opts = {}) ⇒ CreateRefundResponse
CreateRefund Initiates a refund for a previously charged tender.
111 112 113 114 |
# File 'lib/square_connect/api/refund_api.rb', line 111 def create_refund(, location_id, transaction_id, body, opts = {}) data, status_code, headers = create_refund_with_http_info(, location_id, transaction_id, body, opts) return data end |
#create_refund_with_http_info(authorization, location_id, transaction_id, body, opts = {}) ⇒ Array<(CreateRefundResponse, Fixnum, Hash)>
CreateRefund Initiates a refund for a previously charged tender.
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 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/square_connect/api/refund_api.rb', line 124 def create_refund_with_http_info(, location_id, transaction_id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundApi#create_refund ..." end # verify the required parameter 'authorization' is set fail "Missing the required parameter 'authorization' when calling create_refund" if .nil? # verify the required parameter 'location_id' is set fail "Missing the required parameter 'location_id' when calling create_refund" if location_id.nil? # verify the required parameter 'transaction_id' is set fail "Missing the required parameter 'transaction_id' when calling create_refund" if transaction_id.nil? # verify the required parameter 'body' is set fail "Missing the required parameter 'body' when calling create_refund" if body.nil? # resource path path = "/v2/locations/{location_id}/transactions/{transaction_id}/refund".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s).sub('{' + 'transaction_id' + '}', transaction_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 => 'CreateRefundResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundApi#create_refund\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#list_refunds(authorization, location_id, opts = {}) ⇒ ListRefundsResponse
ListRefunds Lists refunds for one of a business's locations.
31 32 33 34 |
# File 'lib/square_connect/api/refund_api.rb', line 31 def list_refunds(, location_id, opts = {}) data, status_code, headers = list_refunds_with_http_info(, location_id, opts) return data end |
#list_refunds_with_http_info(authorization, location_id, opts = {}) ⇒ Array<(ListRefundsResponse, Fixnum, Hash)>
ListRefunds Lists refunds for one of a business's locations.
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 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/square_connect/api/refund_api.rb', line 46 def list_refunds_with_http_info(, location_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: RefundApi#list_refunds ..." end # verify the required parameter 'authorization' is set fail "Missing the required parameter 'authorization' when calling list_refunds" if .nil? # verify the required parameter 'location_id' is set fail "Missing the required parameter 'location_id' when calling list_refunds" if location_id.nil? if opts[:'sort_order'] && !['DESC', 'ASC'].include?(opts[:'sort_order']) fail 'invalid value for "sort_order", must be one of DESC, ASC' end # resource path path = "/v2/locations/{location_id}/refunds".sub('{format}','json').sub('{' + 'location_id' + '}', location_id.to_s) # query parameters query_params = {} query_params[:'begin_time'] = opts[:'begin_time'] if opts[:'begin_time'] query_params[:'end_time'] = opts[:'end_time'] if opts[:'end_time'] query_params[:'sort_order'] = opts[:'sort_order'] if opts[:'sort_order'] query_params[:'cursor'] = opts[:'cursor'] if opts[:'cursor'] # 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(:GET, path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'ListRefundsResponse') if @api_client.config.debugging @api_client.config.logger.debug "API called: RefundApi#list_refunds\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |