long_thanh_sdk 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,357 @@
1
+ =begin
2
+ #Long Thanh Imbiss Public Information API
3
+
4
+ #Anonymous read-only published menu and business information. /api/v1/ is the stable major-version namespace. Breaking changes require a new namespace. No orders, reservations or payments. Deprecated versions receive at least 90 days notice in /api/, a Deprecation header and a Sunset header before removal. No version is currently deprecated.
5
+
6
+ The version of the OpenAPI document: 1.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LongThanhSdk
17
+ class BusinessOpeningHours < ApiModelBase
18
+ attr_accessor :days
19
+
20
+ attr_accessor :opens
21
+
22
+ attr_accessor :closes
23
+
24
+ attr_accessor :closed
25
+
26
+ attr_accessor :time_zone
27
+
28
+ attr_accessor :holiday_hours
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
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
53
+ def self.attribute_map
54
+ {
55
+ :'days' => :'days',
56
+ :'opens' => :'opens',
57
+ :'closes' => :'closes',
58
+ :'closed' => :'closed',
59
+ :'time_zone' => :'timeZone',
60
+ :'holiday_hours' => :'holidayHours'
61
+ }
62
+ end
63
+
64
+ # Returns attribute mapping this model knows about
65
+ def self.acceptable_attribute_map
66
+ attribute_map
67
+ end
68
+
69
+ # Returns all the JSON keys this model knows about
70
+ def self.acceptable_attributes
71
+ acceptable_attribute_map.values
72
+ end
73
+
74
+ # Attribute type mapping.
75
+ def self.openapi_types
76
+ {
77
+ :'days' => :'Array<String>',
78
+ :'opens' => :'String',
79
+ :'closes' => :'String',
80
+ :'closed' => :'Array<String>',
81
+ :'time_zone' => :'String',
82
+ :'holiday_hours' => :'String'
83
+ }
84
+ end
85
+
86
+ # List of attributes with nullable: true
87
+ def self.openapi_nullable
88
+ Set.new([
89
+ ])
90
+ end
91
+
92
+ # Returns attribute type mapping
93
+ def self.acceptable_openapi_types
94
+ openapi_types
95
+ end
96
+
97
+ # Returns the nullable attributes
98
+ def self.acceptable_openapi_nullable
99
+ openapi_nullable
100
+ end
101
+
102
+ # Initializes the object
103
+ # @param [Hash] attributes Model attributes in the form of hash
104
+ def initialize(attributes = {})
105
+ if (!attributes.is_a?(Hash))
106
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LongThanhSdk::BusinessOpeningHours` initialize method"
107
+ end
108
+
109
+ # check to see if the attribute exists and convert string to symbol for hash key
110
+ acceptable_attribute_map = self.class.acceptable_attribute_map
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!acceptable_attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LongThanhSdk::BusinessOpeningHours`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'days')
119
+ if (value = attributes[:'days']).is_a?(Array)
120
+ self.days = value
121
+ end
122
+ else
123
+ self.days = nil
124
+ end
125
+
126
+ if attributes.key?(:'opens')
127
+ self.opens = attributes[:'opens']
128
+ else
129
+ self.opens = nil
130
+ end
131
+
132
+ if attributes.key?(:'closes')
133
+ self.closes = attributes[:'closes']
134
+ else
135
+ self.closes = nil
136
+ end
137
+
138
+ if attributes.key?(:'closed')
139
+ if (value = attributes[:'closed']).is_a?(Array)
140
+ self.closed = value
141
+ end
142
+ else
143
+ self.closed = nil
144
+ end
145
+
146
+ if attributes.key?(:'time_zone')
147
+ self.time_zone = attributes[:'time_zone']
148
+ else
149
+ self.time_zone = nil
150
+ end
151
+
152
+ if attributes.key?(:'holiday_hours')
153
+ self.holiday_hours = attributes[:'holiday_hours']
154
+ else
155
+ self.holiday_hours = nil
156
+ end
157
+ end
158
+
159
+ # Show invalid properties with the reasons. Usually used together with valid?
160
+ # @return Array for valid properties with the reasons
161
+ def list_invalid_properties
162
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
163
+ invalid_properties = Array.new
164
+ if @days.nil?
165
+ invalid_properties.push('invalid value for "days", days cannot be nil.')
166
+ end
167
+
168
+ if @opens.nil?
169
+ invalid_properties.push('invalid value for "opens", opens cannot be nil.')
170
+ end
171
+
172
+ pattern = Regexp.new(/^[0-2][0-9]:[0-5][0-9]$/)
173
+ if @opens !~ pattern
174
+ invalid_properties.push("invalid value for \"opens\", must conform to the pattern #{pattern}.")
175
+ end
176
+
177
+ if @closes.nil?
178
+ invalid_properties.push('invalid value for "closes", closes cannot be nil.')
179
+ end
180
+
181
+ pattern = Regexp.new(/^[0-2][0-9]:[0-5][0-9]$/)
182
+ if @closes !~ pattern
183
+ invalid_properties.push("invalid value for \"closes\", must conform to the pattern #{pattern}.")
184
+ end
185
+
186
+ if @closed.nil?
187
+ invalid_properties.push('invalid value for "closed", closed cannot be nil.')
188
+ end
189
+
190
+ if @time_zone.nil?
191
+ invalid_properties.push('invalid value for "time_zone", time_zone cannot be nil.')
192
+ end
193
+
194
+ if @holiday_hours.nil?
195
+ invalid_properties.push('invalid value for "holiday_hours", holiday_hours cannot be nil.')
196
+ end
197
+
198
+ invalid_properties
199
+ end
200
+
201
+ # Check to see if the all the properties in the model are valid
202
+ # @return true if the model is valid
203
+ def valid?
204
+ warn '[DEPRECATED] the `valid?` method is obsolete'
205
+ return false if @days.nil?
206
+ return false if @opens.nil?
207
+ return false if @opens !~ Regexp.new(/^[0-2][0-9]:[0-5][0-9]$/)
208
+ return false if @closes.nil?
209
+ return false if @closes !~ Regexp.new(/^[0-2][0-9]:[0-5][0-9]$/)
210
+ return false if @closed.nil?
211
+ return false if @time_zone.nil?
212
+ time_zone_validator = EnumAttributeValidator.new('String', ["Europe/Berlin"])
213
+ return false unless time_zone_validator.valid?(@time_zone)
214
+ return false if @holiday_hours.nil?
215
+ true
216
+ end
217
+
218
+ # Custom attribute writer method with validation
219
+ # @param [Object] days Value to be assigned
220
+ def days=(days)
221
+ if days.nil?
222
+ fail ArgumentError, 'days cannot be nil'
223
+ end
224
+
225
+ @days = days
226
+ end
227
+
228
+ # Custom attribute writer method with validation
229
+ # @param [Object] opens Value to be assigned
230
+ def opens=(opens)
231
+ if opens.nil?
232
+ fail ArgumentError, 'opens cannot be nil'
233
+ end
234
+
235
+ pattern = Regexp.new(/^[0-2][0-9]:[0-5][0-9]$/)
236
+ if opens !~ pattern
237
+ fail ArgumentError, "invalid value for \"opens\", must conform to the pattern #{pattern}."
238
+ end
239
+
240
+ @opens = opens
241
+ end
242
+
243
+ # Custom attribute writer method with validation
244
+ # @param [Object] closes Value to be assigned
245
+ def closes=(closes)
246
+ if closes.nil?
247
+ fail ArgumentError, 'closes cannot be nil'
248
+ end
249
+
250
+ pattern = Regexp.new(/^[0-2][0-9]:[0-5][0-9]$/)
251
+ if closes !~ pattern
252
+ fail ArgumentError, "invalid value for \"closes\", must conform to the pattern #{pattern}."
253
+ end
254
+
255
+ @closes = closes
256
+ end
257
+
258
+ # Custom attribute writer method with validation
259
+ # @param [Object] closed Value to be assigned
260
+ def closed=(closed)
261
+ if closed.nil?
262
+ fail ArgumentError, 'closed cannot be nil'
263
+ end
264
+
265
+ @closed = closed
266
+ end
267
+
268
+ # Custom attribute writer method checking allowed values (enum).
269
+ # @param [Object] time_zone Object to be assigned
270
+ def time_zone=(time_zone)
271
+ validator = EnumAttributeValidator.new('String', ["Europe/Berlin"])
272
+ unless validator.valid?(time_zone)
273
+ fail ArgumentError, "invalid value for \"time_zone\", must be one of #{validator.allowable_values}."
274
+ end
275
+ @time_zone = time_zone
276
+ end
277
+
278
+ # Custom attribute writer method with validation
279
+ # @param [Object] holiday_hours Value to be assigned
280
+ def holiday_hours=(holiday_hours)
281
+ if holiday_hours.nil?
282
+ fail ArgumentError, 'holiday_hours cannot be nil'
283
+ end
284
+
285
+ @holiday_hours = holiday_hours
286
+ end
287
+
288
+ # Checks equality by comparing each attribute.
289
+ # @param [Object] Object to be compared
290
+ def ==(o)
291
+ return true if self.equal?(o)
292
+ self.class == o.class &&
293
+ days == o.days &&
294
+ opens == o.opens &&
295
+ closes == o.closes &&
296
+ closed == o.closed &&
297
+ time_zone == o.time_zone &&
298
+ holiday_hours == o.holiday_hours
299
+ end
300
+
301
+ # @see the `==` method
302
+ # @param [Object] Object to be compared
303
+ def eql?(o)
304
+ self == o
305
+ end
306
+
307
+ # Calculates hash code according to all attributes.
308
+ # @return [Integer] Hash code
309
+ def hash
310
+ [days, opens, closes, closed, time_zone, holiday_hours].hash
311
+ end
312
+
313
+ # Builds the object from hash
314
+ # @param [Hash] attributes Model attributes in the form of hash
315
+ # @return [Object] Returns the model itself
316
+ def self.build_from_hash(attributes)
317
+ return nil unless attributes.is_a?(Hash)
318
+ attributes = attributes.transform_keys(&:to_sym)
319
+ # include attributes inherited from allOf parents (the nearest declaration wins)
320
+ map = acceptable_attribute_map
321
+ transformed_hash = {}
322
+ acceptable_openapi_types.each_pair do |key, type|
323
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
324
+ transformed_hash["#{key}"] = nil
325
+ elsif type =~ /\AArray<(.*)>/i
326
+ # check to ensure the input is an array given that the attribute
327
+ # is documented as an array but the input is not
328
+ if attributes[map[key]].is_a?(Array)
329
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
330
+ end
331
+ elsif !attributes[map[key]].nil?
332
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
333
+ end
334
+ end
335
+ new(transformed_hash)
336
+ end
337
+
338
+ # Returns the object in the form of hash
339
+ # @return [Hash] Returns the object in the form of hash
340
+ def to_hash
341
+ hash = {}
342
+ # include attributes inherited from allOf parents (the nearest declaration wins)
343
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
344
+ value = self.send(attr)
345
+ if value.nil?
346
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
347
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
348
+ end
349
+
350
+ hash[param] = _to_hash(value)
351
+ end
352
+ hash
353
+ end
354
+
355
+ end
356
+
357
+ end
@@ -0,0 +1,309 @@
1
+ =begin
2
+ #Long Thanh Imbiss Public Information API
3
+
4
+ #Anonymous read-only published menu and business information. /api/v1/ is the stable major-version namespace. Breaking changes require a new namespace. No orders, reservations or payments. Deprecated versions receive at least 90 days notice in /api/, a Deprecation header and a Sunset header before removal. No version is currently deprecated.
5
+
6
+ The version of the OpenAPI document: 1.1.1
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.26.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module LongThanhSdk
17
+ class BusinessOrdering < ApiModelBase
18
+ attr_accessor :channel
19
+
20
+ attr_accessor :steps
21
+
22
+ attr_accessor :online_checkout
23
+
24
+ attr_accessor :agent_can_place_orders
25
+
26
+ attr_accessor :delivery
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'channel' => :'channel',
54
+ :'steps' => :'steps',
55
+ :'online_checkout' => :'onlineCheckout',
56
+ :'agent_can_place_orders' => :'agentCanPlaceOrders',
57
+ :'delivery' => :'delivery'
58
+ }
59
+ end
60
+
61
+ # Returns attribute mapping this model knows about
62
+ def self.acceptable_attribute_map
63
+ attribute_map
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ acceptable_attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'channel' => :'String',
75
+ :'steps' => :'Array<String>',
76
+ :'online_checkout' => :'Boolean',
77
+ :'agent_can_place_orders' => :'Boolean',
78
+ :'delivery' => :'String'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Returns attribute type mapping
89
+ def self.acceptable_openapi_types
90
+ openapi_types
91
+ end
92
+
93
+ # Returns the nullable attributes
94
+ def self.acceptable_openapi_nullable
95
+ openapi_nullable
96
+ end
97
+
98
+ # Initializes the object
99
+ # @param [Hash] attributes Model attributes in the form of hash
100
+ def initialize(attributes = {})
101
+ if (!attributes.is_a?(Hash))
102
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LongThanhSdk::BusinessOrdering` initialize method"
103
+ end
104
+
105
+ # check to see if the attribute exists and convert string to symbol for hash key
106
+ acceptable_attribute_map = self.class.acceptable_attribute_map
107
+ attributes = attributes.each_with_object({}) { |(k, v), h|
108
+ if (!acceptable_attribute_map.key?(k.to_sym))
109
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LongThanhSdk::BusinessOrdering`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
110
+ end
111
+ h[k.to_sym] = v
112
+ }
113
+
114
+ if attributes.key?(:'channel')
115
+ self.channel = attributes[:'channel']
116
+ else
117
+ self.channel = nil
118
+ end
119
+
120
+ if attributes.key?(:'steps')
121
+ if (value = attributes[:'steps']).is_a?(Array)
122
+ self.steps = value
123
+ end
124
+ else
125
+ self.steps = nil
126
+ end
127
+
128
+ if attributes.key?(:'online_checkout')
129
+ self.online_checkout = attributes[:'online_checkout']
130
+ else
131
+ self.online_checkout = nil
132
+ end
133
+
134
+ if attributes.key?(:'agent_can_place_orders')
135
+ self.agent_can_place_orders = attributes[:'agent_can_place_orders']
136
+ else
137
+ self.agent_can_place_orders = nil
138
+ end
139
+
140
+ if attributes.key?(:'delivery')
141
+ self.delivery = attributes[:'delivery']
142
+ else
143
+ self.delivery = nil
144
+ end
145
+ end
146
+
147
+ # Show invalid properties with the reasons. Usually used together with valid?
148
+ # @return Array for valid properties with the reasons
149
+ def list_invalid_properties
150
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
151
+ invalid_properties = Array.new
152
+ if @channel.nil?
153
+ invalid_properties.push('invalid value for "channel", channel cannot be nil.')
154
+ end
155
+
156
+ if @steps.nil?
157
+ invalid_properties.push('invalid value for "steps", steps cannot be nil.')
158
+ end
159
+
160
+ if @online_checkout.nil?
161
+ invalid_properties.push('invalid value for "online_checkout", online_checkout cannot be nil.')
162
+ end
163
+
164
+ if @agent_can_place_orders.nil?
165
+ invalid_properties.push('invalid value for "agent_can_place_orders", agent_can_place_orders cannot be nil.')
166
+ end
167
+
168
+ if @delivery.nil?
169
+ invalid_properties.push('invalid value for "delivery", delivery cannot be nil.')
170
+ end
171
+
172
+ invalid_properties
173
+ end
174
+
175
+ # Check to see if the all the properties in the model are valid
176
+ # @return true if the model is valid
177
+ def valid?
178
+ warn '[DEPRECATED] the `valid?` method is obsolete'
179
+ return false if @channel.nil?
180
+ return false if @steps.nil?
181
+ return false if @online_checkout.nil?
182
+ online_checkout_validator = EnumAttributeValidator.new('Boolean', ["false"])
183
+ return false unless online_checkout_validator.valid?(@online_checkout)
184
+ return false if @agent_can_place_orders.nil?
185
+ agent_can_place_orders_validator = EnumAttributeValidator.new('Boolean', ["false"])
186
+ return false unless agent_can_place_orders_validator.valid?(@agent_can_place_orders)
187
+ return false if @delivery.nil?
188
+ true
189
+ end
190
+
191
+ # Custom attribute writer method with validation
192
+ # @param [Object] channel Value to be assigned
193
+ def channel=(channel)
194
+ if channel.nil?
195
+ fail ArgumentError, 'channel cannot be nil'
196
+ end
197
+
198
+ @channel = channel
199
+ end
200
+
201
+ # Custom attribute writer method with validation
202
+ # @param [Object] steps Value to be assigned
203
+ def steps=(steps)
204
+ if steps.nil?
205
+ fail ArgumentError, 'steps cannot be nil'
206
+ end
207
+
208
+ @steps = steps
209
+ end
210
+
211
+ # Custom attribute writer method checking allowed values (enum).
212
+ # @param [Object] online_checkout Object to be assigned
213
+ def online_checkout=(online_checkout)
214
+ validator = EnumAttributeValidator.new('Boolean', ["false"])
215
+ unless validator.valid?(online_checkout)
216
+ fail ArgumentError, "invalid value for \"online_checkout\", must be one of #{validator.allowable_values}."
217
+ end
218
+ @online_checkout = online_checkout
219
+ end
220
+
221
+ # Custom attribute writer method checking allowed values (enum).
222
+ # @param [Object] agent_can_place_orders Object to be assigned
223
+ def agent_can_place_orders=(agent_can_place_orders)
224
+ validator = EnumAttributeValidator.new('Boolean', ["false"])
225
+ unless validator.valid?(agent_can_place_orders)
226
+ fail ArgumentError, "invalid value for \"agent_can_place_orders\", must be one of #{validator.allowable_values}."
227
+ end
228
+ @agent_can_place_orders = agent_can_place_orders
229
+ end
230
+
231
+ # Custom attribute writer method with validation
232
+ # @param [Object] delivery Value to be assigned
233
+ def delivery=(delivery)
234
+ if delivery.nil?
235
+ fail ArgumentError, 'delivery cannot be nil'
236
+ end
237
+
238
+ @delivery = delivery
239
+ end
240
+
241
+ # Checks equality by comparing each attribute.
242
+ # @param [Object] Object to be compared
243
+ def ==(o)
244
+ return true if self.equal?(o)
245
+ self.class == o.class &&
246
+ channel == o.channel &&
247
+ steps == o.steps &&
248
+ online_checkout == o.online_checkout &&
249
+ agent_can_place_orders == o.agent_can_place_orders &&
250
+ delivery == o.delivery
251
+ end
252
+
253
+ # @see the `==` method
254
+ # @param [Object] Object to be compared
255
+ def eql?(o)
256
+ self == o
257
+ end
258
+
259
+ # Calculates hash code according to all attributes.
260
+ # @return [Integer] Hash code
261
+ def hash
262
+ [channel, steps, online_checkout, agent_can_place_orders, delivery].hash
263
+ end
264
+
265
+ # Builds the object from hash
266
+ # @param [Hash] attributes Model attributes in the form of hash
267
+ # @return [Object] Returns the model itself
268
+ def self.build_from_hash(attributes)
269
+ return nil unless attributes.is_a?(Hash)
270
+ attributes = attributes.transform_keys(&:to_sym)
271
+ # include attributes inherited from allOf parents (the nearest declaration wins)
272
+ map = acceptable_attribute_map
273
+ transformed_hash = {}
274
+ acceptable_openapi_types.each_pair do |key, type|
275
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
276
+ transformed_hash["#{key}"] = nil
277
+ elsif type =~ /\AArray<(.*)>/i
278
+ # check to ensure the input is an array given that the attribute
279
+ # is documented as an array but the input is not
280
+ if attributes[map[key]].is_a?(Array)
281
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
282
+ end
283
+ elsif !attributes[map[key]].nil?
284
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
285
+ end
286
+ end
287
+ new(transformed_hash)
288
+ end
289
+
290
+ # Returns the object in the form of hash
291
+ # @return [Hash] Returns the object in the form of hash
292
+ def to_hash
293
+ hash = {}
294
+ # include attributes inherited from allOf parents (the nearest declaration wins)
295
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
296
+ value = self.send(attr)
297
+ if value.nil?
298
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
299
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
300
+ end
301
+
302
+ hash[param] = _to_hash(value)
303
+ end
304
+ hash
305
+ end
306
+
307
+ end
308
+
309
+ end