square_connect 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES.md +5 -0
- data/CONTRIBUTING.md +5 -0
- data/LICENSE.txt +202 -0
- data/README.md +47 -0
- data/lib/square_connect.rb +88 -0
- data/lib/square_connect/api/customer_api.rb +354 -0
- data/lib/square_connect/api/customer_card_api.rb +163 -0
- data/lib/square_connect/api/location_api.rb +82 -0
- data/lib/square_connect/api/refund_api.rb +179 -0
- data/lib/square_connect/api/transaction_api.rb +387 -0
- data/lib/square_connect/api_client.rb +337 -0
- data/lib/square_connect/api_error.rb +31 -0
- data/lib/square_connect/configuration.rb +163 -0
- data/lib/square_connect/models/address.rb +288 -0
- data/lib/square_connect/models/capture_transaction_response.rb +160 -0
- data/lib/square_connect/models/card.rb +233 -0
- data/lib/square_connect/models/card_brand.rb +147 -0
- data/lib/square_connect/models/charge_request.rb +257 -0
- data/lib/square_connect/models/charge_response.rb +171 -0
- data/lib/square_connect/models/country.rb +147 -0
- data/lib/square_connect/models/create_customer_card_request.rb +180 -0
- data/lib/square_connect/models/create_customer_card_response.rb +171 -0
- data/lib/square_connect/models/create_customer_request.rb +246 -0
- data/lib/square_connect/models/create_customer_response.rb +171 -0
- data/lib/square_connect/models/create_refund_request.rb +191 -0
- data/lib/square_connect/models/create_refund_response.rb +171 -0
- data/lib/square_connect/models/currency.rb +147 -0
- data/lib/square_connect/models/customer.rb +292 -0
- data/lib/square_connect/models/delete_customer_card_response.rb +160 -0
- data/lib/square_connect/models/delete_customer_response.rb +160 -0
- data/lib/square_connect/models/error.rb +209 -0
- data/lib/square_connect/models/error_category.rb +147 -0
- data/lib/square_connect/models/error_code.rb +147 -0
- data/lib/square_connect/models/list_customers_request.rb +158 -0
- data/lib/square_connect/models/list_customers_response.rb +184 -0
- data/lib/square_connect/models/list_locations_response.rb +173 -0
- data/lib/square_connect/models/list_refunds_request.rb +200 -0
- data/lib/square_connect/models/list_refunds_response.rb +184 -0
- data/lib/square_connect/models/list_transactions_request.rb +200 -0
- data/lib/square_connect/models/list_transactions_response.rb +184 -0
- data/lib/square_connect/models/location.rb +204 -0
- data/lib/square_connect/models/location_capability.rb +147 -0
- data/lib/square_connect/models/money.rb +178 -0
- data/lib/square_connect/models/refund.rb +255 -0
- data/lib/square_connect/models/refund_status.rb +147 -0
- data/lib/square_connect/models/retrieve_customer_response.rb +171 -0
- data/lib/square_connect/models/retrieve_transaction_response.rb +171 -0
- data/lib/square_connect/models/sort_order.rb +147 -0
- data/lib/square_connect/models/tender.rb +277 -0
- data/lib/square_connect/models/tender_card_details.rb +198 -0
- data/lib/square_connect/models/tender_card_details_entry_method.rb +147 -0
- data/lib/square_connect/models/tender_card_details_status.rb +147 -0
- data/lib/square_connect/models/tender_cash_details.rb +169 -0
- data/lib/square_connect/models/tender_type.rb +147 -0
- data/lib/square_connect/models/transaction.rb +237 -0
- data/lib/square_connect/models/transaction_product.rb +147 -0
- data/lib/square_connect/models/update_customer_request.rb +246 -0
- data/lib/square_connect/models/update_customer_response.rb +171 -0
- data/lib/square_connect/models/void_transaction_response.rb +160 -0
- data/lib/square_connect/version.rb +13 -0
- data/square_connect.gemspec +32 -0
- metadata +286 -0
@@ -0,0 +1,198 @@
|
|
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
|
+
# Represents the details of a credit card tender.
|
15
|
+
class TenderCardDetails
|
16
|
+
# The credit card payment's current state (such as `CAPTURED`)
|
17
|
+
attr_accessor :status
|
18
|
+
|
19
|
+
# The credit card's non-confidential details.
|
20
|
+
attr_accessor :card
|
21
|
+
|
22
|
+
# The method used to read the card.
|
23
|
+
attr_accessor :entry_method
|
24
|
+
|
25
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
26
|
+
def self.attribute_map
|
27
|
+
{
|
28
|
+
|
29
|
+
:'status' => :'status',
|
30
|
+
|
31
|
+
:'card' => :'card',
|
32
|
+
|
33
|
+
:'entry_method' => :'entry_method'
|
34
|
+
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
:'status' => :'String',
|
42
|
+
:'card' => :'Card',
|
43
|
+
:'entry_method' => :'String'
|
44
|
+
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
def initialize(attributes = {})
|
49
|
+
return unless attributes.is_a?(Hash)
|
50
|
+
|
51
|
+
# convert string to symbol for hash key
|
52
|
+
attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
|
53
|
+
|
54
|
+
|
55
|
+
if attributes[:'status']
|
56
|
+
self.status = attributes[:'status']
|
57
|
+
end
|
58
|
+
|
59
|
+
if attributes[:'card']
|
60
|
+
self.card = attributes[:'card']
|
61
|
+
end
|
62
|
+
|
63
|
+
if attributes[:'entry_method']
|
64
|
+
self.entry_method = attributes[:'entry_method']
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
|
69
|
+
# Custom attribute writer method checking allowed values (enum).
|
70
|
+
def status=(status)
|
71
|
+
allowed_values = ["AUTHORIZED", "CAPTURED", "VOIDED", "FAILED"]
|
72
|
+
if status && !allowed_values.include?(status)
|
73
|
+
fail "invalid value for 'status', must be one of #{allowed_values}"
|
74
|
+
end
|
75
|
+
@status = status
|
76
|
+
end
|
77
|
+
|
78
|
+
# Custom attribute writer method checking allowed values (enum).
|
79
|
+
def entry_method=(entry_method)
|
80
|
+
allowed_values = ["SWIPED", "KEYED", "EMV", "ON_FILE", "CONTACTLESS"]
|
81
|
+
if entry_method && !allowed_values.include?(entry_method)
|
82
|
+
fail "invalid value for 'entry_method', must be one of #{allowed_values}"
|
83
|
+
end
|
84
|
+
@entry_method = entry_method
|
85
|
+
end
|
86
|
+
|
87
|
+
# Check equality by comparing each attribute.
|
88
|
+
def ==(o)
|
89
|
+
return true if self.equal?(o)
|
90
|
+
self.class == o.class &&
|
91
|
+
status == o.status &&
|
92
|
+
card == o.card &&
|
93
|
+
entry_method == o.entry_method
|
94
|
+
end
|
95
|
+
|
96
|
+
# @see the `==` method
|
97
|
+
def eql?(o)
|
98
|
+
self == o
|
99
|
+
end
|
100
|
+
|
101
|
+
# Calculate hash code according to all attributes.
|
102
|
+
def hash
|
103
|
+
[status, card, entry_method].hash
|
104
|
+
end
|
105
|
+
|
106
|
+
# build the object from hash
|
107
|
+
def build_from_hash(attributes)
|
108
|
+
return nil unless attributes.is_a?(Hash)
|
109
|
+
self.class.swagger_types.each_pair do |key, type|
|
110
|
+
if type =~ /^Array<(.*)>/i
|
111
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
112
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
113
|
+
else
|
114
|
+
#TODO show warning in debug mode
|
115
|
+
end
|
116
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
117
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
118
|
+
else
|
119
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
self
|
124
|
+
end
|
125
|
+
|
126
|
+
def _deserialize(type, value)
|
127
|
+
case type.to_sym
|
128
|
+
when :DateTime
|
129
|
+
DateTime.parse(value)
|
130
|
+
when :Date
|
131
|
+
Date.parse(value)
|
132
|
+
when :String
|
133
|
+
value.to_s
|
134
|
+
when :Integer
|
135
|
+
value.to_i
|
136
|
+
when :Float
|
137
|
+
value.to_f
|
138
|
+
when :BOOLEAN
|
139
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
140
|
+
true
|
141
|
+
else
|
142
|
+
false
|
143
|
+
end
|
144
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
145
|
+
inner_type = Regexp.last_match[:inner_type]
|
146
|
+
value.map { |v| _deserialize(inner_type, v) }
|
147
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
148
|
+
k_type = Regexp.last_match[:k_type]
|
149
|
+
v_type = Regexp.last_match[:v_type]
|
150
|
+
{}.tap do |hash|
|
151
|
+
value.each do |k, v|
|
152
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
153
|
+
end
|
154
|
+
end
|
155
|
+
else # model
|
156
|
+
_model = SquareConnect.const_get(type).new
|
157
|
+
_model.build_from_hash(value)
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
def to_s
|
162
|
+
to_hash.to_s
|
163
|
+
end
|
164
|
+
|
165
|
+
# to_body is an alias to to_body (backward compatibility))
|
166
|
+
def to_body
|
167
|
+
to_hash
|
168
|
+
end
|
169
|
+
|
170
|
+
# return the object in the form of hash
|
171
|
+
def to_hash
|
172
|
+
hash = {}
|
173
|
+
self.class.attribute_map.each_pair do |attr, param|
|
174
|
+
value = self.send(attr)
|
175
|
+
next if value.nil?
|
176
|
+
hash[param] = _to_hash(value)
|
177
|
+
end
|
178
|
+
hash
|
179
|
+
end
|
180
|
+
|
181
|
+
# Method to output non-array value in the form of hash
|
182
|
+
# For object, use to_hash. Otherwise, just return the value
|
183
|
+
def _to_hash(value)
|
184
|
+
if value.is_a?(Array)
|
185
|
+
value.compact.map{ |v| _to_hash(v) }
|
186
|
+
elsif value.is_a?(Hash)
|
187
|
+
{}.tap do |hash|
|
188
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
189
|
+
end
|
190
|
+
elsif value.respond_to? :to_hash
|
191
|
+
value.to_hash
|
192
|
+
else
|
193
|
+
value
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
end
|
198
|
+
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
|
+
# The method used to read the card
|
15
|
+
class TenderCardDetailsEntryMethod
|
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,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 TenderCardDetailsStatus
|
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
|