square_connect 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES.md +5 -0
  3. data/CONTRIBUTING.md +5 -0
  4. data/LICENSE.txt +202 -0
  5. data/README.md +47 -0
  6. data/lib/square_connect.rb +88 -0
  7. data/lib/square_connect/api/customer_api.rb +354 -0
  8. data/lib/square_connect/api/customer_card_api.rb +163 -0
  9. data/lib/square_connect/api/location_api.rb +82 -0
  10. data/lib/square_connect/api/refund_api.rb +179 -0
  11. data/lib/square_connect/api/transaction_api.rb +387 -0
  12. data/lib/square_connect/api_client.rb +337 -0
  13. data/lib/square_connect/api_error.rb +31 -0
  14. data/lib/square_connect/configuration.rb +163 -0
  15. data/lib/square_connect/models/address.rb +288 -0
  16. data/lib/square_connect/models/capture_transaction_response.rb +160 -0
  17. data/lib/square_connect/models/card.rb +233 -0
  18. data/lib/square_connect/models/card_brand.rb +147 -0
  19. data/lib/square_connect/models/charge_request.rb +257 -0
  20. data/lib/square_connect/models/charge_response.rb +171 -0
  21. data/lib/square_connect/models/country.rb +147 -0
  22. data/lib/square_connect/models/create_customer_card_request.rb +180 -0
  23. data/lib/square_connect/models/create_customer_card_response.rb +171 -0
  24. data/lib/square_connect/models/create_customer_request.rb +246 -0
  25. data/lib/square_connect/models/create_customer_response.rb +171 -0
  26. data/lib/square_connect/models/create_refund_request.rb +191 -0
  27. data/lib/square_connect/models/create_refund_response.rb +171 -0
  28. data/lib/square_connect/models/currency.rb +147 -0
  29. data/lib/square_connect/models/customer.rb +292 -0
  30. data/lib/square_connect/models/delete_customer_card_response.rb +160 -0
  31. data/lib/square_connect/models/delete_customer_response.rb +160 -0
  32. data/lib/square_connect/models/error.rb +209 -0
  33. data/lib/square_connect/models/error_category.rb +147 -0
  34. data/lib/square_connect/models/error_code.rb +147 -0
  35. data/lib/square_connect/models/list_customers_request.rb +158 -0
  36. data/lib/square_connect/models/list_customers_response.rb +184 -0
  37. data/lib/square_connect/models/list_locations_response.rb +173 -0
  38. data/lib/square_connect/models/list_refunds_request.rb +200 -0
  39. data/lib/square_connect/models/list_refunds_response.rb +184 -0
  40. data/lib/square_connect/models/list_transactions_request.rb +200 -0
  41. data/lib/square_connect/models/list_transactions_response.rb +184 -0
  42. data/lib/square_connect/models/location.rb +204 -0
  43. data/lib/square_connect/models/location_capability.rb +147 -0
  44. data/lib/square_connect/models/money.rb +178 -0
  45. data/lib/square_connect/models/refund.rb +255 -0
  46. data/lib/square_connect/models/refund_status.rb +147 -0
  47. data/lib/square_connect/models/retrieve_customer_response.rb +171 -0
  48. data/lib/square_connect/models/retrieve_transaction_response.rb +171 -0
  49. data/lib/square_connect/models/sort_order.rb +147 -0
  50. data/lib/square_connect/models/tender.rb +277 -0
  51. data/lib/square_connect/models/tender_card_details.rb +198 -0
  52. data/lib/square_connect/models/tender_card_details_entry_method.rb +147 -0
  53. data/lib/square_connect/models/tender_card_details_status.rb +147 -0
  54. data/lib/square_connect/models/tender_cash_details.rb +169 -0
  55. data/lib/square_connect/models/tender_type.rb +147 -0
  56. data/lib/square_connect/models/transaction.rb +237 -0
  57. data/lib/square_connect/models/transaction_product.rb +147 -0
  58. data/lib/square_connect/models/update_customer_request.rb +246 -0
  59. data/lib/square_connect/models/update_customer_response.rb +171 -0
  60. data/lib/square_connect/models/void_transaction_response.rb +160 -0
  61. data/lib/square_connect/version.rb +13 -0
  62. data/square_connect.gemspec +32 -0
  63. metadata +286 -0
