square_connect 2.0.0 → 2.0.2.13
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +7 -0
- data/README.md +151 -9
- data/Rakefile +8 -0
- data/docs/Address.md +26 -0
- data/docs/CaptureTransactionRequest.md +11 -0
- data/docs/CaptureTransactionResponse.md +12 -0
- data/docs/Card.md +18 -0
- data/docs/CardBrand.md +20 -0
- data/docs/ChargeRequest.md +22 -0
- data/docs/ChargeResponse.md +13 -0
- data/docs/Checkout.md +20 -0
- data/docs/CheckoutApi.md +62 -0
- data/docs/Country.md +261 -0
- data/docs/CreateCheckoutRequest.md +18 -0
- data/docs/CreateCheckoutResponse.md +13 -0
- data/docs/CreateCustomerCardRequest.md +14 -0
- data/docs/CreateCustomerCardResponse.md +13 -0
- data/docs/CreateCustomerRequest.md +20 -0
- data/docs/CreateCustomerResponse.md +13 -0
- data/docs/CreateOrderRequest.md +13 -0
- data/docs/CreateOrderRequestLineItem.md +14 -0
- data/docs/CreateOrderRequestOrder.md +13 -0
- data/docs/CreateRefundRequest.md +15 -0
- data/docs/CreateRefundResponse.md +13 -0
- data/docs/Currency.md +191 -0
- data/docs/Customer.md +26 -0
- data/docs/CustomerApi.md +267 -0
- data/docs/CustomerCardApi.md +116 -0
- data/docs/CustomerGroupInfo.md +13 -0
- data/docs/CustomerPreferences.md +12 -0
- data/docs/DeleteCustomerCardRequest.md +11 -0
- data/docs/DeleteCustomerCardResponse.md +12 -0
- data/docs/DeleteCustomerRequest.md +11 -0
- data/docs/DeleteCustomerResponse.md +12 -0
- data/docs/Error.md +15 -0
- data/docs/ErrorCategory.md +17 -0
- data/docs/ErrorCode.md +83 -0
- data/docs/ListCustomersRequest.md +12 -0
- data/docs/ListCustomersResponse.md +14 -0
- data/docs/ListLocationsRequest.md +11 -0
- data/docs/ListLocationsResponse.md +13 -0
- data/docs/ListRefundsRequest.md +15 -0
- data/docs/ListRefundsResponse.md +14 -0
- data/docs/ListTransactionsRequest.md +15 -0
- data/docs/ListTransactionsResponse.md +14 -0
- data/docs/Location.md +16 -0
- data/docs/LocationApi.md +56 -0
- data/docs/LocationCapability.md +12 -0
- data/docs/Money.md +13 -0
- data/docs/Order.md +16 -0
- data/docs/OrderLineItem.md +16 -0
- data/docs/Refund.md +20 -0
- data/docs/RefundApi.md +126 -0
- data/docs/RefundStatus.md +15 -0
- data/docs/RetrieveCustomerRequest.md +11 -0
- data/docs/RetrieveCustomerResponse.md +13 -0
- data/docs/RetrieveTransactionRequest.md +11 -0
- data/docs/RetrieveTransactionResponse.md +13 -0
- data/docs/SortOrder.md +13 -0
- data/docs/Tender.md +22 -0
- data/docs/TenderCardDetails.md +14 -0
- data/docs/TenderCardDetailsEntryMethod.md +16 -0
- data/docs/TenderCardDetailsStatus.md +15 -0
- data/docs/TenderCashDetails.md +13 -0
- data/docs/TenderType.md +17 -0
- data/docs/Transaction.md +21 -0
- data/docs/TransactionApi.md +285 -0
- data/docs/TransactionProduct.md +19 -0
- data/docs/UpdateCustomerRequest.md +20 -0
- data/docs/UpdateCustomerResponse.md +13 -0
- data/docs/VoidTransactionRequest.md +11 -0
- data/docs/VoidTransactionResponse.md +12 -0
- data/lib/square_connect.rb +33 -16
- data/lib/square_connect/api/checkout_api.rb +82 -0
- data/lib/square_connect/api/customer_api.rb +121 -162
- data/lib/square_connect/api/customer_card_api.rb +31 -50
- data/lib/square_connect/api/location_api.rb +12 -20
- data/lib/square_connect/api/refund_api.rb +70 -90
- data/lib/square_connect/api/transaction_api.rb +119 -165
- data/lib/square_connect/api_client.rb +64 -17
- data/lib/square_connect/api_error.rb +7 -3
- data/lib/square_connect/configuration.rb +31 -1
- data/lib/square_connect/models/address.rb +149 -78
- data/lib/square_connect/models/capture_transaction_request.rb +176 -0
- data/lib/square_connect/models/capture_transaction_response.rb +54 -26
- data/lib/square_connect/models/card.rb +98 -52
- data/lib/square_connect/models/card_brand.rb +12 -133
- data/lib/square_connect/models/charge_request.rb +106 -67
- data/lib/square_connect/models/charge_response.rb +57 -30
- data/lib/square_connect/models/checkout.rb +266 -0
- data/lib/square_connect/models/country.rb +253 -133
- data/lib/square_connect/models/create_checkout_request.rb +316 -0
- data/lib/square_connect/models/create_checkout_response.rb +198 -0
- data/lib/square_connect/models/create_customer_card_request.rb +66 -35
- data/lib/square_connect/models/create_customer_card_response.rb +58 -31
- data/lib/square_connect/models/create_customer_request.rb +79 -59
- data/lib/square_connect/models/create_customer_response.rb +58 -31
- data/lib/square_connect/models/create_order_request.rb +234 -0
- data/lib/square_connect/models/create_order_request_line_item.rb +268 -0
- data/lib/square_connect/models/create_order_request_order.rb +219 -0
- data/lib/square_connect/models/create_refund_request.rb +79 -39
- data/lib/square_connect/models/create_refund_response.rb +57 -30
- data/lib/square_connect/models/currency.rb +183 -133
- data/lib/square_connect/models/customer.rb +130 -77
- data/lib/square_connect/models/customer_group_info.rb +206 -0
- data/lib/square_connect/models/customer_preferences.rb +186 -0
- data/lib/square_connect/models/delete_customer_card_request.rb +176 -0
- data/lib/square_connect/models/delete_customer_card_response.rb +55 -27
- data/lib/square_connect/models/delete_customer_request.rb +176 -0
- data/lib/square_connect/models/delete_customer_response.rb +55 -27
- data/lib/square_connect/models/error.rb +107 -45
- data/lib/square_connect/models/error_category.rb +9 -133
- data/lib/square_connect/models/error_code.rb +75 -133
- data/lib/square_connect/models/list_customers_request.rb +55 -27
- data/lib/square_connect/models/list_customers_response.rb +61 -35
- data/lib/square_connect/models/list_locations_request.rb +176 -0
- data/lib/square_connect/models/list_locations_response.rb +57 -30
- data/lib/square_connect/models/list_refunds_request.rb +91 -42
- data/lib/square_connect/models/list_refunds_response.rb +59 -33
- data/lib/square_connect/models/list_transactions_request.rb +91 -42
- data/lib/square_connect/models/list_transactions_response.rb +59 -33
- data/lib/square_connect/models/location.rb +86 -41
- data/lib/square_connect/models/location_capability.rb +4 -133
- data/lib/square_connect/models/money.rb +85 -34
- data/lib/square_connect/models/order.rb +228 -0
- data/lib/square_connect/models/order_line_item.rb +226 -0
- data/lib/square_connect/models/refund.rb +138 -59
- data/lib/square_connect/models/refund_status.rb +7 -133
- data/lib/square_connect/models/retrieve_customer_request.rb +176 -0
- data/lib/square_connect/models/retrieve_customer_response.rb +58 -31
- data/lib/square_connect/models/retrieve_transaction_request.rb +176 -0
- data/lib/square_connect/models/retrieve_transaction_response.rb +57 -30
- data/lib/square_connect/models/sort_order.rb +5 -133
- data/lib/square_connect/models/tender.rb +112 -65
- data/lib/square_connect/models/tender_card_details.rb +93 -40
- data/lib/square_connect/models/tender_card_details_entry_method.rb +8 -133
- data/lib/square_connect/models/tender_card_details_status.rb +7 -133
- data/lib/square_connect/models/tender_cash_details.rb +58 -31
- data/lib/square_connect/models/tender_type.rb +9 -133
- data/lib/square_connect/models/transaction.rb +132 -56
- data/lib/square_connect/models/transaction_product.rb +11 -133
- data/lib/square_connect/models/update_customer_request.rb +79 -59
- data/lib/square_connect/models/update_customer_response.rb +58 -31
- data/lib/square_connect/models/void_transaction_request.rb +176 -0
- data/lib/square_connect/models/void_transaction_response.rb +54 -26
- data/lib/square_connect/version.rb +2 -3
- data/spec/api/checkout_api_spec.rb +53 -0
- data/spec/api/customer_api_spec.rb +121 -0
- data/spec/api/customer_card_api_spec.rb +71 -0
- data/spec/api/location_api_spec.rb +58 -0
- data/spec/api/refund_api_spec.rb +75 -0
- data/spec/api/transaction_api_spec.rb +128 -0
- data/spec/api_client_spec.rb +226 -0
- data/spec/configuration_spec.rb +42 -0
- data/spec/models/address_spec.rb +186 -0
- data/spec/models/capture_transaction_request_spec.rb +36 -0
- data/spec/models/capture_transaction_response_spec.rb +46 -0
- data/spec/models/card_brand_spec.rb +36 -0
- data/spec/models/card_spec.rb +106 -0
- data/spec/models/charge_request_spec.rb +146 -0
- data/spec/models/charge_response_spec.rb +56 -0
- data/spec/models/checkout_spec.rb +126 -0
- data/spec/models/country_spec.rb +36 -0
- data/spec/models/create_checkout_request_spec.rb +106 -0
- data/spec/models/create_checkout_response_spec.rb +56 -0
- data/spec/models/create_customer_card_request_spec.rb +66 -0
- data/spec/models/create_customer_card_response_spec.rb +56 -0
- data/spec/models/create_customer_request_spec.rb +126 -0
- data/spec/models/create_customer_response_spec.rb +56 -0
- data/spec/models/create_order_request_line_item_spec.rb +66 -0
- data/spec/models/create_order_request_order_spec.rb +56 -0
- data/spec/models/create_order_request_spec.rb +56 -0
- data/spec/models/create_refund_request_spec.rb +76 -0
- data/spec/models/create_refund_response_spec.rb +56 -0
- data/spec/models/currency_spec.rb +36 -0
- data/spec/models/customer_group_info_spec.rb +56 -0
- data/spec/models/customer_preferences_spec.rb +46 -0
- data/spec/models/customer_spec.rb +186 -0
- data/spec/models/delete_customer_card_request_spec.rb +36 -0
- data/spec/models/delete_customer_card_response_spec.rb +46 -0
- data/spec/models/delete_customer_request_spec.rb +36 -0
- data/spec/models/delete_customer_response_spec.rb +46 -0
- data/spec/models/error_category_spec.rb +36 -0
- data/spec/models/error_code_spec.rb +36 -0
- data/spec/models/error_spec.rb +76 -0
- data/spec/models/list_customers_request_spec.rb +46 -0
- data/spec/models/list_customers_response_spec.rb +66 -0
- data/spec/models/list_locations_request_spec.rb +36 -0
- data/spec/models/list_locations_response_spec.rb +56 -0
- data/spec/models/list_refunds_request_spec.rb +76 -0
- data/spec/models/list_refunds_response_spec.rb +66 -0
- data/spec/models/list_transactions_request_spec.rb +76 -0
- data/spec/models/list_transactions_response_spec.rb +66 -0
- data/spec/models/location_capability_spec.rb +36 -0
- data/spec/models/location_spec.rb +86 -0
- data/spec/models/money_spec.rb +56 -0
- data/spec/models/order_line_item_spec.rb +86 -0
- data/spec/models/order_spec.rb +86 -0
- data/spec/models/refund_spec.rb +126 -0
- data/spec/models/refund_status_spec.rb +36 -0
- data/spec/models/retrieve_customer_request_spec.rb +36 -0
- data/spec/models/retrieve_customer_response_spec.rb +56 -0
- data/spec/models/retrieve_transaction_request_spec.rb +36 -0
- data/spec/models/retrieve_transaction_response_spec.rb +56 -0
- data/spec/models/sort_order_spec.rb +36 -0
- data/spec/models/tender_card_details_entry_method_spec.rb +36 -0
- data/spec/models/tender_card_details_spec.rb +66 -0
- data/spec/models/tender_card_details_status_spec.rb +36 -0
- data/spec/models/tender_cash_details_spec.rb +56 -0
- data/spec/models/tender_spec.rb +146 -0
- data/spec/models/tender_type_spec.rb +36 -0
- data/spec/models/transaction_product_spec.rb +36 -0
- data/spec/models/transaction_spec.rb +136 -0
- data/spec/models/update_customer_request_spec.rb +126 -0
- data/spec/models/update_customer_response_spec.rb +56 -0
- data/spec/models/void_transaction_request_spec.rb +36 -0
- data/spec/models/void_transaction_response_spec.rb +46 -0
- data/spec/spec_helper.rb +115 -0
- data/square_connect.gemspec +22 -11
- data/travis-ci/accounts.enc +0 -0
- metadata +264 -31
@@ -1,37 +1,33 @@
|
|
1
1
|
=begin
|
2
|
-
Square Connect API
|
2
|
+
#Square Connect API
|
3
3
|
|
4
4
|
OpenAPI spec version: 2.0
|
5
5
|
|
6
6
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
7
|
|
8
|
-
|
9
8
|
=end
|
10
9
|
|
11
10
|
require 'date'
|
12
11
|
|
13
12
|
module SquareConnect
|
14
|
-
# Defines the fields that are included in the response body of
|
13
|
+
# Defines the fields that are included in the response body of a request to the [ListCustomers](#endpoint-listcustomers) endpoint. One of `errors` or `customers` is present in a given response (never both).
|
15
14
|
class ListCustomersResponse
|
16
|
-
#
|
15
|
+
# Any errors that occurred during the request.
|
17
16
|
attr_accessor :errors
|
18
17
|
|
19
|
-
#
|
18
|
+
# An array of `Customer` objects that match your query.
|
20
19
|
attr_accessor :customers
|
21
20
|
|
22
|
-
#
|
21
|
+
# A pagination cursor to retrieve the next set of results for your original query to the endpoint. This value is present only if the request succeeded and additional results are available. See [Paginating results](#paginatingresults) for more information.
|
23
22
|
attr_accessor :cursor
|
24
23
|
|
24
|
+
|
25
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
26
|
def self.attribute_map
|
27
27
|
{
|
28
|
-
|
29
28
|
:'errors' => :'errors',
|
30
|
-
|
31
29
|
:'customers' => :'customers',
|
32
|
-
|
33
30
|
:'cursor' => :'cursor'
|
34
|
-
|
35
31
|
}
|
36
32
|
end
|
37
33
|
|
@@ -41,36 +37,50 @@ module SquareConnect
|
|
41
37
|
:'errors' => :'Array<Error>',
|
42
38
|
:'customers' => :'Array<Customer>',
|
43
39
|
:'cursor' => :'String'
|
44
|
-
|
45
40
|
}
|
46
41
|
end
|
47
42
|
|
43
|
+
# Initializes the object
|
44
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
48
45
|
def initialize(attributes = {})
|
49
46
|
return unless attributes.is_a?(Hash)
|
50
47
|
|
51
48
|
# convert string to symbol for hash key
|
52
|
-
attributes = attributes.
|
49
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
53
50
|
|
54
|
-
|
55
|
-
if attributes[:'errors']
|
51
|
+
if attributes.has_key?(:'errors')
|
56
52
|
if (value = attributes[:'errors']).is_a?(Array)
|
57
53
|
self.errors = value
|
58
54
|
end
|
59
55
|
end
|
60
|
-
|
61
|
-
if attributes
|
56
|
+
|
57
|
+
if attributes.has_key?(:'customers')
|
62
58
|
if (value = attributes[:'customers']).is_a?(Array)
|
63
59
|
self.customers = value
|
64
60
|
end
|
65
61
|
end
|
66
|
-
|
67
|
-
if attributes
|
62
|
+
|
63
|
+
if attributes.has_key?(:'cursor')
|
68
64
|
self.cursor = attributes[:'cursor']
|
69
65
|
end
|
70
|
-
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
70
|
+
# @return Array for valid properies with the reasons
|
71
|
+
def list_invalid_properties
|
72
|
+
invalid_properties = Array.new
|
73
|
+
return invalid_properties
|
71
74
|
end
|
72
75
|
|
73
|
-
# Check
|
76
|
+
# Check to see if the all the properties in the model are valid
|
77
|
+
# @return true if the model is valid
|
78
|
+
def valid?
|
79
|
+
return true
|
80
|
+
end
|
81
|
+
|
82
|
+
# Checks equality by comparing each attribute.
|
83
|
+
# @param [Object] Object to be compared
|
74
84
|
def ==(o)
|
75
85
|
return true if self.equal?(o)
|
76
86
|
self.class == o.class &&
|
@@ -80,35 +90,41 @@ module SquareConnect
|
|
80
90
|
end
|
81
91
|
|
82
92
|
# @see the `==` method
|
93
|
+
# @param [Object] Object to be compared
|
83
94
|
def eql?(o)
|
84
95
|
self == o
|
85
96
|
end
|
86
97
|
|
87
|
-
#
|
98
|
+
# Calculates hash code according to all attributes.
|
99
|
+
# @return [Fixnum] Hash code
|
88
100
|
def hash
|
89
101
|
[errors, customers, cursor].hash
|
90
102
|
end
|
91
103
|
|
92
|
-
#
|
104
|
+
# Builds the object from hash
|
105
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
106
|
+
# @return [Object] Returns the model itself
|
93
107
|
def build_from_hash(attributes)
|
94
108
|
return nil unless attributes.is_a?(Hash)
|
95
109
|
self.class.swagger_types.each_pair do |key, type|
|
96
|
-
if type =~
|
110
|
+
if type =~ /\AArray<(.*)>/i
|
111
|
+
# check to ensure the input is an array given that the the attribute
|
112
|
+
# is documented as an array but the input is not
|
97
113
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
98
114
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
99
|
-
else
|
100
|
-
#TODO show warning in debug mode
|
101
115
|
end
|
102
116
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
103
117
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
104
|
-
else
|
105
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
106
|
-
end
|
118
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
107
119
|
end
|
108
120
|
|
109
121
|
self
|
110
122
|
end
|
111
123
|
|
124
|
+
# Deserializes the data based on type
|
125
|
+
# @param string type Data type
|
126
|
+
# @param string value Value to be deserialized
|
127
|
+
# @return [Object] Deserialized data
|
112
128
|
def _deserialize(type, value)
|
113
129
|
case type.to_sym
|
114
130
|
when :DateTime
|
@@ -122,15 +138,18 @@ module SquareConnect
|
|
122
138
|
when :Float
|
123
139
|
value.to_f
|
124
140
|
when :BOOLEAN
|
125
|
-
if value.to_s =~
|
141
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
126
142
|
true
|
127
143
|
else
|
128
144
|
false
|
129
145
|
end
|
146
|
+
when :Object
|
147
|
+
# generic object (usually a Hash), return directly
|
148
|
+
value
|
130
149
|
when /\AArray<(?<inner_type>.+)>\z/
|
131
150
|
inner_type = Regexp.last_match[:inner_type]
|
132
151
|
value.map { |v| _deserialize(inner_type, v) }
|
133
|
-
when /\AHash<(?<k_type
|
152
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
134
153
|
k_type = Regexp.last_match[:k_type]
|
135
154
|
v_type = Regexp.last_match[:v_type]
|
136
155
|
{}.tap do |hash|
|
@@ -139,21 +158,25 @@ module SquareConnect
|
|
139
158
|
end
|
140
159
|
end
|
141
160
|
else # model
|
142
|
-
|
143
|
-
|
161
|
+
temp_model = SquareConnect.const_get(type).new
|
162
|
+
temp_model.build_from_hash(value)
|
144
163
|
end
|
145
164
|
end
|
146
165
|
|
166
|
+
# Returns the string representation of the object
|
167
|
+
# @return [String] String presentation of the object
|
147
168
|
def to_s
|
148
169
|
to_hash.to_s
|
149
170
|
end
|
150
171
|
|
151
|
-
# to_body is an alias to
|
172
|
+
# to_body is an alias to to_hash (backward compatibility)
|
173
|
+
# @return [Hash] Returns the object in the form of hash
|
152
174
|
def to_body
|
153
175
|
to_hash
|
154
176
|
end
|
155
177
|
|
156
|
-
#
|
178
|
+
# Returns the object in the form of hash
|
179
|
+
# @return [Hash] Returns the object in the form of hash
|
157
180
|
def to_hash
|
158
181
|
hash = {}
|
159
182
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -164,8 +187,10 @@ module SquareConnect
|
|
164
187
|
hash
|
165
188
|
end
|
166
189
|
|
167
|
-
#
|
190
|
+
# Outputs non-array value in the form of hash
|
168
191
|
# For object, use to_hash. Otherwise, just return the value
|
192
|
+
# @param [Object] value Any valid value
|
193
|
+
# @return [Hash] Returns the value in the form of hash
|
169
194
|
def _to_hash(value)
|
170
195
|
if value.is_a?(Array)
|
171
196
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -181,4 +206,5 @@ module SquareConnect
|
|
181
206
|
end
|
182
207
|
|
183
208
|
end
|
209
|
+
|
184
210
|
end
|
@@ -0,0 +1,176 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
#
|
14
|
+
class ListLocationsRequest
|
15
|
+
|
16
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
17
|
+
def self.attribute_map
|
18
|
+
{
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
# Attribute type mapping.
|
23
|
+
def self.swagger_types
|
24
|
+
{
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Initializes the object
|
29
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
30
|
+
def initialize(attributes = {})
|
31
|
+
return unless attributes.is_a?(Hash)
|
32
|
+
|
33
|
+
# convert string to symbol for hash key
|
34
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
39
|
+
# @return Array for valid properies with the reasons
|
40
|
+
def list_invalid_properties
|
41
|
+
invalid_properties = Array.new
|
42
|
+
return invalid_properties
|
43
|
+
end
|
44
|
+
|
45
|
+
# Check to see if the all the properties in the model are valid
|
46
|
+
# @return true if the model is valid
|
47
|
+
def valid?
|
48
|
+
return true
|
49
|
+
end
|
50
|
+
|
51
|
+
# Checks equality by comparing each attribute.
|
52
|
+
# @param [Object] Object to be compared
|
53
|
+
def ==(o)
|
54
|
+
return true if self.equal?(o)
|
55
|
+
self.class == o.class
|
56
|
+
end
|
57
|
+
|
58
|
+
# @see the `==` method
|
59
|
+
# @param [Object] Object to be compared
|
60
|
+
def eql?(o)
|
61
|
+
self == o
|
62
|
+
end
|
63
|
+
|
64
|
+
# Calculates hash code according to all attributes.
|
65
|
+
# @return [Fixnum] Hash code
|
66
|
+
def hash
|
67
|
+
[].hash
|
68
|
+
end
|
69
|
+
|
70
|
+
# Builds the object from hash
|
71
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
72
|
+
# @return [Object] Returns the model itself
|
73
|
+
def build_from_hash(attributes)
|
74
|
+
return nil unless attributes.is_a?(Hash)
|
75
|
+
self.class.swagger_types.each_pair do |key, type|
|
76
|
+
if type =~ /\AArray<(.*)>/i
|
77
|
+
# check to ensure the input is an array given that the the attribute
|
78
|
+
# is documented as an array but the input is not
|
79
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
80
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
81
|
+
end
|
82
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
83
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
84
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
85
|
+
end
|
86
|
+
|
87
|
+
self
|
88
|
+
end
|
89
|
+
|
90
|
+
# Deserializes the data based on type
|
91
|
+
# @param string type Data type
|
92
|
+
# @param string value Value to be deserialized
|
93
|
+
# @return [Object] Deserialized data
|
94
|
+
def _deserialize(type, value)
|
95
|
+
case type.to_sym
|
96
|
+
when :DateTime
|
97
|
+
DateTime.parse(value)
|
98
|
+
when :Date
|
99
|
+
Date.parse(value)
|
100
|
+
when :String
|
101
|
+
value.to_s
|
102
|
+
when :Integer
|
103
|
+
value.to_i
|
104
|
+
when :Float
|
105
|
+
value.to_f
|
106
|
+
when :BOOLEAN
|
107
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
108
|
+
true
|
109
|
+
else
|
110
|
+
false
|
111
|
+
end
|
112
|
+
when :Object
|
113
|
+
# generic object (usually a Hash), return directly
|
114
|
+
value
|
115
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
116
|
+
inner_type = Regexp.last_match[:inner_type]
|
117
|
+
value.map { |v| _deserialize(inner_type, v) }
|
118
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
119
|
+
k_type = Regexp.last_match[:k_type]
|
120
|
+
v_type = Regexp.last_match[:v_type]
|
121
|
+
{}.tap do |hash|
|
122
|
+
value.each do |k, v|
|
123
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
124
|
+
end
|
125
|
+
end
|
126
|
+
else # model
|
127
|
+
temp_model = SquareConnect.const_get(type).new
|
128
|
+
temp_model.build_from_hash(value)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
# Returns the string representation of the object
|
133
|
+
# @return [String] String presentation of the object
|
134
|
+
def to_s
|
135
|
+
to_hash.to_s
|
136
|
+
end
|
137
|
+
|
138
|
+
# to_body is an alias to to_hash (backward compatibility)
|
139
|
+
# @return [Hash] Returns the object in the form of hash
|
140
|
+
def to_body
|
141
|
+
to_hash
|
142
|
+
end
|
143
|
+
|
144
|
+
# Returns the object in the form of hash
|
145
|
+
# @return [Hash] Returns the object in the form of hash
|
146
|
+
def to_hash
|
147
|
+
hash = {}
|
148
|
+
self.class.attribute_map.each_pair do |attr, param|
|
149
|
+
value = self.send(attr)
|
150
|
+
next if value.nil?
|
151
|
+
hash[param] = _to_hash(value)
|
152
|
+
end
|
153
|
+
hash
|
154
|
+
end
|
155
|
+
|
156
|
+
# Outputs non-array value in the form of hash
|
157
|
+
# For object, use to_hash. Otherwise, just return the value
|
158
|
+
# @param [Object] value Any valid value
|
159
|
+
# @return [Hash] Returns the value in the form of hash
|
160
|
+
def _to_hash(value)
|
161
|
+
if value.is_a?(Array)
|
162
|
+
value.compact.map{ |v| _to_hash(v) }
|
163
|
+
elsif value.is_a?(Hash)
|
164
|
+
{}.tap do |hash|
|
165
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
166
|
+
end
|
167
|
+
elsif value.respond_to? :to_hash
|
168
|
+
value.to_hash
|
169
|
+
else
|
170
|
+
value
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
175
|
+
|
176
|
+
end
|
@@ -1,32 +1,29 @@
|
|
1
1
|
=begin
|
2
|
-
Square Connect API
|
2
|
+
#Square Connect API
|
3
3
|
|
4
4
|
OpenAPI spec version: 2.0
|
5
5
|
|
6
6
|
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
7
|
|
8
|
-
|
9
8
|
=end
|
10
9
|
|
11
10
|
require 'date'
|
12
11
|
|
13
12
|
module SquareConnect
|
14
|
-
# Defines the fields that are included in the response body of
|
13
|
+
# Defines the fields that are included in the response body of a request to the [ListLocations](#endpoint-listlocations) endpoint. One of `errors` or `locations` is present in a given response (never both).
|
15
14
|
class ListLocationsResponse
|
16
15
|
# Any errors that occurred during the request.
|
17
16
|
attr_accessor :errors
|
18
17
|
|
19
|
-
#
|
18
|
+
# The business's locations.
|
20
19
|
attr_accessor :locations
|
21
20
|
|
21
|
+
|
22
22
|
# Attribute mapping from ruby-style variable name to JSON key.
|
23
23
|
def self.attribute_map
|
24
24
|
{
|
25
|
-
|
26
25
|
:'errors' => :'errors',
|
27
|
-
|
28
26
|
:'locations' => :'locations'
|
29
|
-
|
30
27
|
}
|
31
28
|
end
|
32
29
|
|
@@ -35,32 +32,46 @@ module SquareConnect
|
|
35
32
|
{
|
36
33
|
:'errors' => :'Array<Error>',
|
37
34
|
:'locations' => :'Array<Location>'
|
38
|
-
|
39
35
|
}
|
40
36
|
end
|
41
37
|
|
38
|
+
# Initializes the object
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
42
40
|
def initialize(attributes = {})
|
43
41
|
return unless attributes.is_a?(Hash)
|
44
42
|
|
45
43
|
# convert string to symbol for hash key
|
46
|
-
attributes = attributes.
|
44
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
47
45
|
|
48
|
-
|
49
|
-
if attributes[:'errors']
|
46
|
+
if attributes.has_key?(:'errors')
|
50
47
|
if (value = attributes[:'errors']).is_a?(Array)
|
51
48
|
self.errors = value
|
52
49
|
end
|
53
50
|
end
|
54
|
-
|
55
|
-
if attributes
|
51
|
+
|
52
|
+
if attributes.has_key?(:'locations')
|
56
53
|
if (value = attributes[:'locations']).is_a?(Array)
|
57
54
|
self.locations = value
|
58
55
|
end
|
59
56
|
end
|
60
|
-
|
57
|
+
|
58
|
+
end
|
59
|
+
|
60
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
61
|
+
# @return Array for valid properies with the reasons
|
62
|
+
def list_invalid_properties
|
63
|
+
invalid_properties = Array.new
|
64
|
+
return invalid_properties
|
61
65
|
end
|
62
66
|
|
63
|
-
# Check
|
67
|
+
# Check to see if the all the properties in the model are valid
|
68
|
+
# @return true if the model is valid
|
69
|
+
def valid?
|
70
|
+
return true
|
71
|
+
end
|
72
|
+
|
73
|
+
# Checks equality by comparing each attribute.
|
74
|
+
# @param [Object] Object to be compared
|
64
75
|
def ==(o)
|
65
76
|
return true if self.equal?(o)
|
66
77
|
self.class == o.class &&
|
@@ -69,35 +80,41 @@ module SquareConnect
|
|
69
80
|
end
|
70
81
|
|
71
82
|
# @see the `==` method
|
83
|
+
# @param [Object] Object to be compared
|
72
84
|
def eql?(o)
|
73
85
|
self == o
|
74
86
|
end
|
75
87
|
|
76
|
-
#
|
88
|
+
# Calculates hash code according to all attributes.
|
89
|
+
# @return [Fixnum] Hash code
|
77
90
|
def hash
|
78
91
|
[errors, locations].hash
|
79
92
|
end
|
80
93
|
|
81
|
-
#
|
94
|
+
# Builds the object from hash
|
95
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
96
|
+
# @return [Object] Returns the model itself
|
82
97
|
def build_from_hash(attributes)
|
83
98
|
return nil unless attributes.is_a?(Hash)
|
84
99
|
self.class.swagger_types.each_pair do |key, type|
|
85
|
-
if type =~
|
100
|
+
if type =~ /\AArray<(.*)>/i
|
101
|
+
# check to ensure the input is an array given that the the attribute
|
102
|
+
# is documented as an array but the input is not
|
86
103
|
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
87
104
|
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
88
|
-
else
|
89
|
-
#TODO show warning in debug mode
|
90
105
|
end
|
91
106
|
elsif !attributes[self.class.attribute_map[key]].nil?
|
92
107
|
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
93
|
-
else
|
94
|
-
# data not found in attributes(hash), not an issue as the data can be optional
|
95
|
-
end
|
108
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
96
109
|
end
|
97
110
|
|
98
111
|
self
|
99
112
|
end
|
100
113
|
|
114
|
+
# Deserializes the data based on type
|
115
|
+
# @param string type Data type
|
116
|
+
# @param string value Value to be deserialized
|
117
|
+
# @return [Object] Deserialized data
|
101
118
|
def _deserialize(type, value)
|
102
119
|
case type.to_sym
|
103
120
|
when :DateTime
|
@@ -111,15 +128,18 @@ module SquareConnect
|
|
111
128
|
when :Float
|
112
129
|
value.to_f
|
113
130
|
when :BOOLEAN
|
114
|
-
if value.to_s =~
|
131
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
115
132
|
true
|
116
133
|
else
|
117
134
|
false
|
118
135
|
end
|
136
|
+
when :Object
|
137
|
+
# generic object (usually a Hash), return directly
|
138
|
+
value
|
119
139
|
when /\AArray<(?<inner_type>.+)>\z/
|
120
140
|
inner_type = Regexp.last_match[:inner_type]
|
121
141
|
value.map { |v| _deserialize(inner_type, v) }
|
122
|
-
when /\AHash<(?<k_type
|
142
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
123
143
|
k_type = Regexp.last_match[:k_type]
|
124
144
|
v_type = Regexp.last_match[:v_type]
|
125
145
|
{}.tap do |hash|
|
@@ -128,21 +148,25 @@ module SquareConnect
|
|
128
148
|
end
|
129
149
|
end
|
130
150
|
else # model
|
131
|
-
|
132
|
-
|
151
|
+
temp_model = SquareConnect.const_get(type).new
|
152
|
+
temp_model.build_from_hash(value)
|
133
153
|
end
|
134
154
|
end
|
135
155
|
|
156
|
+
# Returns the string representation of the object
|
157
|
+
# @return [String] String presentation of the object
|
136
158
|
def to_s
|
137
159
|
to_hash.to_s
|
138
160
|
end
|
139
161
|
|
140
|
-
# to_body is an alias to
|
162
|
+
# to_body is an alias to to_hash (backward compatibility)
|
163
|
+
# @return [Hash] Returns the object in the form of hash
|
141
164
|
def to_body
|
142
165
|
to_hash
|
143
166
|
end
|
144
167
|
|
145
|
-
#
|
168
|
+
# Returns the object in the form of hash
|
169
|
+
# @return [Hash] Returns the object in the form of hash
|
146
170
|
def to_hash
|
147
171
|
hash = {}
|
148
172
|
self.class.attribute_map.each_pair do |attr, param|
|
@@ -153,8 +177,10 @@ module SquareConnect
|
|
153
177
|
hash
|
154
178
|
end
|
155
179
|
|
156
|
-
#
|
180
|
+
# Outputs non-array value in the form of hash
|
157
181
|
# For object, use to_hash. Otherwise, just return the value
|
182
|
+
# @param [Object] value Any valid value
|
183
|
+
# @return [Hash] Returns the value in the form of hash
|
158
184
|
def _to_hash(value)
|
159
185
|
if value.is_a?(Array)
|
160
186
|
value.compact.map{ |v| _to_hash(v) }
|
@@ -170,4 +196,5 @@ module SquareConnect
|
|
170
196
|
end
|
171
197
|
|
172
198
|
end
|
199
|
+
|
173
200
|
end
|