square_connect 2.4.0.175 → 2.5.0.180

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +5 -5
  2. data/CHANGES.md +21 -0
  3. data/README.md +11 -1
  4. data/docs/AdditionalRecipient.md +15 -0
  5. data/docs/AdditionalRecipientReceivable.md +17 -0
  6. data/docs/AdditionalRecipientReceivableRefund.md +17 -0
  7. data/docs/CatalogApi.md +1 -1
  8. data/docs/ChargeRequest.md +1 -0
  9. data/docs/ChargeRequestAdditionalRecipient.md +14 -0
  10. data/docs/Checkout.md +1 -0
  11. data/docs/CreateCheckoutRequest.md +1 -0
  12. data/docs/CreateCustomerCardRequest.md +1 -1
  13. data/docs/ErrorCode.md +2 -0
  14. data/docs/ListAdditionalRecipientReceivableRefundsRequest.md +15 -0
  15. data/docs/ListAdditionalRecipientReceivableRefundsResponse.md +14 -0
  16. data/docs/ListAdditionalRecipientReceivablesRequest.md +15 -0
  17. data/docs/ListAdditionalRecipientReceivablesResponse.md +14 -0
  18. data/docs/Refund.md +1 -0
  19. data/docs/ReportingApi.md +134 -0
  20. data/docs/Tender.md +1 -0
  21. data/lib/square_connect.rb +9 -0
  22. data/lib/square_connect/api/catalog_api.rb +2 -2
  23. data/lib/square_connect/api/reporting_api.rb +156 -0
  24. data/lib/square_connect/api_client.rb +1 -1
  25. data/lib/square_connect/models/additional_recipient.rb +287 -0
  26. data/lib/square_connect/models/additional_recipient_receivable.rb +315 -0
  27. data/lib/square_connect/models/additional_recipient_receivable_refund.rb +337 -0
  28. data/lib/square_connect/models/charge_request.rb +16 -4
  29. data/lib/square_connect/models/charge_request_additional_recipient.rb +277 -0
  30. data/lib/square_connect/models/checkout.rb +16 -4
  31. data/lib/square_connect/models/create_checkout_request.rb +16 -4
  32. data/lib/square_connect/models/create_customer_card_request.rb +1 -1
  33. data/lib/square_connect/models/error.rb +2 -2
  34. data/lib/square_connect/models/error_code.rb +2 -0
  35. data/lib/square_connect/models/list_additional_recipient_receivable_refunds_request.rb +249 -0
  36. data/lib/square_connect/models/list_additional_recipient_receivable_refunds_response.rb +210 -0
  37. data/lib/square_connect/models/list_additional_recipient_receivables_request.rb +249 -0
  38. data/lib/square_connect/models/list_additional_recipient_receivables_response.rb +210 -0
  39. data/lib/square_connect/models/refund.rb +16 -4
  40. data/lib/square_connect/models/tender.rb +16 -4
  41. data/lib/square_connect/version.rb +1 -1
  42. data/spec/api/apple_pay_api_spec.rb +44 -0
  43. data/spec/api/orders_api_spec.rb +58 -0
  44. data/spec/api/reporting_api_spec.rb +88 -0
  45. data/spec/api/transactions_api_spec.rb +4 -4
  46. data/spec/models/additional_recipient_receivable_refund_spec.rb +69 -0
  47. data/spec/models/additional_recipient_receivable_spec.rb +69 -0
  48. data/spec/models/additional_recipient_spec.rb +57 -0
  49. data/spec/models/batch_retrieve_orders_request_spec.rb +39 -0
  50. data/spec/models/batch_retrieve_orders_response_spec.rb +45 -0
  51. data/spec/models/charge_request_additional_recipient_spec.rb +51 -0
  52. data/spec/models/checkout_spec.rb +6 -1
  53. data/spec/models/create_checkout_request_spec.rb +15 -1
  54. data/spec/models/create_order_request_discount_spec.rb +57 -0
  55. data/spec/models/create_order_request_modifier_spec.rb +39 -0
  56. data/spec/models/create_order_request_spec.rb +63 -0
  57. data/spec/models/create_order_request_tax_spec.rb +61 -0
  58. data/spec/models/create_order_response_spec.rb +45 -0
  59. data/spec/models/list_additional_recipient_receivable_refunds_request_spec.rb +61 -0
  60. data/spec/models/list_additional_recipient_receivable_refunds_response_spec.rb +51 -0
  61. data/spec/models/list_additional_recipient_receivables_request_spec.rb +61 -0
  62. data/spec/models/list_additional_recipient_receivables_response_spec.rb +51 -0
  63. data/spec/models/location_status_spec.rb +33 -0
  64. data/spec/models/location_type_spec.rb +33 -0
  65. data/spec/models/order_line_item_discount_scope_spec.rb +33 -0
  66. data/spec/models/order_line_item_discount_spec.rb +83 -0
  67. data/spec/models/order_line_item_discount_type_spec.rb +33 -0
  68. data/spec/models/order_line_item_modifier_spec.rb +57 -0
  69. data/spec/models/order_line_item_tax_spec.rb +67 -0
  70. data/spec/models/order_line_item_tax_type_spec.rb +33 -0
  71. data/spec/models/refund_spec.rb +15 -1
  72. data/spec/models/register_domain_request_spec.rb +39 -0
  73. data/spec/models/register_domain_response_spec.rb +49 -0
  74. data/spec/models/register_domain_response_status_spec.rb +33 -0
  75. data/spec/models/tender_spec.rb +15 -1
  76. metadata +80 -4
