square_connect 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
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,255 @@
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 Refund
16
+ # The unique ID of the refund.
17
+ attr_accessor :id
18
+
19
+ # The ID of the refund's associated location.
20
+ attr_accessor :location_id
21
+
22
+ # The ID of the transaction refunded.
23
+ attr_accessor :transaction_id
24
+
25
+ # The ID of the tender refunded.
26
+ attr_accessor :tender_id
27
+
28
+ # The time when the refund was created, in RFC 3339 format.
29
+ attr_accessor :created_at
30
+
31
+ # The reason for the refund being issued.
32
+ attr_accessor :reason
33
+
34
+ # The amount of money refunded.
35
+ attr_accessor :amount_money
36
+
37
+ #
38
+ attr_accessor :status
39
+
40
+ # The amount of processing fee refunded.
41
+ attr_accessor :processing_fee_money
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+
47
+ :'id' => :'id',
48
+
49
+ :'location_id' => :'location_id',
50
+
51
+ :'transaction_id' => :'transaction_id',
52
+
53
+ :'tender_id' => :'tender_id',
54
+
55
+ :'created_at' => :'created_at',
56
+
57
+ :'reason' => :'reason',
58
+
59
+ :'amount_money' => :'amount_money',
60
+
61
+ :'status' => :'status',
62
+
63
+ :'processing_fee_money' => :'processing_fee_money'
64
+
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'id' => :'String',
72
+ :'location_id' => :'String',
73
+ :'transaction_id' => :'String',
74
+ :'tender_id' => :'String',
75
+ :'created_at' => :'String',
76
+ :'reason' => :'String',
77
+ :'amount_money' => :'Money',
78
+ :'status' => :'String',
79
+ :'processing_fee_money' => :'Money'
80
+
81
+ }
82
+ end
83
+
84
+ def initialize(attributes = {})
85
+ return unless attributes.is_a?(Hash)
86
+
87
+ # convert string to symbol for hash key
88
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
89
+
90
+
91
+ if attributes[:'id']
92
+ self.id = attributes[:'id']
93
+ end
94
+
95
+ if attributes[:'location_id']
96
+ self.location_id = attributes[:'location_id']
97
+ end
98
+
99
+ if attributes[:'transaction_id']
100
+ self.transaction_id = attributes[:'transaction_id']
101
+ end
102
+
103
+ if attributes[:'tender_id']
104
+ self.tender_id = attributes[:'tender_id']
105
+ end
106
+
107
+ if attributes[:'created_at']
108
+ self.created_at = attributes[:'created_at']
109
+ end
110
+
111
+ if attributes[:'reason']
112
+ self.reason = attributes[:'reason']
113
+ end
114
+
115
+ if attributes[:'amount_money']
116
+ self.amount_money = attributes[:'amount_money']
117
+ end
118
+
119
+ if attributes[:'status']
120
+ self.status = attributes[:'status']
121
+ end
122
+
123
+ if attributes[:'processing_fee_money']
124
+ self.processing_fee_money = attributes[:'processing_fee_money']
125
+ end
126
+
127
+ end
128
+
129
+ # Custom attribute writer method checking allowed values (enum).
130
+ def status=(status)
131
+ allowed_values = ["PENDING", "APPROVED", "REJECTED", "FAILED"]
132
+ if status && !allowed_values.include?(status)
133
+ fail "invalid value for 'status', must be one of #{allowed_values}"
134
+ end
135
+ @status = status
136
+ end
137
+
138
+ # Check equality by comparing each attribute.
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ id == o.id &&
143
+ location_id == o.location_id &&
144
+ transaction_id == o.transaction_id &&
145
+ tender_id == o.tender_id &&
146
+ created_at == o.created_at &&
147
+ reason == o.reason &&
148
+ amount_money == o.amount_money &&
149
+ status == o.status &&
150
+ processing_fee_money == o.processing_fee_money
151
+ end
152
+
153
+ # @see the `==` method
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculate hash code according to all attributes.
159
+ def hash
160
+ [id, location_id, transaction_id, tender_id, created_at, reason, amount_money, status, processing_fee_money].hash
161
+ end
162
+
163
+ # build the object from hash
164
+ def build_from_hash(attributes)
165
+ return nil unless attributes.is_a?(Hash)
166
+ self.class.swagger_types.each_pair do |key, type|
167
+ if type =~ /^Array<(.*)>/i
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
170
+ else
171
+ #TODO show warning in debug mode
172
+ end
173
+ elsif !attributes[self.class.attribute_map[key]].nil?
174
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
175
+ else
176
+ # data not found in attributes(hash), not an issue as the data can be optional
177
+ end
178
+ end
179
+
180
+ self
181
+ end
182
+
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :DateTime
186
+ DateTime.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :BOOLEAN
196
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when /\AArray<(?<inner_type>.+)>\z/
202
+ inner_type = Regexp.last_match[:inner_type]
203
+ value.map { |v| _deserialize(inner_type, v) }
204
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
205
+ k_type = Regexp.last_match[:k_type]
206
+ v_type = Regexp.last_match[:v_type]
207
+ {}.tap do |hash|
208
+ value.each do |k, v|
209
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
210
+ end
211
+ end
212
+ else # model
213
+ _model = SquareConnect.const_get(type).new
214
+ _model.build_from_hash(value)
215
+ end
216
+ end
217
+
218
+ def to_s
219
+ to_hash.to_s
220
+ end
221
+
222
+ # to_body is an alias to to_body (backward compatibility))
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # return the object in the form of hash
228
+ def to_hash
229
+ hash = {}
230
+ self.class.attribute_map.each_pair do |attr, param|
231
+ value = self.send(attr)
232
+ next if value.nil?
233
+ hash[param] = _to_hash(value)
234
+ end
235
+ hash
236
+ end
237
+
238
+ # Method to output non-array value in the form of hash
239
+ # For object, use to_hash. Otherwise, just return the value
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map{ |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+ 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 RefundStatus
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,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 **RetrieveCustomer** endpoint.\n\nOne of `errors` or `customer` is present in a given response (never both).
15
+ class RetrieveCustomerResponse
16
+ #
17
+ attr_accessor :errors
18
+
19
+ #
20
+ attr_accessor :customer
21
+
22
+ # Attribute mapping from ruby-style variable name to JSON key.
23
+ def self.attribute_map
24
+ {
25
+
26
+ :'errors' => :'errors',
27
+
28
+ :'customer' => :'customer'
29
+
30
+ }
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.swagger_types
35
+ {
36
+ :'errors' => :'Array<Error>',
37
+ :'customer' => :'Customer'
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[:'customer']
56
+ self.customer = attributes[:'customer']
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
+ customer == o.customer
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, customer].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