square_connect 2.20190612.1.314 → 2.20190710.0.321
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGES.md +4 -0
- data/README.md +1 -2
- data/docs/CatalogItem.md +0 -1
- data/docs/CatalogItemVariation.md +0 -1
- data/docs/CatalogObject.md +3 -0
- data/docs/CatalogPricingRule.md +0 -3
- data/docs/InventoryAdjustment.md +1 -1
- data/docs/InventoryCount.md +1 -1
- data/docs/InventoryPhysicalCount.md +1 -1
- data/docs/InventoryTransfer.md +1 -1
- data/docs/TransactionsApi.md +2 -2
- data/lib/square_connect.rb +0 -1
- data/lib/square_connect/api/customers_api.rb +0 -6
- data/lib/square_connect/api/employees_api.rb +0 -3
- data/lib/square_connect/api/reporting_api.rb +0 -6
- data/lib/square_connect/api/transactions_api.rb +4 -10
- data/lib/square_connect/api/v1_employees_api.rb +0 -15
- data/lib/square_connect/api/v1_transactions_api.rb +0 -15
- data/lib/square_connect/api_client.rb +1 -1
- data/lib/square_connect/models/address.rb +0 -33
- data/lib/square_connect/models/batch_retrieve_inventory_changes_request.rb +0 -21
- data/lib/square_connect/models/business_hours_period.rb +0 -33
- data/lib/square_connect/models/card.rb +0 -33
- data/lib/square_connect/models/catalog_discount.rb +0 -33
- data/lib/square_connect/models/catalog_item.rb +1 -44
- data/lib/square_connect/models/catalog_item_variation.rb +1 -56
- data/lib/square_connect/models/catalog_modifier_list.rb +0 -33
- data/lib/square_connect/models/catalog_object.rb +31 -34
- data/lib/square_connect/models/catalog_pricing_rule.rb +1 -64
- data/lib/square_connect/models/catalog_query_sorted_attribute.rb +0 -33
- data/lib/square_connect/models/catalog_tax.rb +0 -45
- data/lib/square_connect/models/create_order_request_tax.rb +0 -33
- data/lib/square_connect/models/customer.rb +0 -33
- data/lib/square_connect/models/customer_creation_source_filter.rb +0 -33
- data/lib/square_connect/models/customer_sort.rb +0 -45
- data/lib/square_connect/models/employee.rb +0 -33
- data/lib/square_connect/models/error.rb +0 -45
- data/lib/square_connect/models/inventory_adjustment.rb +1 -46
- data/lib/square_connect/models/inventory_change.rb +0 -33
- data/lib/square_connect/models/inventory_count.rb +1 -34
- data/lib/square_connect/models/inventory_physical_count.rb +1 -34
- data/lib/square_connect/models/inventory_transfer.rb +1 -34
- data/lib/square_connect/models/item_variation_location_overrides.rb +0 -45
- data/lib/square_connect/models/list_additional_recipient_receivable_refunds_request.rb +0 -33
- data/lib/square_connect/models/list_additional_recipient_receivables_request.rb +0 -33
- data/lib/square_connect/models/list_customers_request.rb +0 -45
- data/lib/square_connect/models/list_employees_request.rb +0 -33
- data/lib/square_connect/models/list_refunds_request.rb +0 -33
- data/lib/square_connect/models/list_transactions_request.rb +0 -33
- data/lib/square_connect/models/location.rb +0 -69
- data/lib/square_connect/models/measurement_unit.rb +0 -81
- data/lib/square_connect/models/money.rb +0 -33
- data/lib/square_connect/models/order.rb +0 -33
- data/lib/square_connect/models/order_fulfillment.rb +0 -45
- data/lib/square_connect/models/order_fulfillment_pickup_details.rb +0 -33
- data/lib/square_connect/models/order_line_item_discount.rb +0 -45
- data/lib/square_connect/models/order_line_item_tax.rb +0 -45
- data/lib/square_connect/models/order_return_discount.rb +0 -45
- data/lib/square_connect/models/order_return_service_charge.rb +0 -33
- data/lib/square_connect/models/order_return_tax.rb +0 -45
- data/lib/square_connect/models/order_service_charge.rb +0 -33
- data/lib/square_connect/models/refund.rb +0 -33
- data/lib/square_connect/models/register_domain_response.rb +0 -33
- data/lib/square_connect/models/search_catalog_objects_request.rb +0 -21
- data/lib/square_connect/models/search_orders_fulfillment_filter.rb +0 -21
- data/lib/square_connect/models/search_orders_sort.rb +0 -45
- data/lib/square_connect/models/search_orders_state_filter.rb +0 -21
- data/lib/square_connect/models/shift.rb +0 -33
- data/lib/square_connect/models/shift_filter.rb +0 -33
- data/lib/square_connect/models/shift_sort.rb +0 -45
- data/lib/square_connect/models/shift_workday.rb +0 -33
- data/lib/square_connect/models/source_application.rb +0 -33
- data/lib/square_connect/models/tender.rb +0 -33
- data/lib/square_connect/models/tender_card_details.rb +0 -45
- data/lib/square_connect/models/transaction.rb +0 -33
- data/lib/square_connect/models/v1_adjust_inventory_request.rb +0 -33
- data/lib/square_connect/models/v1_bank_account.rb +0 -33
- data/lib/square_connect/models/v1_cash_drawer_event.rb +0 -33
- data/lib/square_connect/models/v1_cash_drawer_shift.rb +0 -33
- data/lib/square_connect/models/v1_create_refund_request.rb +0 -33
- data/lib/square_connect/models/v1_discount.rb +0 -45
- data/lib/square_connect/models/v1_employee.rb +0 -33
- data/lib/square_connect/models/v1_employee_role.rb +0 -21
- data/lib/square_connect/models/v1_fee.rb +0 -69
- data/lib/square_connect/models/v1_item.rb +0 -57
- data/lib/square_connect/models/v1_list_cash_drawer_shifts_request.rb +0 -33
- data/lib/square_connect/models/v1_list_employee_roles_request.rb +0 -33
- data/lib/square_connect/models/v1_list_employees_request.rb +0 -45
- data/lib/square_connect/models/v1_list_orders_request.rb +0 -33
- data/lib/square_connect/models/v1_list_payments_request.rb +0 -33
- data/lib/square_connect/models/v1_list_refunds_request.rb +0 -33
- data/lib/square_connect/models/v1_list_settlements_request.rb +0 -45
- data/lib/square_connect/models/v1_list_timecards_request.rb +0 -33
- data/lib/square_connect/models/v1_merchant.rb +0 -45
- data/lib/square_connect/models/v1_modifier_list.rb +0 -33
- data/lib/square_connect/models/v1_money.rb +0 -33
- data/lib/square_connect/models/v1_order.rb +0 -33
- data/lib/square_connect/models/v1_order_history_entry.rb +0 -33
- data/lib/square_connect/models/v1_page_cell.rb +0 -45
- data/lib/square_connect/models/v1_payment_itemization.rb +0 -33
- data/lib/square_connect/models/v1_payment_surcharge.rb +0 -33
- data/lib/square_connect/models/v1_payment_tax.rb +0 -33
- data/lib/square_connect/models/v1_refund.rb +0 -33
- data/lib/square_connect/models/v1_settlement.rb +0 -33
- data/lib/square_connect/models/v1_settlement_entry.rb +0 -33
- data/lib/square_connect/models/v1_tender.rb +0 -57
- data/lib/square_connect/models/v1_timecard_event.rb +0 -33
- data/lib/square_connect/models/v1_update_modifier_list_request.rb +0 -33
- data/lib/square_connect/models/v1_update_order_request.rb +0 -33
- data/lib/square_connect/models/v1_variation.rb +0 -45
- data/lib/square_connect/models/workweek_config.rb +0 -33
- data/lib/square_connect/version.rb +1 -1
- data/spec/api/catalog_api_spec.rb +0 -1
- metadata +2 -6
- data/docs/AggregationStrategy.md +0 -15
- data/lib/square_connect/models/aggregation_strategy.rb +0 -21
- data/spec/models/aggregation_strategy_spec.rb +0 -33
@@ -69,27 +69,6 @@ module SquareConnect
|
|
69
69
|
# All of the events (payments, refunds, and so on) that involved the cash drawer during the shift.
|
70
70
|
attr_accessor :events
|
71
71
|
|
72
|
-
class EnumAttributeValidator
|
73
|
-
attr_reader :datatype
|
74
|
-
attr_reader :allowable_values
|
75
|
-
|
76
|
-
def initialize(datatype, allowable_values)
|
77
|
-
@allowable_values = allowable_values.map do |value|
|
78
|
-
case datatype.to_s
|
79
|
-
when /Integer/i
|
80
|
-
value.to_i
|
81
|
-
when /Float/i
|
82
|
-
value.to_f
|
83
|
-
else
|
84
|
-
value
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
def valid?(value)
|
90
|
-
!value || allowable_values.include?(value)
|
91
|
-
end
|
92
|
-
end
|
93
72
|
|
94
73
|
# Attribute mapping from ruby-style variable name to JSON key.
|
95
74
|
def self.attribute_map
|
@@ -241,21 +220,9 @@ module SquareConnect
|
|
241
220
|
# Check to see if the all the properties in the model are valid
|
242
221
|
# @return true if the model is valid
|
243
222
|
def valid?
|
244
|
-
event_type_validator = EnumAttributeValidator.new('String', ["OPEN", "ENDED", "CLOSED"])
|
245
|
-
return false unless event_type_validator.valid?(@event_type)
|
246
223
|
return true
|
247
224
|
end
|
248
225
|
|
249
|
-
# Custom attribute writer method checking allowed values (enum).
|
250
|
-
# @param [Object] event_type Object to be assigned
|
251
|
-
def event_type=(event_type)
|
252
|
-
validator = EnumAttributeValidator.new('String', ["OPEN", "ENDED", "CLOSED"])
|
253
|
-
unless validator.valid?(event_type)
|
254
|
-
fail ArgumentError, "invalid value for 'event_type', must be one of #{validator.allowable_values}."
|
255
|
-
end
|
256
|
-
@event_type = event_type
|
257
|
-
end
|
258
|
-
|
259
226
|
# Checks equality by comparing each attribute.
|
260
227
|
# @param [Object] Object to be compared
|
261
228
|
def ==(o)
|
@@ -27,27 +27,6 @@ module SquareConnect
|
|
27
27
|
# An optional key to ensure idempotence if you issue the same PARTIAL refund request more than once.
|
28
28
|
attr_accessor :request_idempotence_key
|
29
29
|
|
30
|
-
class EnumAttributeValidator
|
31
|
-
attr_reader :datatype
|
32
|
-
attr_reader :allowable_values
|
33
|
-
|
34
|
-
def initialize(datatype, allowable_values)
|
35
|
-
@allowable_values = allowable_values.map do |value|
|
36
|
-
case datatype.to_s
|
37
|
-
when /Integer/i
|
38
|
-
value.to_i
|
39
|
-
when /Float/i
|
40
|
-
value.to_f
|
41
|
-
else
|
42
|
-
value
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def valid?(value)
|
48
|
-
!value || allowable_values.include?(value)
|
49
|
-
end
|
50
|
-
end
|
51
30
|
|
52
31
|
# Attribute mapping from ruby-style variable name to JSON key.
|
53
32
|
def self.attribute_map
|
@@ -125,22 +104,10 @@ module SquareConnect
|
|
125
104
|
def valid?
|
126
105
|
return false if @payment_id.nil?
|
127
106
|
return false if @type.nil?
|
128
|
-
type_validator = EnumAttributeValidator.new('String', ["FULL", "PARTIAL"])
|
129
|
-
return false unless type_validator.valid?(@type)
|
130
107
|
return false if @reason.nil?
|
131
108
|
return true
|
132
109
|
end
|
133
110
|
|
134
|
-
# Custom attribute writer method checking allowed values (enum).
|
135
|
-
# @param [Object] type Object to be assigned
|
136
|
-
def type=(type)
|
137
|
-
validator = EnumAttributeValidator.new('String', ["FULL", "PARTIAL"])
|
138
|
-
unless validator.valid?(type)
|
139
|
-
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
140
|
-
end
|
141
|
-
@type = type
|
142
|
-
end
|
143
|
-
|
144
111
|
# Checks equality by comparing each attribute.
|
145
112
|
# @param [Object] Object to be compared
|
146
113
|
def ==(o)
|
@@ -36,27 +36,6 @@ module SquareConnect
|
|
36
36
|
# The ID of the CatalogObject in the Connect v2 API. Objects that are shared across multiple locations share the same v2 ID.
|
37
37
|
attr_accessor :v2_id
|
38
38
|
|
39
|
-
class EnumAttributeValidator
|
40
|
-
attr_reader :datatype
|
41
|
-
attr_reader :allowable_values
|
42
|
-
|
43
|
-
def initialize(datatype, allowable_values)
|
44
|
-
@allowable_values = allowable_values.map do |value|
|
45
|
-
case datatype.to_s
|
46
|
-
when /Integer/i
|
47
|
-
value.to_i
|
48
|
-
when /Float/i
|
49
|
-
value.to_f
|
50
|
-
else
|
51
|
-
value
|
52
|
-
end
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def valid?(value)
|
57
|
-
!value || allowable_values.include?(value)
|
58
|
-
end
|
59
|
-
end
|
60
39
|
|
61
40
|
# Attribute mapping from ruby-style variable name to JSON key.
|
62
41
|
def self.attribute_map
|
@@ -138,33 +117,9 @@ module SquareConnect
|
|
138
117
|
# Check to see if the all the properties in the model are valid
|
139
118
|
# @return true if the model is valid
|
140
119
|
def valid?
|
141
|
-
discount_type_validator = EnumAttributeValidator.new('String', ["FIXED", "VARIABLE_PERCENTAGE", "VARIABLE_AMOUNT"])
|
142
|
-
return false unless discount_type_validator.valid?(@discount_type)
|
143
|
-
color_validator = EnumAttributeValidator.new('String', ["9da2a6", "4ab200", "0b8000", "2952cc", "a82ee5", "e5457a", "b21212", "593c00", "e5BF00"])
|
144
|
-
return false unless color_validator.valid?(@color)
|
145
120
|
return true
|
146
121
|
end
|
147
122
|
|
148
|
-
# Custom attribute writer method checking allowed values (enum).
|
149
|
-
# @param [Object] discount_type Object to be assigned
|
150
|
-
def discount_type=(discount_type)
|
151
|
-
validator = EnumAttributeValidator.new('String', ["FIXED", "VARIABLE_PERCENTAGE", "VARIABLE_AMOUNT"])
|
152
|
-
unless validator.valid?(discount_type)
|
153
|
-
fail ArgumentError, "invalid value for 'discount_type', must be one of #{validator.allowable_values}."
|
154
|
-
end
|
155
|
-
@discount_type = discount_type
|
156
|
-
end
|
157
|
-
|
158
|
-
# Custom attribute writer method checking allowed values (enum).
|
159
|
-
# @param [Object] color Object to be assigned
|
160
|
-
def color=(color)
|
161
|
-
validator = EnumAttributeValidator.new('String', ["9da2a6", "4ab200", "0b8000", "2952cc", "a82ee5", "e5457a", "b21212", "593c00", "e5BF00"])
|
162
|
-
unless validator.valid?(color)
|
163
|
-
fail ArgumentError, "invalid value for 'color', must be one of #{validator.allowable_values}."
|
164
|
-
end
|
165
|
-
@color = color
|
166
|
-
end
|
167
|
-
|
168
123
|
# Checks equality by comparing each attribute.
|
169
124
|
# @param [Object] Object to be compared
|
170
125
|
def ==(o)
|
@@ -42,27 +42,6 @@ module SquareConnect
|
|
42
42
|
# The time when the employee entity was most recently updated, in ISO 8601 format.
|
43
43
|
attr_accessor :updated_at
|
44
44
|
|
45
|
-
class EnumAttributeValidator
|
46
|
-
attr_reader :datatype
|
47
|
-
attr_reader :allowable_values
|
48
|
-
|
49
|
-
def initialize(datatype, allowable_values)
|
50
|
-
@allowable_values = allowable_values.map do |value|
|
51
|
-
case datatype.to_s
|
52
|
-
when /Integer/i
|
53
|
-
value.to_i
|
54
|
-
when /Float/i
|
55
|
-
value.to_f
|
56
|
-
else
|
57
|
-
value
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def valid?(value)
|
63
|
-
!value || allowable_values.include?(value)
|
64
|
-
end
|
65
|
-
end
|
66
45
|
|
67
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
68
47
|
def self.attribute_map
|
@@ -170,21 +149,9 @@ module SquareConnect
|
|
170
149
|
def valid?
|
171
150
|
return false if @first_name.nil?
|
172
151
|
return false if @last_name.nil?
|
173
|
-
status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "INACTIVE"])
|
174
|
-
return false unless status_validator.valid?(@status)
|
175
152
|
return true
|
176
153
|
end
|
177
154
|
|
178
|
-
# Custom attribute writer method checking allowed values (enum).
|
179
|
-
# @param [Object] status Object to be assigned
|
180
|
-
def status=(status)
|
181
|
-
validator = EnumAttributeValidator.new('String', ["ACTIVE", "INACTIVE"])
|
182
|
-
unless validator.valid?(status)
|
183
|
-
fail ArgumentError, "invalid value for 'status', must be one of #{validator.allowable_values}."
|
184
|
-
end
|
185
|
-
@status = status
|
186
|
-
end
|
187
|
-
|
188
155
|
# Checks equality by comparing each attribute.
|
189
156
|
# @param [Object] Object to be compared
|
190
157
|
def ==(o)
|
@@ -30,27 +30,6 @@ module SquareConnect
|
|
30
30
|
# The time when the employee entity was most recently updated, in ISO 8601 format. Is set by Square when the Role updated.
|
31
31
|
attr_accessor :updated_at
|
32
32
|
|
33
|
-
class EnumAttributeValidator
|
34
|
-
attr_reader :datatype
|
35
|
-
attr_reader :allowable_values
|
36
|
-
|
37
|
-
def initialize(datatype, allowable_values)
|
38
|
-
@allowable_values = allowable_values.map do |value|
|
39
|
-
case datatype.to_s
|
40
|
-
when /Integer/i
|
41
|
-
value.to_i
|
42
|
-
when /Float/i
|
43
|
-
value.to_f
|
44
|
-
else
|
45
|
-
value
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
def valid?(value)
|
51
|
-
!value || allowable_values.include?(value)
|
52
|
-
end
|
53
|
-
end
|
54
33
|
|
55
34
|
# Attribute mapping from ruby-style variable name to JSON key.
|
56
35
|
def self.attribute_map
|
@@ -42,27 +42,6 @@ module SquareConnect
|
|
42
42
|
# The ID of the CatalogObject in the Connect v2 API. Objects that are shared across multiple locations share the same v2 ID.
|
43
43
|
attr_accessor :v2_id
|
44
44
|
|
45
|
-
class EnumAttributeValidator
|
46
|
-
attr_reader :datatype
|
47
|
-
attr_reader :allowable_values
|
48
|
-
|
49
|
-
def initialize(datatype, allowable_values)
|
50
|
-
@allowable_values = allowable_values.map do |value|
|
51
|
-
case datatype.to_s
|
52
|
-
when /Integer/i
|
53
|
-
value.to_i
|
54
|
-
when /Float/i
|
55
|
-
value.to_f
|
56
|
-
else
|
57
|
-
value
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
def valid?(value)
|
63
|
-
!value || allowable_values.include?(value)
|
64
|
-
end
|
65
|
-
end
|
66
45
|
|
67
46
|
# Attribute mapping from ruby-style variable name to JSON key.
|
68
47
|
def self.attribute_map
|
@@ -156,57 +135,9 @@ module SquareConnect
|
|
156
135
|
# Check to see if the all the properties in the model are valid
|
157
136
|
# @return true if the model is valid
|
158
137
|
def valid?
|
159
|
-
calculation_phase_validator = EnumAttributeValidator.new('String', ["FEE_SUBTOTAL_PHASE", "OTHER", "FEE_TOTAL_PHASE"])
|
160
|
-
return false unless calculation_phase_validator.valid?(@calculation_phase)
|
161
|
-
adjustment_type_validator = EnumAttributeValidator.new('String', ["TAX"])
|
162
|
-
return false unless adjustment_type_validator.valid?(@adjustment_type)
|
163
|
-
inclusion_type_validator = EnumAttributeValidator.new('String', ["ADDITIVE", "INCLUSIVE"])
|
164
|
-
return false unless inclusion_type_validator.valid?(@inclusion_type)
|
165
|
-
type_validator = EnumAttributeValidator.new('String', ["CA_GST", "CA_HST", "CA_PST", "CA_QST", "JP_CONSUMPTION_TAX", "CA_PEI_PST", "US_SALES_TAX", "OTHER"])
|
166
|
-
return false unless type_validator.valid?(@type)
|
167
138
|
return true
|
168
139
|
end
|
169
140
|
|
170
|
-
# Custom attribute writer method checking allowed values (enum).
|
171
|
-
# @param [Object] calculation_phase Object to be assigned
|
172
|
-
def calculation_phase=(calculation_phase)
|
173
|
-
validator = EnumAttributeValidator.new('String', ["FEE_SUBTOTAL_PHASE", "OTHER", "FEE_TOTAL_PHASE"])
|
174
|
-
unless validator.valid?(calculation_phase)
|
175
|
-
fail ArgumentError, "invalid value for 'calculation_phase', must be one of #{validator.allowable_values}."
|
176
|
-
end
|
177
|
-
@calculation_phase = calculation_phase
|
178
|
-
end
|
179
|
-
|
180
|
-
# Custom attribute writer method checking allowed values (enum).
|
181
|
-
# @param [Object] adjustment_type Object to be assigned
|
182
|
-
def adjustment_type=(adjustment_type)
|
183
|
-
validator = EnumAttributeValidator.new('String', ["TAX"])
|
184
|
-
unless validator.valid?(adjustment_type)
|
185
|
-
fail ArgumentError, "invalid value for 'adjustment_type', must be one of #{validator.allowable_values}."
|
186
|
-
end
|
187
|
-
@adjustment_type = adjustment_type
|
188
|
-
end
|
189
|
-
|
190
|
-
# Custom attribute writer method checking allowed values (enum).
|
191
|
-
# @param [Object] inclusion_type Object to be assigned
|
192
|
-
def inclusion_type=(inclusion_type)
|
193
|
-
validator = EnumAttributeValidator.new('String', ["ADDITIVE", "INCLUSIVE"])
|
194
|
-
unless validator.valid?(inclusion_type)
|
195
|
-
fail ArgumentError, "invalid value for 'inclusion_type', must be one of #{validator.allowable_values}."
|
196
|
-
end
|
197
|
-
@inclusion_type = inclusion_type
|
198
|
-
end
|
199
|
-
|
200
|
-
# Custom attribute writer method checking allowed values (enum).
|
201
|
-
# @param [Object] type Object to be assigned
|
202
|
-
def type=(type)
|
203
|
-
validator = EnumAttributeValidator.new('String', ["CA_GST", "CA_HST", "CA_PST", "CA_QST", "JP_CONSUMPTION_TAX", "CA_PEI_PST", "US_SALES_TAX", "OTHER"])
|
204
|
-
unless validator.valid?(type)
|
205
|
-
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
206
|
-
end
|
207
|
-
@type = type
|
208
|
-
end
|
209
|
-
|
210
141
|
# Checks equality by comparing each attribute.
|
211
142
|
# @param [Object] Object to be compared
|
212
143
|
def ==(o)
|
@@ -63,27 +63,6 @@ module SquareConnect
|
|
63
63
|
# The ID of the CatalogObject in the Connect v2 API. Objects that are shared across multiple locations share the same v2 ID.
|
64
64
|
attr_accessor :v2_id
|
65
65
|
|
66
|
-
class EnumAttributeValidator
|
67
|
-
attr_reader :datatype
|
68
|
-
attr_reader :allowable_values
|
69
|
-
|
70
|
-
def initialize(datatype, allowable_values)
|
71
|
-
@allowable_values = allowable_values.map do |value|
|
72
|
-
case datatype.to_s
|
73
|
-
when /Integer/i
|
74
|
-
value.to_i
|
75
|
-
when /Float/i
|
76
|
-
value.to_f
|
77
|
-
else
|
78
|
-
value
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
def valid?(value)
|
84
|
-
!value || allowable_values.include?(value)
|
85
|
-
end
|
86
|
-
end
|
87
66
|
|
88
67
|
# Attribute mapping from ruby-style variable name to JSON key.
|
89
68
|
def self.attribute_map
|
@@ -225,45 +204,9 @@ module SquareConnect
|
|
225
204
|
# Check to see if the all the properties in the model are valid
|
226
205
|
# @return true if the model is valid
|
227
206
|
def valid?
|
228
|
-
type_validator = EnumAttributeValidator.new('String', ["NORMAL", "GIFT_CARD", "OTHER"])
|
229
|
-
return false unless type_validator.valid?(@type)
|
230
|
-
color_validator = EnumAttributeValidator.new('String', ["9da2a6", "4ab200", "0b8000", "2952cc", "a82ee5", "e5457a", "b21212", "593c00", "e5BF00"])
|
231
|
-
return false unless color_validator.valid?(@color)
|
232
|
-
visibility_validator = EnumAttributeValidator.new('String', ["PUBLIC", "PRIVATE"])
|
233
|
-
return false unless visibility_validator.valid?(@visibility)
|
234
207
|
return true
|
235
208
|
end
|
236
209
|
|
237
|
-
# Custom attribute writer method checking allowed values (enum).
|
238
|
-
# @param [Object] type Object to be assigned
|
239
|
-
def type=(type)
|
240
|
-
validator = EnumAttributeValidator.new('String', ["NORMAL", "GIFT_CARD", "OTHER"])
|
241
|
-
unless validator.valid?(type)
|
242
|
-
fail ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
|
243
|
-
end
|
244
|
-
@type = type
|
245
|
-
end
|
246
|
-
|
247
|
-
# Custom attribute writer method checking allowed values (enum).
|
248
|
-
# @param [Object] color Object to be assigned
|
249
|
-
def color=(color)
|
250
|
-
validator = EnumAttributeValidator.new('String', ["9da2a6", "4ab200", "0b8000", "2952cc", "a82ee5", "e5457a", "b21212", "593c00", "e5BF00"])
|
251
|
-
unless validator.valid?(color)
|
252
|
-
fail ArgumentError, "invalid value for 'color', must be one of #{validator.allowable_values}."
|
253
|
-
end
|
254
|
-
@color = color
|
255
|
-
end
|
256
|
-
|
257
|
-
# Custom attribute writer method checking allowed values (enum).
|
258
|
-
# @param [Object] visibility Object to be assigned
|
259
|
-
def visibility=(visibility)
|
260
|
-
validator = EnumAttributeValidator.new('String', ["PUBLIC", "PRIVATE"])
|
261
|
-
unless validator.valid?(visibility)
|
262
|
-
fail ArgumentError, "invalid value for 'visibility', must be one of #{validator.allowable_values}."
|
263
|
-
end
|
264
|
-
@visibility = visibility
|
265
|
-
end
|
266
|
-
|
267
210
|
# Checks equality by comparing each attribute.
|
268
211
|
# @param [Object] Object to be compared
|
269
212
|
def ==(o)
|
@@ -21,27 +21,6 @@ module SquareConnect
|
|
21
21
|
# The beginning of the requested reporting period, in ISO 8601 format. Default value: The current time.
|
22
22
|
attr_accessor :end_time
|
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
|
45
24
|
|
46
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
47
26
|
def self.attribute_map
|
@@ -93,21 +72,9 @@ module SquareConnect
|
|
93
72
|
# Check to see if the all the properties in the model are valid
|
94
73
|
# @return true if the model is valid
|
95
74
|
def valid?
|
96
|
-
order_validator = EnumAttributeValidator.new('String', ["DESC", "ASC"])
|
97
|
-
return false unless order_validator.valid?(@order)
|
98
75
|
return true
|
99
76
|
end
|
100
77
|
|
101
|
-
# Custom attribute writer method checking allowed values (enum).
|
102
|
-
# @param [Object] order Object to be assigned
|
103
|
-
def order=(order)
|
104
|
-
validator = EnumAttributeValidator.new('String', ["DESC", "ASC"])
|
105
|
-
unless validator.valid?(order)
|
106
|
-
fail ArgumentError, "invalid value for 'order', must be one of #{validator.allowable_values}."
|
107
|
-
end
|
108
|
-
@order = order
|
109
|
-
end
|
110
|
-
|
111
78
|
# Checks equality by comparing each attribute.
|
112
79
|
# @param [Object] Object to be compared
|
113
80
|
def ==(o)
|