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,246 @@
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 CreateCustomerRequest
16
+ #
17
+ attr_accessor :given_name
18
+
19
+ #
20
+ attr_accessor :family_name
21
+
22
+ #
23
+ attr_accessor :company_name
24
+
25
+ #
26
+ attr_accessor :nickname
27
+
28
+ #
29
+ attr_accessor :email_address
30
+
31
+ #
32
+ attr_accessor :address
33
+
34
+ #
35
+ attr_accessor :phone_number
36
+
37
+ #
38
+ attr_accessor :reference_id
39
+
40
+ #
41
+ attr_accessor :note
42
+
43
+ # Attribute mapping from ruby-style variable name to JSON key.
44
+ def self.attribute_map
45
+ {
46
+
47
+ :'given_name' => :'given_name',
48
+
49
+ :'family_name' => :'family_name',
50
+
51
+ :'company_name' => :'company_name',
52
+
53
+ :'nickname' => :'nickname',
54
+
55
+ :'email_address' => :'email_address',
56
+
57
+ :'address' => :'address',
58
+
59
+ :'phone_number' => :'phone_number',
60
+
61
+ :'reference_id' => :'reference_id',
62
+
63
+ :'note' => :'note'
64
+
65
+ }
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.swagger_types
70
+ {
71
+ :'given_name' => :'String',
72
+ :'family_name' => :'String',
73
+ :'company_name' => :'String',
74
+ :'nickname' => :'String',
75
+ :'email_address' => :'String',
76
+ :'address' => :'Address',
77
+ :'phone_number' => :'String',
78
+ :'reference_id' => :'String',
79
+ :'note' => :'String'
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[:'given_name']
92
+ self.given_name = attributes[:'given_name']
93
+ end
94
+
95
+ if attributes[:'family_name']
96
+ self.family_name = attributes[:'family_name']
97
+ end
98
+
99
+ if attributes[:'company_name']
100
+ self.company_name = attributes[:'company_name']
101
+ end
102
+
103
+ if attributes[:'nickname']
104
+ self.nickname = attributes[:'nickname']
105
+ end
106
+
107
+ if attributes[:'email_address']
108
+ self.email_address = attributes[:'email_address']
109
+ end
110
+
111
+ if attributes[:'address']
112
+ self.address = attributes[:'address']
113
+ end
114
+
115
+ if attributes[:'phone_number']
116
+ self.phone_number = attributes[:'phone_number']
117
+ end
118
+
119
+ if attributes[:'reference_id']
120
+ self.reference_id = attributes[:'reference_id']
121
+ end
122
+
123
+ if attributes[:'note']
124
+ self.note = attributes[:'note']
125
+ end
126
+
127
+ end
128
+
129
+ # Check equality by comparing each attribute.
130
+ def ==(o)
131
+ return true if self.equal?(o)
132
+ self.class == o.class &&
133
+ given_name == o.given_name &&
134
+ family_name == o.family_name &&
135
+ company_name == o.company_name &&
136
+ nickname == o.nickname &&
137
+ email_address == o.email_address &&
138
+ address == o.address &&
139
+ phone_number == o.phone_number &&
140
+ reference_id == o.reference_id &&
141
+ note == o.note
142
+ end
143
+
144
+ # @see the `==` method
145
+ def eql?(o)
146
+ self == o
147
+ end
148
+
149
+ # Calculate hash code according to all attributes.
150
+ def hash
151
+ [given_name, family_name, company_name, nickname, email_address, address, phone_number, reference_id, note].hash
152
+ end
153
+
154
+ # build the object from hash
155
+ def build_from_hash(attributes)
156
+ return nil unless attributes.is_a?(Hash)
157
+ self.class.swagger_types.each_pair do |key, type|
158
+ if type =~ /^Array<(.*)>/i
159
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
160
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
161
+ else
162
+ #TODO show warning in debug mode
163
+ end
164
+ elsif !attributes[self.class.attribute_map[key]].nil?
165
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
166
+ else
167
+ # data not found in attributes(hash), not an issue as the data can be optional
168
+ end
169
+ end
170
+
171
+ self
172
+ end
173
+
174
+ def _deserialize(type, value)
175
+ case type.to_sym
176
+ when :DateTime
177
+ DateTime.parse(value)
178
+ when :Date
179
+ Date.parse(value)
180
+ when :String
181
+ value.to_s
182
+ when :Integer
183
+ value.to_i
184
+ when :Float
185
+ value.to_f
186
+ when :BOOLEAN
187
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
188
+ true
189
+ else
190
+ false
191
+ end
192
+ when /\AArray<(?<inner_type>.+)>\z/
193
+ inner_type = Regexp.last_match[:inner_type]
194
+ value.map { |v| _deserialize(inner_type, v) }
195
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
196
+ k_type = Regexp.last_match[:k_type]
197
+ v_type = Regexp.last_match[:v_type]
198
+ {}.tap do |hash|
199
+ value.each do |k, v|
200
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
201
+ end
202
+ end
203
+ else # model
204
+ _model = SquareConnect.const_get(type).new
205
+ _model.build_from_hash(value)
206
+ end
207
+ end
208
+
209
+ def to_s
210
+ to_hash.to_s
211
+ end
212
+
213
+ # to_body is an alias to to_body (backward compatibility))
214
+ def to_body
215
+ to_hash
216
+ end
217
+
218
+ # return the object in the form of hash
219
+ def to_hash
220
+ hash = {}
221
+ self.class.attribute_map.each_pair do |attr, param|
222
+ value = self.send(attr)
223
+ next if value.nil?
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ # Method to output non-array value in the form of hash
230
+ # For object, use to_hash. Otherwise, just return the value
231
+ def _to_hash(value)
232
+ if value.is_a?(Array)
233
+ value.compact.map{ |v| _to_hash(v) }
234
+ elsif value.is_a?(Hash)
235
+ {}.tap do |hash|
236
+ value.each { |k, v| hash[k] = _to_hash(v) }
237
+ end
238
+ elsif value.respond_to? :to_hash
239
+ value.to_hash
240
+ else
241
+ value
242
+ end
243
+ end
244
+
245
+ end
246
+ 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 **CreateCustomer** endpoint.\n\nOne of `errors` or `customer` is present in a given response (never both).
15
+ class CreateCustomerResponse
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
@@ -0,0 +1,191 @@
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 body parameters that can be included in\na request to the **CreateRefund** endpoint.
15
+ class CreateRefundRequest
16
+ # A value you specify that uniquely identifies this\nrefund among refunds you've created for the tender.\n\nIf you're unsure whether a particular refund succeeded,\nyou can reattempt it with the same idempotency key without\nworrying about duplicating the refund.
17
+ attr_accessor :idempotency_key
18
+
19
+ # The ID of the tender to refund.
20
+ attr_accessor :tender_id
21
+
22
+ # A description of the reason for the refund.
23
+ attr_accessor :reason
24
+
25
+ # The amount of money to refund.
26
+ attr_accessor :amount_money
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+
32
+ :'idempotency_key' => :'idempotency_key',
33
+
34
+ :'tender_id' => :'tender_id',
35
+
36
+ :'reason' => :'reason',
37
+
38
+ :'amount_money' => :'amount_money'
39
+
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'idempotency_key' => :'String',
47
+ :'tender_id' => :'String',
48
+ :'reason' => :'String',
49
+ :'amount_money' => :'Money'
50
+
51
+ }
52
+ end
53
+
54
+ def initialize(attributes = {})
55
+ return unless attributes.is_a?(Hash)
56
+
57
+ # convert string to symbol for hash key
58
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
59
+
60
+
61
+ if attributes[:'idempotency_key']
62
+ self.idempotency_key = attributes[:'idempotency_key']
63
+ end
64
+
65
+ if attributes[:'tender_id']
66
+ self.tender_id = attributes[:'tender_id']
67
+ end
68
+
69
+ if attributes[:'reason']
70
+ self.reason = attributes[:'reason']
71
+ end
72
+
73
+ if attributes[:'amount_money']
74
+ self.amount_money = attributes[:'amount_money']
75
+ end
76
+
77
+ end
78
+
79
+ # Check equality by comparing each attribute.
80
+ def ==(o)
81
+ return true if self.equal?(o)
82
+ self.class == o.class &&
83
+ idempotency_key == o.idempotency_key &&
84
+ tender_id == o.tender_id &&
85
+ reason == o.reason &&
86
+ amount_money == o.amount_money
87
+ end
88
+
89
+ # @see the `==` method
90
+ def eql?(o)
91
+ self == o
92
+ end
93
+
94
+ # Calculate hash code according to all attributes.
95
+ def hash
96
+ [idempotency_key, tender_id, reason, amount_money].hash
97
+ end
98
+
99
+ # build the object from hash
100
+ def build_from_hash(attributes)
101
+ return nil unless attributes.is_a?(Hash)
102
+ self.class.swagger_types.each_pair do |key, type|
103
+ if type =~ /^Array<(.*)>/i
104
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
105
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
106
+ else
107
+ #TODO show warning in debug mode
108
+ end
109
+ elsif !attributes[self.class.attribute_map[key]].nil?
110
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
111
+ else
112
+ # data not found in attributes(hash), not an issue as the data can be optional
113
+ end
114
+ end
115
+
116
+ self
117
+ end
118
+
119
+ def _deserialize(type, value)
120
+ case type.to_sym
121
+ when :DateTime
122
+ DateTime.parse(value)
123
+ when :Date
124
+ Date.parse(value)
125
+ when :String
126
+ value.to_s
127
+ when :Integer
128
+ value.to_i
129
+ when :Float
130
+ value.to_f
131
+ when :BOOLEAN
132
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
133
+ true
134
+ else
135
+ false
136
+ end
137
+ when /\AArray<(?<inner_type>.+)>\z/
138
+ inner_type = Regexp.last_match[:inner_type]
139
+ value.map { |v| _deserialize(inner_type, v) }
140
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
141
+ k_type = Regexp.last_match[:k_type]
142
+ v_type = Regexp.last_match[:v_type]
143
+ {}.tap do |hash|
144
+ value.each do |k, v|
145
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
146
+ end
147
+ end
148
+ else # model
149
+ _model = SquareConnect.const_get(type).new
150
+ _model.build_from_hash(value)
151
+ end
152
+ end
153
+
154
+ def to_s
155
+ to_hash.to_s
156
+ end
157
+
158
+ # to_body is an alias to to_body (backward compatibility))
159
+ def to_body
160
+ to_hash
161
+ end
162
+
163
+ # return the object in the form of hash
164
+ def to_hash
165
+ hash = {}
166
+ self.class.attribute_map.each_pair do |attr, param|
167
+ value = self.send(attr)
168
+ next if value.nil?
169
+ hash[param] = _to_hash(value)
170
+ end
171
+ hash
172
+ end
173
+
174
+ # Method to output non-array value in the form of hash
175
+ # For object, use to_hash. Otherwise, just return the value
176
+ def _to_hash(value)
177
+ if value.is_a?(Array)
178
+ value.compact.map{ |v| _to_hash(v) }
179
+ elsif value.is_a?(Hash)
180
+ {}.tap do |hash|
181
+ value.each { |k, v| hash[k] = _to_hash(v) }
182
+ end
183
+ elsif value.respond_to? :to_hash
184
+ value.to_hash
185
+ else
186
+ value
187
+ end
188
+ end
189
+
190
+ end
191
+ end