@@ -0,0 +1,315 @@
1
+ =begin
2
+ #Square Connect API
3
+
4
+ OpenAPI spec version: 2.0
5
+ Contact: developers@squareup.com
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+ =end
9
+
10
+ require 'date'
11
+
12
+ module SquareConnect
13
+ # Represents a monetary distribution of part of a [Transaction](#type-transaction)'s amount for Transactions which included additional recipients. The location of this receivable is that same as the one specified in the [AdditionalRecipient](#type-additionalrecipient).
14
+ class AdditionalRecipientReceivable
15
+ # The additional recipient receivable's unique ID, issued by Square payments servers.
16
+ attr_accessor :id
17
+
18
+ # The ID of the transaction that the additional recipient receivable was applied to.
19
+ attr_accessor :transaction_id
20
+
21
+ # The ID of the location that created the receivable. This is the location ID on the associated transaction.
22
+ attr_accessor :transaction_location_id
23
+
24
+ # The amount of the receivable. This will always be non-negative.
25
+ attr_accessor :amount_money
26
+
27
+ # The time when the additional recipient receivable was created, in RFC 3339 format.
28
+ attr_accessor :created_at
29
+
30
+ # Any refunds of the receivable that have been applied.
31
+ attr_accessor :refunds
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'id' => :'id',
38
+ :'transaction_id' => :'transaction_id',
39
+ :'transaction_location_id' => :'transaction_location_id',
40
+ :'amount_money' => :'amount_money',
41
+ :'created_at' => :'created_at',
42
+ :'refunds' => :'refunds'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ :'id' => :'String',
50
+ :'transaction_id' => :'String',
51
+ :'transaction_location_id' => :'String',
52
+ :'amount_money' => :'Money',
53
+ :'created_at' => :'String',
54
+ :'refunds' => :'Array<AdditionalRecipientReceivableRefund>'
55
+ }
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ return unless attributes.is_a?(Hash)
62
+
63
+ # convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
65
+
66
+ if attributes.has_key?(:'id')
67
+ self.id = attributes[:'id']
68
+ end
69
+
70
+ if attributes.has_key?(:'transaction_id')
71
+ self.transaction_id = attributes[:'transaction_id']
72
+ end
73
+
74
+ if attributes.has_key?(:'transaction_location_id')
75
+ self.transaction_location_id = attributes[:'transaction_location_id']
76
+ end
77
+
78
+ if attributes.has_key?(:'amount_money')
79
+ self.amount_money = attributes[:'amount_money']
80
+ end
81
+
82
+ if attributes.has_key?(:'created_at')
83
+ self.created_at = attributes[:'created_at']
84
+ end
85
+
86
+ if attributes.has_key?(:'refunds')
87
+ if (value = attributes[:'refunds']).is_a?(Array)
88
+ self.refunds = value
89
+ end
90
+ end
91
+
92
+ end
93
+
94
+ # Show invalid properties with the reasons. Usually used together with valid?
95
+ # @return Array for valid properies with the reasons
96
+ def list_invalid_properties
97
+ invalid_properties = Array.new
98
+ if @id.nil?
99
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
100
+ end
101
+
102
+ if @id.to_s.length < 1
103
+ invalid_properties.push("invalid value for 'id', the character length must be great than or equal to 1.")
104
+ end
105
+
106
+ if @transaction_id.nil?
107
+ invalid_properties.push("invalid value for 'transaction_id', transaction_id cannot be nil.")
108
+ end
109
+
110
+ if @transaction_id.to_s.length < 1
111
+ invalid_properties.push("invalid value for 'transaction_id', the character length must be great than or equal to 1.")
112
+ end
113
+
114
+ if @transaction_location_id.nil?
115
+ invalid_properties.push("invalid value for 'transaction_location_id', transaction_location_id cannot be nil.")
116
+ end
117
+
118
+ if @transaction_location_id.to_s.length < 1
119
+ invalid_properties.push("invalid value for 'transaction_location_id', the character length must be great than or equal to 1.")
120
+ end
121
+
122
+ if @amount_money.nil?
123
+ invalid_properties.push("invalid value for 'amount_money', amount_money cannot be nil.")
124
+ end
125
+
126
+ return invalid_properties
127
+ end
128
+
129
+ # Check to see if the all the properties in the model are valid
130
+ # @return true if the model is valid
131
+ def valid?
132
+ return false if @id.nil?
133
+ return false if @id.to_s.length < 1
134
+ return false if @transaction_id.nil?
135
+ return false if @transaction_id.to_s.length < 1
136
+ return false if @transaction_location_id.nil?
137
+ return false if @transaction_location_id.to_s.length < 1
138
+ return false if @amount_money.nil?
139
+ return true
140
+ end
141
+
142
+ # Custom attribute writer method with validation
143
+ # @param [Object] id Value to be assigned
144
+ def id=(id)
145
+ if id.nil?
146
+ fail ArgumentError, "id cannot be nil"
147
+ end
148
+
149
+ if id.to_s.length < 1
150
+ fail ArgumentError, "invalid value for 'id', the character length must be great than or equal to 1."
151
+ end
152
+
153
+ @id = id
154
+ end
155
+
156
+ # Custom attribute writer method with validation
157
+ # @param [Object] transaction_id Value to be assigned
158
+ def transaction_id=(transaction_id)
159
+ if transaction_id.nil?
160
+ fail ArgumentError, "transaction_id cannot be nil"
161
+ end
162
+
163
+ if transaction_id.to_s.length < 1
164
+ fail ArgumentError, "invalid value for 'transaction_id', the character length must be great than or equal to 1."
165
+ end
166
+
167
+ @transaction_id = transaction_id
168
+ end
169
+
170
+ # Custom attribute writer method with validation
171
+ # @param [Object] transaction_location_id Value to be assigned
172
+ def transaction_location_id=(transaction_location_id)
173
+ if transaction_location_id.nil?
174
+ fail ArgumentError, "transaction_location_id cannot be nil"
175
+ end
176
+
177
+ if transaction_location_id.to_s.length < 1
178
+ fail ArgumentError, "invalid value for 'transaction_location_id', the character length must be great than or equal to 1."
179
+ end
180
+
181
+ @transaction_location_id = transaction_location_id
182
+ end
183
+
184
+ # Checks equality by comparing each attribute.
185
+ # @param [Object] Object to be compared
186
+ def ==(o)
187
+ return true if self.equal?(o)
188
+ self.class == o.class &&
189
+ id == o.id &&
190
+ transaction_id == o.transaction_id &&
191
+ transaction_location_id == o.transaction_location_id &&
192
+ amount_money == o.amount_money &&
193
+ created_at == o.created_at &&
194
+ refunds == o.refunds
195
+ end
196
+
197
+ # @see the `==` method
198
+ # @param [Object] Object to be compared
199
+ def eql?(o)
200
+ self == o
201
+ end
202
+
203
+ # Calculates hash code according to all attributes.
204
+ # @return [Fixnum] Hash code
205
+ def hash
206
+ [id, transaction_id, transaction_location_id, amount_money, created_at, refunds].hash
207
+ end
208
+
209
+ # Builds the object from hash
210
+ # @param [Hash] attributes Model attributes in the form of hash
211
+ # @return [Object] Returns the model itself
212
+ def build_from_hash(attributes)
213
+ return nil unless attributes.is_a?(Hash)
214
+ self.class.swagger_types.each_pair do |key, type|
215
+ if type =~ /\AArray<(.*)>/i
216
+ # check to ensure the input is an array given that the the attribute
217
+ # is documented as an array but the input is not
218
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
219
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
220
+ end
221
+ elsif !attributes[self.class.attribute_map[key]].nil?
222
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
223
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
224
+ end
225
+
226
+ self
227
+ end
228
+
229
+ # Deserializes the data based on type
230
+ # @param string type Data type
231
+ # @param string value Value to be deserialized
232
+ # @return [Object] Deserialized data
233
+ def _deserialize(type, value)
234
+ case type.to_sym
235
+ when :DateTime
236
+ DateTime.parse(value)
237
+ when :Date
238
+ Date.parse(value)
239
+ when :String
240
+ value.to_s
241
+ when :Integer
242
+ value.to_i
243
+ when :Float
244
+ value.to_f
245
+ when :BOOLEAN
246
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
247
+ true
248
+ else
249
+ false
250
+ end
251
+ when :Object
252
+ # generic object (usually a Hash), return directly
253
+ value
254
+ when /\AArray<(?<inner_type>.+)>\z/
255
+ inner_type = Regexp.last_match[:inner_type]
256
+ value.map { |v| _deserialize(inner_type, v) }
257
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
258
+ k_type = Regexp.last_match[:k_type]
259
+ v_type = Regexp.last_match[:v_type]
260
+ {}.tap do |hash|
261
+ value.each do |k, v|
262
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
263
+ end
264
+ end
265
+ else # model
266
+ temp_model = SquareConnect.const_get(type).new
267
+ temp_model.build_from_hash(value)
268
+ end
269
+ end
270
+
271
+ # Returns the string representation of the object
272
+ # @return [String] String presentation of the object
273
+ def to_s
274
+ to_hash.to_s
275
+ end
276
+
277
+ # to_body is an alias to to_hash (backward compatibility)
278
+ # @return [Hash] Returns the object in the form of hash
279
+ def to_body
280
+ to_hash
281
+ end
282
+
283
+ # Returns the object in the form of hash
284
+ # @return [Hash] Returns the object in the form of hash
285
+ def to_hash
286
+ hash = {}
287
+ self.class.attribute_map.each_pair do |attr, param|
288
+ value = self.send(attr)
289
+ next if value.nil?
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Outputs non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ # @param [Object] value Any valid value
298
+ # @return [Hash] Returns the value in the form of hash
299
+ def _to_hash(value)
300
+ if value.is_a?(Array)
301
+ value.compact.map{ |v| _to_hash(v) }
302
+ elsif value.is_a?(Hash)
303
+ {}.tap do |hash|
304
+ value.each { |k, v| hash[k] = _to_hash(v) }
305
+ end
306
+ elsif value.respond_to? :to_hash
307
+ value.to_hash
308
+ else
309
+ value
310
+ end
311
+ end
312
+
313
+ end
314
+
315
+ end
@@ -0,0 +1,337 @@
1
+ =begin
2
+ #Square Connect API
3
+
4
+ OpenAPI spec version: 2.0
5
+ Contact: developers@squareup.com
6
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
7
+
8
+ =end
9
+
10
+ require 'date'
11
+
12
+ module SquareConnect
13
+ # A refund of an [AdditionalRecipientReceivable](#type-additionalrecipientreceivable). This includes the ID of the additional recipient receivable associated to this object, as well as a reference to the [Refund](#type-refund) that created this receivable refund.
14
+ class AdditionalRecipientReceivableRefund
15
+ # The receivable refund's unique ID, issued by Square payments servers.
16
+ attr_accessor :id
17
+
18
+ # The ID of the receivable that the refund was applied to.
19
+ attr_accessor :receivable_id
20
+
21
+ # The ID of the refund that is associated to this receivable refund.
22
+ attr_accessor :refund_id
23
+
24
+ # The ID of the location that created the receivable. This is the location ID on the associated transaction.
25
+ attr_accessor :transaction_location_id
26
+
27
+ # The amount of the refund. This will always be non-negative.
28
+ attr_accessor :amount_money
29
+
30
+ # The time when the refund was created, in RFC 3339 format.
31
+ attr_accessor :created_at
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'id' => :'id',
38
+ :'receivable_id' => :'receivable_id',
39
+ :'refund_id' => :'refund_id',
40
+ :'transaction_location_id' => :'transaction_location_id',
41
+ :'amount_money' => :'amount_money',
42
+ :'created_at' => :'created_at'
43
+ }
44
+ end
45
+
46
+ # Attribute type mapping.
47
+ def self.swagger_types
48
+ {
49
+ :'id' => :'String',
50
+ :'receivable_id' => :'String',
51
+ :'refund_id' => :'String',
52
+ :'transaction_location_id' => :'String',
53
+ :'amount_money' => :'Money',
54
+ :'created_at' => :'String'
55
+ }
56
+ end
57
+
58
+ # Initializes the object
59
+ # @param [Hash] attributes Model attributes in the form of hash
60
+ def initialize(attributes = {})
61
+ return unless attributes.is_a?(Hash)
62
+
63
+ # convert string to symbol for hash key
64
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
65
+
66
+ if attributes.has_key?(:'id')
67
+ self.id = attributes[:'id']
68
+ end
69
+
70
+ if attributes.has_key?(:'receivable_id')
71
+ self.receivable_id = attributes[:'receivable_id']
72
+ end
73
+
74
+ if attributes.has_key?(:'refund_id')
75
+ self.refund_id = attributes[:'refund_id']
76
+ end
77
+
78
+ if attributes.has_key?(:'transaction_location_id')
79
+ self.transaction_location_id = attributes[:'transaction_location_id']
80
+ end
81
+
82
+ if attributes.has_key?(:'amount_money')
83
+ self.amount_money = attributes[:'amount_money']
84
+ end
85
+
86
+ if attributes.has_key?(:'created_at')
87
+ self.created_at = attributes[:'created_at']
88
+ end
89
+
90
+ end
91
+
92
+ # Show invalid properties with the reasons. Usually used together with valid?
93
+ # @return Array for valid properies with the reasons
94
+ def list_invalid_properties
95
+ invalid_properties = Array.new
96
+ if @id.nil?
97
+ invalid_properties.push("invalid value for 'id', id cannot be nil.")
98
+ end
99
+
100
+ if @id.to_s.length < 1
101
+ invalid_properties.push("invalid value for 'id', the character length must be great than or equal to 1.")
102
+ end
103
+
104
+ if @receivable_id.nil?
105
+ invalid_properties.push("invalid value for 'receivable_id', receivable_id cannot be nil.")
106
+ end
107
+
108
+ if @receivable_id.to_s.length < 1
109
+ invalid_properties.push("invalid value for 'receivable_id', the character length must be great than or equal to 1.")
110
+ end
111
+
112
+ if @refund_id.nil?
113
+ invalid_properties.push("invalid value for 'refund_id', refund_id cannot be nil.")
114
+ end
115
+
116
+ if @refund_id.to_s.length < 1
117
+ invalid_properties.push("invalid value for 'refund_id', the character length must be great than or equal to 1.")
118
+ end
119
+
120
+ if @transaction_location_id.nil?
121
+ invalid_properties.push("invalid value for 'transaction_location_id', transaction_location_id cannot be nil.")
122
+ end
123
+
124
+ if @transaction_location_id.to_s.length < 1
125
+ invalid_properties.push("invalid value for 'transaction_location_id', the character length must be great than or equal to 1.")
126
+ end
127
+
128
+ if @amount_money.nil?
129
+ invalid_properties.push("invalid value for 'amount_money', amount_money cannot be nil.")
130
+ end
131
+
132
+ return invalid_properties
133
+ end
134
+
135
+ # Check to see if the all the properties in the model are valid
136
+ # @return true if the model is valid
137
+ def valid?
138
+ return false if @id.nil?
139
+ return false if @id.to_s.length < 1
140
+ return false if @receivable_id.nil?
141
+ return false if @receivable_id.to_s.length < 1
142
+ return false if @refund_id.nil?
143
+ return false if @refund_id.to_s.length < 1
144
+ return false if @transaction_location_id.nil?
145
+ return false if @transaction_location_id.to_s.length < 1
146
+ return false if @amount_money.nil?
147
+ return true
148
+ end
149
+
150
+ # Custom attribute writer method with validation
151
+ # @param [Object] id Value to be assigned
152
+ def id=(id)
153
+ if id.nil?
154
+ fail ArgumentError, "id cannot be nil"
155
+ end
156
+
157
+ if id.to_s.length < 1
158
+ fail ArgumentError, "invalid value for 'id', the character length must be great than or equal to 1."
159
+ end
160
+
161
+ @id = id
162
+ end
163
+
164
+ # Custom attribute writer method with validation
165
+ # @param [Object] receivable_id Value to be assigned
166
+ def receivable_id=(receivable_id)
167
+ if receivable_id.nil?
168
+ fail ArgumentError, "receivable_id cannot be nil"
169
+ end
170
+
171
+ if receivable_id.to_s.length < 1
172
+ fail ArgumentError, "invalid value for 'receivable_id', the character length must be great than or equal to 1."
173
+ end
174
+
175
+ @receivable_id = receivable_id
176
+ end
177
+
178
+ # Custom attribute writer method with validation
179
+ # @param [Object] refund_id Value to be assigned
180
+ def refund_id=(refund_id)
181
+ if refund_id.nil?
182
+ fail ArgumentError, "refund_id cannot be nil"
183
+ end
184
+
185
+ if refund_id.to_s.length < 1
186
+ fail ArgumentError, "invalid value for 'refund_id', the character length must be great than or equal to 1."
187
+ end
188
+
189
+ @refund_id = refund_id
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] transaction_location_id Value to be assigned
194
+ def transaction_location_id=(transaction_location_id)
195
+ if transaction_location_id.nil?
196
+ fail ArgumentError, "transaction_location_id cannot be nil"
197
+ end
198
+
199
+ if transaction_location_id.to_s.length < 1
200
+ fail ArgumentError, "invalid value for 'transaction_location_id', the character length must be great than or equal to 1."
201
+ end
202
+
203
+ @transaction_location_id = transaction_location_id
204
+ end
205
+
206
+ # Checks equality by comparing each attribute.
207
+ # @param [Object] Object to be compared
208
+ def ==(o)
209
+ return true if self.equal?(o)
210
+ self.class == o.class &&
211
+ id == o.id &&
212
+ receivable_id == o.receivable_id &&
213
+ refund_id == o.refund_id &&
214
+ transaction_location_id == o.transaction_location_id &&
215
+ amount_money == o.amount_money &&
216
+ created_at == o.created_at
217
+ end
218
+
219
+ # @see the `==` method
220
+ # @param [Object] Object to be compared
221
+ def eql?(o)
222
+ self == o
223
+ end
224
+
225
+ # Calculates hash code according to all attributes.
226
+ # @return [Fixnum] Hash code
227
+ def hash
228
+ [id, receivable_id, refund_id, transaction_location_id, amount_money, created_at].hash
229
+ end
230
+
231
+ # Builds the object from hash
232
+ # @param [Hash] attributes Model attributes in the form of hash
233
+ # @return [Object] Returns the model itself
234
+ def build_from_hash(attributes)
235
+ return nil unless attributes.is_a?(Hash)
236
+ self.class.swagger_types.each_pair do |key, type|
237
+ if type =~ /\AArray<(.*)>/i
238
+ # check to ensure the input is an array given that the the attribute
239
+ # is documented as an array but the input is not
240
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
241
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
242
+ end
243
+ elsif !attributes[self.class.attribute_map[key]].nil?
244
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
245
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
246
+ end
247
+
248
+ self
249
+ end
250
+
251
+ # Deserializes the data based on type
252
+ # @param string type Data type
253
+ # @param string value Value to be deserialized
254
+ # @return [Object] Deserialized data
255
+ def _deserialize(type, value)
256
+ case type.to_sym
257
+ when :DateTime
258
+ DateTime.parse(value)
259
+ when :Date
260
+ Date.parse(value)
261
+ when :String
262
+ value.to_s
263
+ when :Integer
264
+ value.to_i
265
+ when :Float
266
+ value.to_f
267
+ when :BOOLEAN
268
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
269
+ true
270
+ else
271
+ false
272
+ end
273
+ when :Object
274
+ # generic object (usually a Hash), return directly
275
+ value
276
+ when /\AArray<(?<inner_type>.+)>\z/
277
+ inner_type = Regexp.last_match[:inner_type]
278
+ value.map { |v| _deserialize(inner_type, v) }
279
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
280
+ k_type = Regexp.last_match[:k_type]
281
+ v_type = Regexp.last_match[:v_type]
282
+ {}.tap do |hash|
283
+ value.each do |k, v|
284
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
285
+ end
286
+ end
287
+ else # model
288
+ temp_model = SquareConnect.const_get(type).new
289
+ temp_model.build_from_hash(value)
290
+ end
291
+ end
292
+
293
+ # Returns the string representation of the object
294
+ # @return [String] String presentation of the object
295
+ def to_s
296
+ to_hash.to_s
297
+ end
298
+
299
+ # to_body is an alias to to_hash (backward compatibility)
300
+ # @return [Hash] Returns the object in the form of hash
301
+ def to_body
302
+ to_hash
303
+ end
304
+
305
+ # Returns the object in the form of hash
306
+ # @return [Hash] Returns the object in the form of hash
307
+ def to_hash
308
+ hash = {}
309
+ self.class.attribute_map.each_pair do |attr, param|
310
+ value = self.send(attr)
311
+ next if value.nil?
312
+ hash[param] = _to_hash(value)
313
+ end
314
+ hash
315
+ end
316
+
317
+ # Outputs non-array value in the form of hash
318
+ # For object, use to_hash. Otherwise, just return the value
319
+ # @param [Object] value Any valid value
320
+ # @return [Hash] Returns the value in the form of hash
321
+ def _to_hash(value)
322
+ if value.is_a?(Array)
323
+ value.compact.map{ |v| _to_hash(v) }
324
+ elsif value.is_a?(Hash)
325
+ {}.tap do |hash|
326
+ value.each { |k, v| hash[k] = _to_hash(v) }
327
+ end
328
+ elsif value.respond_to? :to_hash
329
+ value.to_hash
330
+ else
331
+ value
332
+ end
333
+ end
334
+
335
+ end
336
+
337
+ end