@@ -0,0 +1,171 @@
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
+
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module SquareConnect
14
+ # Defines the fields that are included in the response body of\na request to the **CreateRefund** endpoint.\n\nOne of `errors` or `refund` is present in a given response (never both).
15
+ class CreateRefundResponse
16
+ # Any errors that occurred during the request.
17
+ attr_accessor :errors
18
+
19
+ # The details of the created refund.
20
+ attr_accessor :refund
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+
26
+ :'errors' => :'errors',
27
+
28
+ :'refund' => :'refund'
29
+
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'errors' => :'Array<Error>',
37
+ :'refund' => :'Refund'
38
+
39
+ }
40
+ end
41
+
42
+ def initialize(attributes = {})
43
+ return unless attributes.is_a?(Hash)
44
+
45
+ # convert string to symbol for hash key
46
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
47
+
48
+
49
+ if attributes[:'errors']
50
+ if (value = attributes[:'errors']).is_a?(Array)
51
+ self.errors = value
52
+ end
53
+ end
54
+
55
+ if attributes[:'refund']
56
+ self.refund = attributes[:'refund']
57
+ end
58
+
59
+ end
60
+
61
+ # Check equality by comparing each attribute.
62
+ def ==(o)
63
+ return true if self.equal?(o)
64
+ self.class == o.class &&
65
+ errors == o.errors &&
66
+ refund == o.refund
67
+ end
68
+
69
+ # @see the `==` method
70
+ def eql?(o)
71
+ self == o
72
+ end
73
+
74
+ # Calculate hash code according to all attributes.
75
+ def hash
76
+ [errors, refund].hash
77
+ end
78
+
79
+ # build the object from hash
80
+ def build_from_hash(attributes)
81
+ return nil unless attributes.is_a?(Hash)
82
+ self.class.swagger_types.each_pair do |key, type|
83
+ if type =~ /^Array<(.*)>/i
84
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
85
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
86
+ else
87
+ #TODO show warning in debug mode
88
+ end
89
+ elsif !attributes[self.class.attribute_map[key]].nil?
90
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
91
+ else
92
+ # data not found in attributes(hash), not an issue as the data can be optional
93
+ end
94
+ end
95
+
96
+ self
97
+ end
98
+
99
+ def _deserialize(type, value)
100
+ case type.to_sym
101
+ when :DateTime
102
+ DateTime.parse(value)
103
+ when :Date
104
+ Date.parse(value)
105
+ when :String
106
+ value.to_s
107
+ when :Integer
108
+ value.to_i
109
+ when :Float
110
+ value.to_f
111
+ when :BOOLEAN
112
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
113
+ true
114
+ else
115
+ false
116
+ end
117
+ when /\AArray<(?<inner_type>.+)>\z/
118
+ inner_type = Regexp.last_match[:inner_type]
119
+ value.map { |v| _deserialize(inner_type, v) }
120
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
121
+ k_type = Regexp.last_match[:k_type]
122
+ v_type = Regexp.last_match[:v_type]
123
+ {}.tap do |hash|
124
+ value.each do |k, v|
125
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
126
+ end
127
+ end
128
+ else # model
129
+ _model = SquareConnect.const_get(type).new
130
+ _model.build_from_hash(value)
131
+ end
132
+ end
133
+
134
+ def to_s
135
+ to_hash.to_s
136
+ end
137
+
138
+ # to_body is an alias to to_body (backward compatibility))
139
+ def to_body
140
+ to_hash
141
+ end
142
+
143
+ # return the object in the form of hash
144
+ def to_hash
145
+ hash = {}
146
+ self.class.attribute_map.each_pair do |attr, param|
147
+ value = self.send(attr)
148
+ next if value.nil?
149
+ hash[param] = _to_hash(value)
150
+ end
151
+ hash
152
+ end
153
+
154
+ # Method to output non-array value in the form of hash
155
+ # For object, use to_hash. Otherwise, just return the value
156
+ def _to_hash(value)
157
+ if value.is_a?(Array)
158
+ value.compact.map{ |v| _to_hash(v) }
159
+ elsif value.is_a?(Hash)
160
+ {}.tap do |hash|
161
+ value.each { |k, v| hash[k] = _to_hash(v) }
162
+ end
163
+ elsif value.respond_to? :to_hash
164
+ value.to_hash
165
+ else
166
+ value
167
+ end
168
+ end
169
+
170
+ end
171
+ end
@@ -0,0 +1,147 @@
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
+
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module SquareConnect
14
+ #
15
+ class Currency
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+
20
+ }
21
+ end
22
+
23
+ # Attribute type mapping.
24
+ def self.swagger_types
25
+ {
26
+
27
+ }
28
+ end
29
+
30
+ def initialize(attributes = {})
31
+ return unless attributes.is_a?(Hash)
32
+
33
+ # convert string to symbol for hash key
34
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
35
+
36
+
37
+ end
38
+
39
+ # Check equality by comparing each attribute.
40
+ def ==(o)
41
+ return true if self.equal?(o)
42
+ self.class == o.class
43
+ end
44
+
45
+ # @see the `==` method
46
+ def eql?(o)
47
+ self == o
48
+ end
49
+
50
+ # Calculate hash code according to all attributes.
51
+ def hash
52
+ [].hash
53
+ end
54
+
55
+ # build the object from hash
56
+ def build_from_hash(attributes)
57
+ return nil unless attributes.is_a?(Hash)
58
+ self.class.swagger_types.each_pair do |key, type|
59
+ if type =~ /^Array<(.*)>/i
60
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
61
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
62
+ else
63
+ #TODO show warning in debug mode
64
+ end
65
+ elsif !attributes[self.class.attribute_map[key]].nil?
66
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
67
+ else
68
+ # data not found in attributes(hash), not an issue as the data can be optional
69
+ end
70
+ end
71
+
72
+ self
73
+ end
74
+
75
+ def _deserialize(type, value)
76
+ case type.to_sym
77
+ when :DateTime
78
+ DateTime.parse(value)
79
+ when :Date
80
+ Date.parse(value)
81
+ when :String
82
+ value.to_s
83
+ when :Integer
84
+ value.to_i
85
+ when :Float
86
+ value.to_f
87
+ when :BOOLEAN
88
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
89
+ true
90
+ else
91
+ false
92
+ end
93
+ when /\AArray<(?<inner_type>.+)>\z/
94
+ inner_type = Regexp.last_match[:inner_type]
95
+ value.map { |v| _deserialize(inner_type, v) }
96
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
97
+ k_type = Regexp.last_match[:k_type]
98
+ v_type = Regexp.last_match[:v_type]
99
+ {}.tap do |hash|
100
+ value.each do |k, v|
101
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
102
+ end
103
+ end
104
+ else # model
105
+ _model = SquareConnect.const_get(type).new
106
+ _model.build_from_hash(value)
107
+ end
108
+ end
109
+
110
+ def to_s
111
+ to_hash.to_s
112
+ end
113
+
114
+ # to_body is an alias to to_body (backward compatibility))
115
+ def to_body
116
+ to_hash
117
+ end
118
+
119
+ # return the object in the form of hash
120
+ def to_hash
121
+ hash = {}
122
+ self.class.attribute_map.each_pair do |attr, param|
123
+ value = self.send(attr)
124
+ next if value.nil?
125
+ hash[param] = _to_hash(value)
126
+ end
127
+ hash
128
+ end
129
+
130
+ # Method to output non-array value in the form of hash
131
+ # For object, use to_hash. Otherwise, just return the value
132
+ def _to_hash(value)
133
+ if value.is_a?(Array)
134
+ value.compact.map{ |v| _to_hash(v) }
135
+ elsif value.is_a?(Hash)
136
+ {}.tap do |hash|
137
+ value.each { |k, v| hash[k] = _to_hash(v) }
138
+ end
139
+ elsif value.respond_to? :to_hash
140
+ value.to_hash
141
+ else
142
+ value
143
+ end
144
+ end
145
+
146
+ end
147
+ end
@@ -0,0 +1,292 @@
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
+
9
+ =end
10
+
11
+ require 'date'
12
+
13
+ module SquareConnect
14
+ #
15
+ class Customer
16
+ # The customer's unique ID.
17
+ attr_accessor :id
18
+
19
+ # The time when the customer was created, in RFC 3339 format.
20
+ attr_accessor :created_at
21
+
22
+ # The time when the customer was updated, in RFC 3339 format.
23
+ attr_accessor :updated_at
24
+
25
+ # Cards on file for the customer.
26
+ attr_accessor :cards
27
+
28
+ #
29
+ attr_accessor :given_name
30
+
31
+ #
32
+ attr_accessor :family_name
33
+
34
+ #
35
+ attr_accessor :nickname
36
+
37
+ #
38
+ attr_accessor :company_name
39
+
40
+ #
41
+ attr_accessor :email_address
42
+
43
+ #
44
+ attr_accessor :address
45
+
46
+ #
47
+ attr_accessor :phone_number
48
+
49
+ #
50
+ attr_accessor :reference_id
51
+
52
+ #
53
+ attr_accessor :note
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+
59
+ :'id' => :'id',
60
+
61
+ :'created_at' => :'created_at',
62
+
63
+ :'updated_at' => :'updated_at',
64
+
65
+ :'cards' => :'cards',
66
+
67
+ :'given_name' => :'given_name',
68
+
69
+ :'family_name' => :'family_name',
70
+
71
+ :'nickname' => :'nickname',
72
+
73
+ :'company_name' => :'company_name',
74
+
75
+ :'email_address' => :'email_address',
76
+
77
+ :'address' => :'address',
78
+
79
+ :'phone_number' => :'phone_number',
80
+
81
+ :'reference_id' => :'reference_id',
82
+
83
+ :'note' => :'note'
84
+
85
+ }
86
+ end
87
+
88
+ # Attribute type mapping.
89
+ def self.swagger_types
90
+ {
91
+ :'id' => :'String',
92
+ :'created_at' => :'String',
93
+ :'updated_at' => :'String',
94
+ :'cards' => :'Array<Card>',
95
+ :'given_name' => :'String',
96
+ :'family_name' => :'String',
97
+ :'nickname' => :'String',
98
+ :'company_name' => :'String',
99
+ :'email_address' => :'String',
100
+ :'address' => :'Address',
101
+ :'phone_number' => :'String',
102
+ :'reference_id' => :'String',
103
+ :'note' => :'String'
104
+
105
+ }
106
+ end
107
+
108
+ def initialize(attributes = {})
109
+ return unless attributes.is_a?(Hash)
110
+
111
+ # convert string to symbol for hash key
112
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
113
+
114
+
115
+ if attributes[:'id']
116
+ self.id = attributes[:'id']
117
+ end
118
+
119
+ if attributes[:'created_at']
120
+ self.created_at = attributes[:'created_at']
121
+ end
122
+
123
+ if attributes[:'updated_at']
124
+ self.updated_at = attributes[:'updated_at']
125
+ end
126
+
127
+ if attributes[:'cards']
128
+ if (value = attributes[:'cards']).is_a?(Array)
129
+ self.cards = value
130
+ end
131
+ end
132
+
133
+ if attributes[:'given_name']
134
+ self.given_name = attributes[:'given_name']
135
+ end
136
+
137
+ if attributes[:'family_name']
138
+ self.family_name = attributes[:'family_name']
139
+ end
140
+
141
+ if attributes[:'nickname']
142
+ self.nickname = attributes[:'nickname']
143
+ end
144
+
145
+ if attributes[:'company_name']
146
+ self.company_name = attributes[:'company_name']
147
+ end
148
+
149
+ if attributes[:'email_address']
150
+ self.email_address = attributes[:'email_address']
151
+ end
152
+
153
+ if attributes[:'address']
154
+ self.address = attributes[:'address']
155
+ end
156
+
157
+ if attributes[:'phone_number']
158
+ self.phone_number = attributes[:'phone_number']
159
+ end
160
+
161
+ if attributes[:'reference_id']
162
+ self.reference_id = attributes[:'reference_id']
163
+ end
164
+
165
+ if attributes[:'note']
166
+ self.note = attributes[:'note']
167
+ end
168
+
169
+ end
170
+
171
+ # Check equality by comparing each attribute.
172
+ def ==(o)
173
+ return true if self.equal?(o)
174
+ self.class == o.class &&
175
+ id == o.id &&
176
+ created_at == o.created_at &&
177
+ updated_at == o.updated_at &&
178
+ cards == o.cards &&
179
+ given_name == o.given_name &&
180
+ family_name == o.family_name &&
181
+ nickname == o.nickname &&
182
+ company_name == o.company_name &&
183
+ email_address == o.email_address &&
184
+ address == o.address &&
185
+ phone_number == o.phone_number &&
186
+ reference_id == o.reference_id &&
187
+ note == o.note
188
+ end
189
+
190
+ # @see the `==` method
191
+ def eql?(o)
192
+ self == o
193
+ end
194
+
195
+ # Calculate hash code according to all attributes.
196
+ def hash
197
+ [id, created_at, updated_at, cards, given_name, family_name, nickname, company_name, email_address, address, phone_number, reference_id, note].hash
198
+ end
199
+
200
+ # build the object from hash
201
+ def build_from_hash(attributes)
202
+ return nil unless attributes.is_a?(Hash)
203
+ self.class.swagger_types.each_pair do |key, type|
204
+ if type =~ /^Array<(.*)>/i
205
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
206
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
207
+ else
208
+ #TODO show warning in debug mode
209
+ end
210
+ elsif !attributes[self.class.attribute_map[key]].nil?
211
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
212
+ else
213
+ # data not found in attributes(hash), not an issue as the data can be optional
214
+ end
215
+ end
216
+
217
+ self
218
+ end
219
+
220
+ def _deserialize(type, value)
221
+ case type.to_sym
222
+ when :DateTime
223
+ DateTime.parse(value)
224
+ when :Date
225
+ Date.parse(value)
226
+ when :String
227
+ value.to_s
228
+ when :Integer
229
+ value.to_i
230
+ when :Float
231
+ value.to_f
232
+ when :BOOLEAN
233
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
234
+ true
235
+ else
236
+ false
237
+ end
238
+ when /\AArray<(?<inner_type>.+)>\z/
239
+ inner_type = Regexp.last_match[:inner_type]
240
+ value.map { |v| _deserialize(inner_type, v) }
241
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
242
+ k_type = Regexp.last_match[:k_type]
243
+ v_type = Regexp.last_match[:v_type]
244
+ {}.tap do |hash|
245
+ value.each do |k, v|
246
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
247
+ end
248
+ end
249
+ else # model
250
+ _model = SquareConnect.const_get(type).new
251
+ _model.build_from_hash(value)
252
+ end
253
+ end
254
+
255
+ def to_s
256
+ to_hash.to_s
257
+ end
258
+
259
+ # to_body is an alias to to_body (backward compatibility))
260
+ def to_body
261
+ to_hash
262
+ end
263
+
264
+ # return the object in the form of hash
265
+ def to_hash
266
+ hash = {}
267
+ self.class.attribute_map.each_pair do |attr, param|
268
+ value = self.send(attr)
269
+ next if value.nil?
270
+ hash[param] = _to_hash(value)
271
+ end
272
+ hash
273
+ end
274
+
275
+ # Method to output non-array value in the form of hash
276
+ # For object, use to_hash. Otherwise, just return the value
277
+ def _to_hash(value)
278
+ if value.is_a?(Array)
279
+ value.compact.map{ |v| _to_hash(v) }
280
+ elsif value.is_a?(Hash)
281
+ {}.tap do |hash|
282
+ value.each { |k, v| hash[k] = _to_hash(v) }
283
+ end
284
+ elsif value.respond_to? :to_hash
285
+ value.to_hash
286
+ else
287
+ value
288
+ end
289
+ end
290
+
291
+ end
292
+ end