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,160 @@
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 **DeleteCustomerCard** endpoint.
15
+ class DeleteCustomerCardResponse
16
+ #
17
+ attr_accessor :errors
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+
23
+ :'errors' => :'errors'
24
+
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'errors' => :'Array<Error>'
32
+
33
+ }
34
+ end
35
+
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
41
+
42
+
43
+ if attributes[:'errors']
44
+ if (value = attributes[:'errors']).is_a?(Array)
45
+ self.errors = value
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ # Check equality by comparing each attribute.
52
+ def ==(o)
53
+ return true if self.equal?(o)
54
+ self.class == o.class &&
55
+ errors == o.errors
56
+ end
57
+
58
+ # @see the `==` method
59
+ def eql?(o)
60
+ self == o
61
+ end
62
+
63
+ # Calculate hash code according to all attributes.
64
+ def hash
65
+ [errors].hash
66
+ end
67
+
68
+ # build the object from hash
69
+ def build_from_hash(attributes)
70
+ return nil unless attributes.is_a?(Hash)
71
+ self.class.swagger_types.each_pair do |key, type|
72
+ if type =~ /^Array<(.*)>/i
73
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
74
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
75
+ else
76
+ #TODO show warning in debug mode
77
+ end
78
+ elsif !attributes[self.class.attribute_map[key]].nil?
79
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
80
+ else
81
+ # data not found in attributes(hash), not an issue as the data can be optional
82
+ end
83
+ end
84
+
85
+ self
86
+ end
87
+
88
+ def _deserialize(type, value)
89
+ case type.to_sym
90
+ when :DateTime
91
+ DateTime.parse(value)
92
+ when :Date
93
+ Date.parse(value)
94
+ when :String
95
+ value.to_s
96
+ when :Integer
97
+ value.to_i
98
+ when :Float
99
+ value.to_f
100
+ when :BOOLEAN
101
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
102
+ true
103
+ else
104
+ false
105
+ end
106
+ when /\AArray<(?<inner_type>.+)>\z/
107
+ inner_type = Regexp.last_match[:inner_type]
108
+ value.map { |v| _deserialize(inner_type, v) }
109
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
110
+ k_type = Regexp.last_match[:k_type]
111
+ v_type = Regexp.last_match[:v_type]
112
+ {}.tap do |hash|
113
+ value.each do |k, v|
114
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
115
+ end
116
+ end
117
+ else # model
118
+ _model = SquareConnect.const_get(type).new
119
+ _model.build_from_hash(value)
120
+ end
121
+ end
122
+
123
+ def to_s
124
+ to_hash.to_s
125
+ end
126
+
127
+ # to_body is an alias to to_body (backward compatibility))
128
+ def to_body
129
+ to_hash
130
+ end
131
+
132
+ # return the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = self.send(attr)
137
+ next if value.nil?
138
+ hash[param] = _to_hash(value)
139
+ end
140
+ hash
141
+ end
142
+
143
+ # Method to output non-array value in the form of hash
144
+ # For object, use to_hash. Otherwise, just return the value
145
+ def _to_hash(value)
146
+ if value.is_a?(Array)
147
+ value.compact.map{ |v| _to_hash(v) }
148
+ elsif value.is_a?(Hash)
149
+ {}.tap do |hash|
150
+ value.each { |k, v| hash[k] = _to_hash(v) }
151
+ end
152
+ elsif value.respond_to? :to_hash
153
+ value.to_hash
154
+ else
155
+ value
156
+ end
157
+ end
158
+
159
+ end
160
+ end
@@ -0,0 +1,160 @@
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 **DeleteCustomer** endpoint.
15
+ class DeleteCustomerResponse
16
+ #
17
+ attr_accessor :errors
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+
23
+ :'errors' => :'errors'
24
+
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'errors' => :'Array<Error>'
32
+
33
+ }
34
+ end
35
+
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
41
+
42
+
43
+ if attributes[:'errors']
44
+ if (value = attributes[:'errors']).is_a?(Array)
45
+ self.errors = value
46
+ end
47
+ end
48
+
49
+ end
50
+
51
+ # Check equality by comparing each attribute.
52
+ def ==(o)
53
+ return true if self.equal?(o)
54
+ self.class == o.class &&
55
+ errors == o.errors
56
+ end
57
+
58
+ # @see the `==` method
59
+ def eql?(o)
60
+ self == o
61
+ end
62
+
63
+ # Calculate hash code according to all attributes.
64
+ def hash
65
+ [errors].hash
66
+ end
67
+
68
+ # build the object from hash
69
+ def build_from_hash(attributes)
70
+ return nil unless attributes.is_a?(Hash)
71
+ self.class.swagger_types.each_pair do |key, type|
72
+ if type =~ /^Array<(.*)>/i
73
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
74
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
75
+ else
76
+ #TODO show warning in debug mode
77
+ end
78
+ elsif !attributes[self.class.attribute_map[key]].nil?
79
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
80
+ else
81
+ # data not found in attributes(hash), not an issue as the data can be optional
82
+ end
83
+ end
84
+
85
+ self
86
+ end
87
+
88
+ def _deserialize(type, value)
89
+ case type.to_sym
90
+ when :DateTime
91
+ DateTime.parse(value)
92
+ when :Date
93
+ Date.parse(value)
94
+ when :String
95
+ value.to_s
96
+ when :Integer
97
+ value.to_i
98
+ when :Float
99
+ value.to_f
100
+ when :BOOLEAN
101
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
102
+ true
103
+ else
104
+ false
105
+ end
106
+ when /\AArray<(?<inner_type>.+)>\z/
107
+ inner_type = Regexp.last_match[:inner_type]
108
+ value.map { |v| _deserialize(inner_type, v) }
109
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
110
+ k_type = Regexp.last_match[:k_type]
111
+ v_type = Regexp.last_match[:v_type]
112
+ {}.tap do |hash|
113
+ value.each do |k, v|
114
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
115
+ end
116
+ end
117
+ else # model
118
+ _model = SquareConnect.const_get(type).new
119
+ _model.build_from_hash(value)
120
+ end
121
+ end
122
+
123
+ def to_s
124
+ to_hash.to_s
125
+ end
126
+
127
+ # to_body is an alias to to_body (backward compatibility))
128
+ def to_body
129
+ to_hash
130
+ end
131
+
132
+ # return the object in the form of hash
133
+ def to_hash
134
+ hash = {}
135
+ self.class.attribute_map.each_pair do |attr, param|
136
+ value = self.send(attr)
137
+ next if value.nil?
138
+ hash[param] = _to_hash(value)
139
+ end
140
+ hash
141
+ end
142
+
143
+ # Method to output non-array value in the form of hash
144
+ # For object, use to_hash. Otherwise, just return the value
145
+ def _to_hash(value)
146
+ if value.is_a?(Array)
147
+ value.compact.map{ |v| _to_hash(v) }
148
+ elsif value.is_a?(Hash)
149
+ {}.tap do |hash|
150
+ value.each { |k, v| hash[k] = _to_hash(v) }
151
+ end
152
+ elsif value.respond_to? :to_hash
153
+ value.to_hash
154
+ else
155
+ value
156
+ end
157
+ end
158
+
159
+ end
160
+ end
@@ -0,0 +1,209 @@
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 Error
16
+ #
17
+ attr_accessor :category
18
+
19
+ #
20
+ attr_accessor :code
21
+
22
+ #
23
+ attr_accessor :detail
24
+
25
+ #
26
+ attr_accessor :field
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+
32
+ :'category' => :'category',
33
+
34
+ :'code' => :'code',
35
+
36
+ :'detail' => :'detail',
37
+
38
+ :'field' => :'field'
39
+
40
+ }
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.swagger_types
45
+ {
46
+ :'category' => :'String',
47
+ :'code' => :'String',
48
+ :'detail' => :'String',
49
+ :'field' => :'String'
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[:'category']
62
+ self.category = attributes[:'category']
63
+ end
64
+
65
+ if attributes[:'code']
66
+ self.code = attributes[:'code']
67
+ end
68
+
69
+ if attributes[:'detail']
70
+ self.detail = attributes[:'detail']
71
+ end
72
+
73
+ if attributes[:'field']
74
+ self.field = attributes[:'field']
75
+ end
76
+
77
+ end
78
+
79
+ # Custom attribute writer method checking allowed values (enum).
80
+ def category=(category)
81
+ allowed_values = ["API_ERROR", "AUTHENTICATION_ERROR", "INVALID_REQUEST_ERROR", "RATE_LIMIT_ERROR", "PAYMENT_METHOD_ERROR", "REFUND_ERROR"]
82
+ if category && !allowed_values.include?(category)
83
+ fail "invalid value for 'category', must be one of #{allowed_values}"
84
+ end
85
+ @category = category
86
+ end
87
+
88
+ # Custom attribute writer method checking allowed values (enum).
89
+ def code=(code)
90
+ allowed_values = ["INTERNAL_SERVER_ERROR", "UNAUTHORIZED", "ACCESS_TOKEN_EXPIRED", "ACCESS_TOKEN_REVOKED", "FORBIDDEN", "INSUFFICIENT_SCOPES", "APPLICATION_DISABLED", "V1_APPLICATION", "V1_ACCESS_TOKEN", "CARD_PROCESSING_NOT_ENABLED", "BAD_REQUEST", "MISSING_REQUIRED_PARAMETER", "INCORRECT_TYPE", "INVALID_TIME", "INVALID_TIME_RANGE", "INVALID_VALUE", "INVALID_CURSOR", "UNKNOWN_QUERY_PARAMETER", "CONFLICTING_PARAMETERS", "EXPECTED_JSON_BODY", "INVALID_SORT_ORDER", "VALUE_TOO_LONG", "VALUE_TOO_LOW", "EXPECTED_BOOLEAN", "EXPECTED_INTEGER", "EXPECTED_FLOAT", "EXPECTED_STRING", "EXPECTED_OBJECT", "EXPECTED_ARRAY", "INVALID_ARRAY_VALUE", "INVALID_ENUM_VALUE", "INVALID_CONTENT_TYPE", "INVALID_FORM_VALUE", "ONE_INSTRUMENT_EXPECTED", "NO_FIELDS_SET", "CARD_DECLINED", "CARD_EXPIRED", "VERIFY_CVV_FAILURE", "VERIFY_AVS_FAILURE", "INVALID_EXPIRATION", "INVALID_EXPIRATION_YEAR", "INVALID_EXPIRATION_DATE", "INVALID_CARD", "DELAYED_TRANSACTION_EXPIRED", "DELAYED_TRANSACTION_CANCELED", "DELAYED_TRANSACTION_CAPTURED", "DELAYED_TRANSACTION_FAILED", "CARD_TOKEN_EXPIRED", "CARD_TOKEN_USED", "AMOUNT_TOO_HIGH", "UNSUPPORTED_INSTRUMENT_TYPE", "REFUND_AMOUNT_INVALID", "REFUND_ALREADY_PENDING", "PAYMENT_NOT_REFUNDABLE", "INVALID_CARD_DATA", "NOT_FOUND", "REQUEST_TIMEOUT", "REQUEST_ENTITY_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE", "RATE_LIMITED", "NOT_IMPLEMENTED", "SERVICE_UNAVAILABLE"]
91
+ if code && !allowed_values.include?(code)
92
+ fail "invalid value for 'code', must be one of #{allowed_values}"
93
+ end
94
+ @code = code
95
+ end
96
+
97
+ # Check equality by comparing each attribute.
98
+ def ==(o)
99
+ return true if self.equal?(o)
100
+ self.class == o.class &&
101
+ category == o.category &&
102
+ code == o.code &&
103
+ detail == o.detail &&
104
+ field == o.field
105
+ end
106
+
107
+ # @see the `==` method
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculate hash code according to all attributes.
113
+ def hash
114
+ [category, code, detail, field].hash
115
+ end
116
+
117
+ # build the object from hash
118
+ def build_from_hash(attributes)
119
+ return nil unless attributes.is_a?(Hash)
120
+ self.class.swagger_types.each_pair do |key, type|
121
+ if type =~ /^Array<(.*)>/i
122
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
123
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
124
+ else
125
+ #TODO show warning in debug mode
126
+ end
127
+ elsif !attributes[self.class.attribute_map[key]].nil?
128
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
129
+ else
130
+ # data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+ end
133
+
134
+ self
135
+ end
136
+
137
+ def _deserialize(type, value)
138
+ case type.to_sym
139
+ when :DateTime
140
+ DateTime.parse(value)
141
+ when :Date
142
+ Date.parse(value)
143
+ when :String
144
+ value.to_s
145
+ when :Integer
146
+ value.to_i
147
+ when :Float
148
+ value.to_f
149
+ when :BOOLEAN
150
+ if value.to_s =~ /^(true|t|yes|y|1)$/i
151
+ true
152
+ else
153
+ false
154
+ end
155
+ when /\AArray<(?<inner_type>.+)>\z/
156
+ inner_type = Regexp.last_match[:inner_type]
157
+ value.map { |v| _deserialize(inner_type, v) }
158
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
159
+ k_type = Regexp.last_match[:k_type]
160
+ v_type = Regexp.last_match[:v_type]
161
+ {}.tap do |hash|
162
+ value.each do |k, v|
163
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
164
+ end
165
+ end
166
+ else # model
167
+ _model = SquareConnect.const_get(type).new
168
+ _model.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ def to_s
173
+ to_hash.to_s
174
+ end
175
+
176
+ # to_body is an alias to to_body (backward compatibility))
177
+ def to_body
178
+ to_hash
179
+ end
180
+
181
+ # return the object in the form of hash
182
+ def to_hash
183
+ hash = {}
184
+ self.class.attribute_map.each_pair do |attr, param|
185
+ value = self.send(attr)
186
+ next if value.nil?
187
+ hash[param] = _to_hash(value)
188
+ end
189
+ hash
190
+ end
191
+
192
+ # Method to output non-array value in the form of hash
193
+ # For object, use to_hash. Otherwise, just return the value
194
+ def _to_hash(value)
195
+ if value.is_a?(Array)
196
+ value.compact.map{ |v| _to_hash(v) }
197
+ elsif value.is_a?(Hash)
198
+ {}.tap do |hash|
199
+ value.each { |k, v| hash[k] = _to_hash(v) }
200
+ end
201
+ elsif value.respond_to? :to_hash
202
+ value.to_hash
203
+ else
204
+ value
205
+ end
206
+ end
207
+
208
+ end
209
+ end