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,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 ErrorCategory
|
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 ErrorCode
|
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,158 @@
|
|
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 ListCustomersRequest
|
16
|
+
#
|
17
|
+
attr_accessor :cursor
|
18
|
+
|
19
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
20
|
+
def self.attribute_map
|
21
|
+
{
|
22
|
+
|
23
|
+
:'cursor' => :'cursor'
|
24
|
+
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Attribute type mapping.
|
29
|
+
def self.swagger_types
|
30
|
+
{
|
31
|
+
:'cursor' => :'String'
|
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[:'cursor']
|
44
|
+
self.cursor = attributes[:'cursor']
|
45
|
+
end
|
46
|
+
|
47
|
+
end
|
48
|
+
|
49
|
+
# Check equality by comparing each attribute.
|
50
|
+
def ==(o)
|
51
|
+
return true if self.equal?(o)
|
52
|
+
self.class == o.class &&
|
53
|
+
cursor == o.cursor
|
54
|
+
end
|
55
|
+
|
56
|
+
# @see the `==` method
|
57
|
+
def eql?(o)
|
58
|
+
self == o
|
59
|
+
end
|
60
|
+
|
61
|
+
# Calculate hash code according to all attributes.
|
62
|
+
def hash
|
63
|
+
[cursor].hash
|
64
|
+
end
|
65
|
+
|
66
|
+
# build the object from hash
|
67
|
+
def build_from_hash(attributes)
|
68
|
+
return nil unless attributes.is_a?(Hash)
|
69
|
+
self.class.swagger_types.each_pair do |key, type|
|
70
|
+
if type =~ /^Array<(.*)>/i
|
71
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
72
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
73
|
+
else
|
74
|
+
#TODO show warning in debug mode
|
75
|
+
end
|
76
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
77
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
78
|
+
else
|
79
|
+
# data not found in attributes(hash), not an issue as the data can be optional
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
self
|
84
|
+
end
|
85
|
+
|
86
|
+
def _deserialize(type, value)
|
87
|
+
case type.to_sym
|
88
|
+
when :DateTime
|
89
|
+
DateTime.parse(value)
|
90
|
+
when :Date
|
91
|
+
Date.parse(value)
|
92
|
+
when :String
|
93
|
+
value.to_s
|
94
|
+
when :Integer
|
95
|
+
value.to_i
|
96
|
+
when :Float
|
97
|
+
value.to_f
|
98
|
+
when :BOOLEAN
|
99
|
+
if value.to_s =~ /^(true|t|yes|y|1)$/i
|
100
|
+
true
|
101
|
+
else
|
102
|
+
false
|
103
|
+
end
|
104
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
105
|
+
inner_type = Regexp.last_match[:inner_type]
|
106
|
+
value.map { |v| _deserialize(inner_type, v) }
|
107
|
+
when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
|
108
|
+
k_type = Regexp.last_match[:k_type]
|
109
|
+
v_type = Regexp.last_match[:v_type]
|
110
|
+
{}.tap do |hash|
|
111
|
+
value.each do |k, v|
|
112
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
else # model
|
116
|
+
_model = SquareConnect.const_get(type).new
|
117
|
+
_model.build_from_hash(value)
|
118
|
+
end
|
119
|
+
end
|
120
|
+
|
121
|
+
def to_s
|
122
|
+
to_hash.to_s
|
123
|
+
end
|
124
|
+
|
125
|
+
# to_body is an alias to to_body (backward compatibility))
|
126
|
+
def to_body
|
127
|
+
to_hash
|
128
|
+
end
|
129
|
+
|
130
|
+
# return the object in the form of hash
|
131
|
+
def to_hash
|
132
|
+
hash = {}
|
133
|
+
self.class.attribute_map.each_pair do |attr, param|
|
134
|
+
value = self.send(attr)
|
135
|
+
next if value.nil?
|
136
|
+
hash[param] = _to_hash(value)
|
137
|
+
end
|
138
|
+
hash
|
139
|
+
end
|
140
|
+
|
141
|
+
# Method to output non-array value in the form of hash
|
142
|
+
# For object, use to_hash. Otherwise, just return the value
|
143
|
+
def _to_hash(value)
|
144
|
+
if value.is_a?(Array)
|
145
|
+
value.compact.map{ |v| _to_hash(v) }
|
146
|
+
elsif value.is_a?(Hash)
|
147
|
+
{}.tap do |hash|
|
148
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
149
|
+
end
|
150
|
+
elsif value.respond_to? :to_hash
|
151
|
+
value.to_hash
|
152
|
+
else
|
153
|
+
value
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
end
|
158
|
+
end
|