square_connect 2.8.0.215 → 2.9.0.220
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +20 -0
- data/README.md +11 -1
- data/docs/Customer.md +1 -0
- data/docs/CustomerCreationSource.md +30 -0
- data/docs/CustomerCreationSourceFilter.md +13 -0
- data/docs/CustomerFilter.md +14 -0
- data/docs/CustomerInclusionExclusion.md +13 -0
- data/docs/CustomerQuery.md +13 -0
- data/docs/CustomerSort.md +13 -0
- data/docs/CustomersApi.md +57 -4
- data/docs/ErrorCode.md +2 -0
- data/docs/ListCustomersRequest.md +2 -2
- data/docs/OrderLineItem.md +1 -1
- data/docs/OrderLineItemDiscountScope.md +1 -1
- data/docs/SearchCustomersRequest.md +14 -0
- data/docs/SearchCustomersResponse.md +14 -0
- data/docs/TimeRange.md +13 -0
- data/docs/V1AdjustInventoryRequest.md +1 -1
- data/docs/V1Payment.md +1 -1
- data/docs/VoidTransactionResponse.md +1 -1
- data/lib/square_connect.rb +9 -0
- data/lib/square_connect/api/customers_api.rb +57 -4
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/customer.rb +47 -4
- data/lib/square_connect/models/customer_creation_source.rb +36 -0
- data/lib/square_connect/models/customer_creation_source_filter.rb +231 -0
- data/lib/square_connect/models/customer_filter.rb +206 -0
- data/lib/square_connect/models/customer_inclusion_exclusion.rb +19 -0
- data/lib/square_connect/models/customer_query.rb +196 -0
- data/lib/square_connect/models/customer_sort.rb +241 -0
- data/lib/square_connect/models/error.rb +2 -2
- data/lib/square_connect/models/error_code.rb +2 -0
- data/lib/square_connect/models/list_customers_request.rb +2 -2
- data/lib/square_connect/models/order_line_item.rb +1 -1
- data/lib/square_connect/models/search_customers_request.rb +206 -0
- data/lib/square_connect/models/search_customers_response.rb +210 -0
- data/lib/square_connect/models/time_range.rb +196 -0
- data/lib/square_connect/models/v1_adjust_inventory_request.rb +34 -1
- data/lib/square_connect/models/void_transaction_response.rb +1 -1
- data/lib/square_connect/version.rb +1 -1
- data/spec/models/customer_creation_source_filter_spec.rb +53 -0
- data/spec/models/customer_creation_source_spec.rb +33 -0
- data/spec/models/customer_filter_spec.rb +51 -0
- data/spec/models/customer_inclusion_exclusion_spec.rb +33 -0
- data/spec/models/customer_query_spec.rb +45 -0
- data/spec/models/customer_sort_spec.rb +53 -0
- data/spec/models/search_customers_request_spec.rb +51 -0
- data/spec/models/search_customers_response_spec.rb +51 -0
- data/spec/models/time_range_spec.rb +45 -0
- metadata +39 -3
@@ -0,0 +1,196 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'date'
|
11
|
+
|
12
|
+
module SquareConnect
|
13
|
+
# Represents a generic time range. The start and end values are represented in RFC-3339 format. Time ranges are customized to be inclusive or exclusive based on the needs of a particular endpoint. Refer to the relevent endpoint-specific documentation to determine how time ranges are handled.
|
14
|
+
class TimeRange
|
15
|
+
# A datetime value in RFC-3339 format indicating when the time range starts.
|
16
|
+
attr_accessor :start_at
|
17
|
+
|
18
|
+
# A datetime value in RFC-3339 format indicating when the time range ends.
|
19
|
+
attr_accessor :end_at
|
20
|
+
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'start_at' => :'start_at',
|
26
|
+
:'end_at' => :'end_at'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Attribute type mapping.
|
31
|
+
def self.swagger_types
|
32
|
+
{
|
33
|
+
:'start_at' => :'String',
|
34
|
+
:'end_at' => :'String'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Initializes the object
|
39
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
40
|
+
def initialize(attributes = {})
|
41
|
+
return unless attributes.is_a?(Hash)
|
42
|
+
|
43
|
+
# convert string to symbol for hash key
|
44
|
+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
|
45
|
+
|
46
|
+
if attributes.has_key?(:'start_at')
|
47
|
+
self.start_at = attributes[:'start_at']
|
48
|
+
end
|
49
|
+
|
50
|
+
if attributes.has_key?(:'end_at')
|
51
|
+
self.end_at = attributes[:'end_at']
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
|
56
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
57
|
+
# @return Array for valid properies with the reasons
|
58
|
+
def list_invalid_properties
|
59
|
+
invalid_properties = Array.new
|
60
|
+
return invalid_properties
|
61
|
+
end
|
62
|
+
|
63
|
+
# Check to see if the all the properties in the model are valid
|
64
|
+
# @return true if the model is valid
|
65
|
+
def valid?
|
66
|
+
return true
|
67
|
+
end
|
68
|
+
|
69
|
+
# Checks equality by comparing each attribute.
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def ==(o)
|
72
|
+
return true if self.equal?(o)
|
73
|
+
self.class == o.class &&
|
74
|
+
start_at == o.start_at &&
|
75
|
+
end_at == o.end_at
|
76
|
+
end
|
77
|
+
|
78
|
+
# @see the `==` method
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def eql?(o)
|
81
|
+
self == o
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculates hash code according to all attributes.
|
85
|
+
# @return [Fixnum] Hash code
|
86
|
+
def hash
|
87
|
+
[start_at, end_at].hash
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def build_from_hash(attributes)
|
94
|
+
return nil unless attributes.is_a?(Hash)
|
95
|
+
self.class.swagger_types.each_pair do |key, type|
|
96
|
+
if type =~ /\AArray<(.*)>/i
|
97
|
+
# check to ensure the input is an array given that the the attribute
|
98
|
+
# is documented as an array but the input is not
|
99
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
100
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
|
101
|
+
end
|
102
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
103
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
104
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
105
|
+
end
|
106
|
+
|
107
|
+
self
|
108
|
+
end
|
109
|
+
|
110
|
+
# Deserializes the data based on type
|
111
|
+
# @param string type Data type
|
112
|
+
# @param string value Value to be deserialized
|
113
|
+
# @return [Object] Deserialized data
|
114
|
+
def _deserialize(type, value)
|
115
|
+
case type.to_sym
|
116
|
+
when :DateTime
|
117
|
+
DateTime.parse(value)
|
118
|
+
when :Date
|
119
|
+
Date.parse(value)
|
120
|
+
when :String
|
121
|
+
value.to_s
|
122
|
+
when :Integer
|
123
|
+
value.to_i
|
124
|
+
when :Float
|
125
|
+
value.to_f
|
126
|
+
when :BOOLEAN
|
127
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
128
|
+
true
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
when :Object
|
133
|
+
# generic object (usually a Hash), return directly
|
134
|
+
value
|
135
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
136
|
+
inner_type = Regexp.last_match[:inner_type]
|
137
|
+
value.map { |v| _deserialize(inner_type, v) }
|
138
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
139
|
+
k_type = Regexp.last_match[:k_type]
|
140
|
+
v_type = Regexp.last_match[:v_type]
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each do |k, v|
|
143
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
else # model
|
147
|
+
temp_model = SquareConnect.const_get(type).new
|
148
|
+
temp_model.build_from_hash(value)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns the string representation of the object
|
153
|
+
# @return [String] String presentation of the object
|
154
|
+
def to_s
|
155
|
+
to_hash.to_s
|
156
|
+
end
|
157
|
+
|
158
|
+
# to_body is an alias to to_hash (backward compatibility)
|
159
|
+
# @return [Hash] Returns the object in the form of hash
|
160
|
+
def to_body
|
161
|
+
to_hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Returns the object in the form of hash
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
166
|
+
def to_hash
|
167
|
+
hash = {}
|
168
|
+
self.class.attribute_map.each_pair do |attr, param|
|
169
|
+
value = self.send(attr)
|
170
|
+
next if value.nil?
|
171
|
+
hash[param] = _to_hash(value)
|
172
|
+
end
|
173
|
+
hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Outputs non-array value in the form of hash
|
177
|
+
# For object, use to_hash. Otherwise, just return the value
|
178
|
+
# @param [Object] value Any valid value
|
179
|
+
# @return [Hash] Returns the value in the form of hash
|
180
|
+
def _to_hash(value)
|
181
|
+
if value.is_a?(Array)
|
182
|
+
value.compact.map{ |v| _to_hash(v) }
|
183
|
+
elsif value.is_a?(Hash)
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
186
|
+
end
|
187
|
+
elsif value.respond_to? :to_hash
|
188
|
+
value.to_hash
|
189
|
+
else
|
190
|
+
value
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
end
|
@@ -21,6 +21,27 @@ module SquareConnect
|
|
21
21
|
# A note about the inventory adjustment.
|
22
22
|
attr_accessor :memo
|
23
23
|
|
24
|
+
class EnumAttributeValidator
|
25
|
+
attr_reader :datatype
|
26
|
+
attr_reader :allowable_values
|
27
|
+
|
28
|
+
def initialize(datatype, allowable_values)
|
29
|
+
@allowable_values = allowable_values.map do |value|
|
30
|
+
case datatype.to_s
|
31
|
+
when /Integer/i
|
32
|
+
value.to_i
|
33
|
+
when /Float/i
|
34
|
+
value.to_f
|
35
|
+
else
|
36
|
+
value
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def valid?(value)
|
42
|
+
!value || allowable_values.include?(value)
|
43
|
+
end
|
44
|
+
end
|
24
45
|
|
25
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
47
|
def self.attribute_map
|
@@ -35,7 +56,7 @@ module SquareConnect
|
|
35
56
|
def self.swagger_types
|
36
57
|
{
|
37
58
|
:'quantity_delta' => :'Float',
|
38
|
-
:'adjustment_type' => :'
|
59
|
+
:'adjustment_type' => :'String',
|
39
60
|
:'memo' => :'String'
|
40
61
|
}
|
41
62
|
end
|
@@ -72,9 +93,21 @@ module SquareConnect
|
|
72
93
|
# Check to see if the all the properties in the model are valid
|
73
94
|
# @return true if the model is valid
|
74
95
|
def valid?
|
96
|
+
adjustment_type_validator = EnumAttributeValidator.new('String', ["SALE", "RECEIVE_STOCK", "MANUAL_ADJUST"])
|
97
|
+
return false unless adjustment_type_validator.valid?(@adjustment_type)
|
75
98
|
return true
|
76
99
|
end
|
77
100
|
|
101
|
+
# Custom attribute writer method checking allowed values (enum).
|
102
|
+
# @param [Object] adjustment_type Object to be assigned
|
103
|
+
def adjustment_type=(adjustment_type)
|
104
|
+
validator = EnumAttributeValidator.new('String', ["SALE", "RECEIVE_STOCK", "MANUAL_ADJUST"])
|
105
|
+
unless validator.valid?(adjustment_type)
|
106
|
+
fail ArgumentError, "invalid value for 'adjustment_type', must be one of #{validator.allowable_values}."
|
107
|
+
end
|
108
|
+
@adjustment_type = adjustment_type
|
109
|
+
end
|
110
|
+
|
78
111
|
# Checks equality by comparing each attribute.
|
79
112
|
# @param [Object] Object to be compared
|
80
113
|
def ==(o)
|
@@ -10,7 +10,7 @@ Generated by: https://github.com/swagger-api/swagger-codegen.git
|
|
10
10
|
require 'date'
|
11
11
|
|
12
12
|
module SquareConnect
|
13
|
-
# Defines the fields that are included in the response body of a request to the [
|
13
|
+
# Defines the fields that are included in the response body of a request to the [VoidTransaction](#endpoint-voidtransaction) endpoint.
|
14
14
|
class VoidTransactionResponse
|
15
15
|
# Any errors that occurred during the request.
|
16
16
|
attr_accessor :errors
|
@@ -0,0 +1,53 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
require 'json'
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
# Unit tests for SquareConnect::CustomerCreationSourceFilter
|
15
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
16
|
+
# Please update as you see appropriate
|
17
|
+
describe 'CustomerCreationSourceFilter' do
|
18
|
+
before do
|
19
|
+
# run before each test
|
20
|
+
@instance = SquareConnect::CustomerCreationSourceFilter.new
|
21
|
+
end
|
22
|
+
|
23
|
+
after do
|
24
|
+
# run after each test
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'test an instance of CustomerCreationSourceFilter' do
|
28
|
+
it 'should create an instact of CustomerCreationSourceFilter' do
|
29
|
+
expect(@instance).to be_instance_of(SquareConnect::CustomerCreationSourceFilter)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
describe 'test attribute "values"' do
|
33
|
+
it 'should work' do
|
34
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
35
|
+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('Array<String>', ["OTHER", "APPOINTMENTS", "COUPON", "DELETION_RECOVERY", "DIRECTORY", "EGIFTING", "EMAIL_COLLECTION", "FEEDBACK", "IMPORT", "INVOICES", "LOYALTY", "MARKETING", "MERGE", "ONLINE_STORE", "INSTANT_PROFILE", "TERMINAL", "THIRD_PARTY", "THIRD_PARTY_IMPORT", "UNMERGE_RECOVERY"])
|
36
|
+
#validator.allowable_values.each do |value|
|
37
|
+
# expect { @instance.values = value }.not_to raise_error
|
38
|
+
#end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe 'test attribute "rule"' do
|
43
|
+
it 'should work' do
|
44
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
45
|
+
#validator = Petstore::EnumTest::EnumAttributeValidator.new('String', ["INCLUDE", "EXCLUDE"])
|
46
|
+
#validator.allowable_values.each do |value|
|
47
|
+
# expect { @instance.rule = value }.not_to raise_error
|
48
|
+
#end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
end
|
53
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
require 'json'
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
# Unit tests for SquareConnect::CustomerCreationSource
|
15
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
16
|
+
# Please update as you see appropriate
|
17
|
+
describe 'CustomerCreationSource' do
|
18
|
+
before do
|
19
|
+
# run before each test
|
20
|
+
@instance = SquareConnect::CustomerCreationSource.new
|
21
|
+
end
|
22
|
+
|
23
|
+
after do
|
24
|
+
# run after each test
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'test an instance of CustomerCreationSource' do
|
28
|
+
it 'should create an instact of CustomerCreationSource' do
|
29
|
+
expect(@instance).to be_instance_of(SquareConnect::CustomerCreationSource)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
@@ -0,0 +1,51 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
require 'json'
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
# Unit tests for SquareConnect::CustomerFilter
|
15
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
16
|
+
# Please update as you see appropriate
|
17
|
+
describe 'CustomerFilter' do
|
18
|
+
before do
|
19
|
+
# run before each test
|
20
|
+
@instance = SquareConnect::CustomerFilter.new
|
21
|
+
end
|
22
|
+
|
23
|
+
after do
|
24
|
+
# run after each test
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'test an instance of CustomerFilter' do
|
28
|
+
it 'should create an instact of CustomerFilter' do
|
29
|
+
expect(@instance).to be_instance_of(SquareConnect::CustomerFilter)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
describe 'test attribute "creation_source"' do
|
33
|
+
it 'should work' do
|
34
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
describe 'test attribute "created_at"' do
|
39
|
+
it 'should work' do
|
40
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
describe 'test attribute "updated_at"' do
|
45
|
+
it 'should work' do
|
46
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
51
|
+
|
@@ -0,0 +1,33 @@
|
|
1
|
+
=begin
|
2
|
+
#Square Connect API
|
3
|
+
|
4
|
+
OpenAPI spec version: 2.0
|
5
|
+
Contact: developers@squareup.com
|
6
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
7
|
+
|
8
|
+
=end
|
9
|
+
|
10
|
+
require 'spec_helper'
|
11
|
+
require 'json'
|
12
|
+
require 'date'
|
13
|
+
|
14
|
+
# Unit tests for SquareConnect::CustomerInclusionExclusion
|
15
|
+
# Automatically generated by swagger-codegen (github.com/swagger-api/swagger-codegen)
|
16
|
+
# Please update as you see appropriate
|
17
|
+
describe 'CustomerInclusionExclusion' do
|
18
|
+
before do
|
19
|
+
# run before each test
|
20
|
+
@instance = SquareConnect::CustomerInclusionExclusion.new
|
21
|
+
end
|
22
|
+
|
23
|
+
after do
|
24
|
+
# run after each test
|
25
|
+
end
|
26
|
+
|
27
|
+
describe 'test an instance of CustomerInclusionExclusion' do
|
28
|
+
it 'should create an instact of CustomerInclusionExclusion' do
|
29
|
+
expect(@instance).to be_instance_of(SquareConnect::CustomerInclusionExclusion)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|