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,411 @@
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 Business < ApiModelBase
18
+ attr_accessor :version
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :description
23
+
24
+ attr_accessor :url
25
+
26
+ attr_accessor :telephone
27
+
28
+ attr_accessor :address
29
+
30
+ attr_accessor :opening_hours
31
+
32
+ attr_accessor :ordering
33
+
34
+ attr_accessor :limitations
35
+
36
+ class EnumAttributeValidator
37
+ attr_reader :datatype
38
+ attr_reader :allowable_values
39
+
40
+ def initialize(datatype, allowable_values)
41
+ @allowable_values = allowable_values.map do |value|
42
+ case datatype.to_s
43
+ when /Integer/i
44
+ value.to_i
45
+ when /Float/i
46
+ value.to_f
47
+ else
48
+ value
49
+ end
50
+ end
51
+ end
52
+
53
+ def valid?(value)
54
+ !value || allowable_values.include?(value)
55
+ end
56
+ end
57
+
58
+ # Attribute mapping from ruby-style variable name to JSON key.
59
+ def self.attribute_map
60
+ {
61
+ :'version' => :'version',
62
+ :'name' => :'name',
63
+ :'description' => :'description',
64
+ :'url' => :'url',
65
+ :'telephone' => :'telephone',
66
+ :'address' => :'address',
67
+ :'opening_hours' => :'openingHours',
68
+ :'ordering' => :'ordering',
69
+ :'limitations' => :'limitations'
70
+ }
71
+ end
72
+
73
+ # Returns attribute mapping this model knows about
74
+ def self.acceptable_attribute_map
75
+ attribute_map
76
+ end
77
+
78
+ # Returns all the JSON keys this model knows about
79
+ def self.acceptable_attributes
80
+ acceptable_attribute_map.values
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'version' => :'String',
87
+ :'name' => :'String',
88
+ :'description' => :'String',
89
+ :'url' => :'String',
90
+ :'telephone' => :'String',
91
+ :'address' => :'BusinessAddress',
92
+ :'opening_hours' => :'BusinessOpeningHours',
93
+ :'ordering' => :'BusinessOrdering',
94
+ :'limitations' => :'Array<String>'
95
+ }
96
+ end
97
+
98
+ # List of attributes with nullable: true
99
+ def self.openapi_nullable
100
+ Set.new([
101
+ ])
102
+ end
103
+
104
+ # Returns attribute type mapping
105
+ def self.acceptable_openapi_types
106
+ openapi_types
107
+ end
108
+
109
+ # Returns the nullable attributes
110
+ def self.acceptable_openapi_nullable
111
+ openapi_nullable
112
+ end
113
+
114
+ # Initializes the object
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ def initialize(attributes = {})
117
+ if (!attributes.is_a?(Hash))
118
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LongThanhSdk::Business` initialize method"
119
+ end
120
+
121
+ # check to see if the attribute exists and convert string to symbol for hash key
122
+ acceptable_attribute_map = self.class.acceptable_attribute_map
123
+ attributes = attributes.each_with_object({}) { |(k, v), h|
124
+ if (!acceptable_attribute_map.key?(k.to_sym))
125
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LongThanhSdk::Business`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
126
+ end
127
+ h[k.to_sym] = v
128
+ }
129
+
130
+ if attributes.key?(:'version')
131
+ self.version = attributes[:'version']
132
+ else
133
+ self.version = nil
134
+ end
135
+
136
+ if attributes.key?(:'name')
137
+ self.name = attributes[:'name']
138
+ else
139
+ self.name = nil
140
+ end
141
+
142
+ if attributes.key?(:'description')
143
+ self.description = attributes[:'description']
144
+ else
145
+ self.description = nil
146
+ end
147
+
148
+ if attributes.key?(:'url')
149
+ self.url = attributes[:'url']
150
+ else
151
+ self.url = nil
152
+ end
153
+
154
+ if attributes.key?(:'telephone')
155
+ self.telephone = attributes[:'telephone']
156
+ else
157
+ self.telephone = nil
158
+ end
159
+
160
+ if attributes.key?(:'address')
161
+ self.address = attributes[:'address']
162
+ else
163
+ self.address = nil
164
+ end
165
+
166
+ if attributes.key?(:'opening_hours')
167
+ self.opening_hours = attributes[:'opening_hours']
168
+ else
169
+ self.opening_hours = nil
170
+ end
171
+
172
+ if attributes.key?(:'ordering')
173
+ self.ordering = attributes[:'ordering']
174
+ else
175
+ self.ordering = nil
176
+ end
177
+
178
+ if attributes.key?(:'limitations')
179
+ if (value = attributes[:'limitations']).is_a?(Array)
180
+ self.limitations = value
181
+ end
182
+ else
183
+ self.limitations = nil
184
+ end
185
+ end
186
+
187
+ # Show invalid properties with the reasons. Usually used together with valid?
188
+ # @return Array for valid properties with the reasons
189
+ def list_invalid_properties
190
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
191
+ invalid_properties = Array.new
192
+ if @version.nil?
193
+ invalid_properties.push('invalid value for "version", version cannot be nil.')
194
+ end
195
+
196
+ if @name.nil?
197
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
198
+ end
199
+
200
+ if @description.nil?
201
+ invalid_properties.push('invalid value for "description", description cannot be nil.')
202
+ end
203
+
204
+ if @url.nil?
205
+ invalid_properties.push('invalid value for "url", url cannot be nil.')
206
+ end
207
+
208
+ if @telephone.nil?
209
+ invalid_properties.push('invalid value for "telephone", telephone cannot be nil.')
210
+ end
211
+
212
+ if @address.nil?
213
+ invalid_properties.push('invalid value for "address", address cannot be nil.')
214
+ end
215
+
216
+ if @opening_hours.nil?
217
+ invalid_properties.push('invalid value for "opening_hours", opening_hours cannot be nil.')
218
+ end
219
+
220
+ if @ordering.nil?
221
+ invalid_properties.push('invalid value for "ordering", ordering cannot be nil.')
222
+ end
223
+
224
+ if @limitations.nil?
225
+ invalid_properties.push('invalid value for "limitations", limitations cannot be nil.')
226
+ end
227
+
228
+ invalid_properties
229
+ end
230
+
231
+ # Check to see if the all the properties in the model are valid
232
+ # @return true if the model is valid
233
+ def valid?
234
+ warn '[DEPRECATED] the `valid?` method is obsolete'
235
+ return false if @version.nil?
236
+ version_validator = EnumAttributeValidator.new('String', ["1"])
237
+ return false unless version_validator.valid?(@version)
238
+ return false if @name.nil?
239
+ return false if @description.nil?
240
+ return false if @url.nil?
241
+ return false if @telephone.nil?
242
+ return false if @address.nil?
243
+ return false if @opening_hours.nil?
244
+ return false if @ordering.nil?
245
+ return false if @limitations.nil?
246
+ true
247
+ end
248
+
249
+ # Custom attribute writer method checking allowed values (enum).
250
+ # @param [Object] version Object to be assigned
251
+ def version=(version)
252
+ validator = EnumAttributeValidator.new('String', ["1"])
253
+ unless validator.valid?(version)
254
+ fail ArgumentError, "invalid value for \"version\", must be one of #{validator.allowable_values}."
255
+ end
256
+ @version = version
257
+ end
258
+
259
+ # Custom attribute writer method with validation
260
+ # @param [Object] name Value to be assigned
261
+ def name=(name)
262
+ if name.nil?
263
+ fail ArgumentError, 'name cannot be nil'
264
+ end
265
+
266
+ @name = name
267
+ end
268
+
269
+ # Custom attribute writer method with validation
270
+ # @param [Object] description Value to be assigned
271
+ def description=(description)
272
+ if description.nil?
273
+ fail ArgumentError, 'description cannot be nil'
274
+ end
275
+
276
+ @description = description
277
+ end
278
+
279
+ # Custom attribute writer method with validation
280
+ # @param [Object] url Value to be assigned
281
+ def url=(url)
282
+ if url.nil?
283
+ fail ArgumentError, 'url cannot be nil'
284
+ end
285
+
286
+ @url = url
287
+ end
288
+
289
+ # Custom attribute writer method with validation
290
+ # @param [Object] telephone Value to be assigned
291
+ def telephone=(telephone)
292
+ if telephone.nil?
293
+ fail ArgumentError, 'telephone cannot be nil'
294
+ end
295
+
296
+ @telephone = telephone
297
+ end
298
+
299
+ # Custom attribute writer method with validation
300
+ # @param [Object] address Value to be assigned
301
+ def address=(address)
302
+ if address.nil?
303
+ fail ArgumentError, 'address cannot be nil'
304
+ end
305
+
306
+ @address = address
307
+ end
308
+
309
+ # Custom attribute writer method with validation
310
+ # @param [Object] opening_hours Value to be assigned
311
+ def opening_hours=(opening_hours)
312
+ if opening_hours.nil?
313
+ fail ArgumentError, 'opening_hours cannot be nil'
314
+ end
315
+
316
+ @opening_hours = opening_hours
317
+ end
318
+
319
+ # Custom attribute writer method with validation
320
+ # @param [Object] ordering Value to be assigned
321
+ def ordering=(ordering)
322
+ if ordering.nil?
323
+ fail ArgumentError, 'ordering cannot be nil'
324
+ end
325
+
326
+ @ordering = ordering
327
+ end
328
+
329
+ # Custom attribute writer method with validation
330
+ # @param [Object] limitations Value to be assigned
331
+ def limitations=(limitations)
332
+ if limitations.nil?
333
+ fail ArgumentError, 'limitations cannot be nil'
334
+ end
335
+
336
+ @limitations = limitations
337
+ end
338
+
339
+ # Checks equality by comparing each attribute.
340
+ # @param [Object] Object to be compared
341
+ def ==(o)
342
+ return true if self.equal?(o)
343
+ self.class == o.class &&
344
+ version == o.version &&
345
+ name == o.name &&
346
+ description == o.description &&
347
+ url == o.url &&
348
+ telephone == o.telephone &&
349
+ address == o.address &&
350
+ opening_hours == o.opening_hours &&
351
+ ordering == o.ordering &&
352
+ limitations == o.limitations
353
+ end
354
+
355
+ # @see the `==` method
356
+ # @param [Object] Object to be compared
357
+ def eql?(o)
358
+ self == o
359
+ end
360
+
361
+ # Calculates hash code according to all attributes.
362
+ # @return [Integer] Hash code
363
+ def hash
364
+ [version, name, description, url, telephone, address, opening_hours, ordering, limitations].hash
365
+ end
366
+
367
+ # Builds the object from hash
368
+ # @param [Hash] attributes Model attributes in the form of hash
369
+ # @return [Object] Returns the model itself
370
+ def self.build_from_hash(attributes)
371
+ return nil unless attributes.is_a?(Hash)
372
+ attributes = attributes.transform_keys(&:to_sym)
373
+ # include attributes inherited from allOf parents (the nearest declaration wins)
374
+ map = acceptable_attribute_map
375
+ transformed_hash = {}
376
+ acceptable_openapi_types.each_pair do |key, type|
377
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
378
+ transformed_hash["#{key}"] = nil
379
+ elsif type =~ /\AArray<(.*)>/i
380
+ # check to ensure the input is an array given that the attribute
381
+ # is documented as an array but the input is not
382
+ if attributes[map[key]].is_a?(Array)
383
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
384
+ end
385
+ elsif !attributes[map[key]].nil?
386
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
387
+ end
388
+ end
389
+ new(transformed_hash)
390
+ end
391
+
392
+ # Returns the object in the form of hash
393
+ # @return [Hash] Returns the object in the form of hash
394
+ def to_hash
395
+ hash = {}
396
+ # include attributes inherited from allOf parents (the nearest declaration wins)
397
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
398
+ value = self.send(attr)
399
+ if value.nil?
400
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
401
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
402
+ end
403
+
404
+ hash[param] = _to_hash(value)
405
+ end
406
+ hash
407
+ end
408
+
409
+ end
410
+
411
+ end
@@ -0,0 +1,279 @@
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 BusinessAddress < ApiModelBase
18
+ attr_accessor :street_address
19
+
20
+ attr_accessor :postal_code
21
+
22
+ attr_accessor :address_locality
23
+
24
+ attr_accessor :address_country
25
+
26
+ class EnumAttributeValidator
27
+ attr_reader :datatype
28
+ attr_reader :allowable_values
29
+
30
+ def initialize(datatype, allowable_values)
31
+ @allowable_values = allowable_values.map do |value|
32
+ case datatype.to_s
33
+ when /Integer/i
34
+ value.to_i
35
+ when /Float/i
36
+ value.to_f
37
+ else
38
+ value
39
+ end
40
+ end
41
+ end
42
+
43
+ def valid?(value)
44
+ !value || allowable_values.include?(value)
45
+ end
46
+ end
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'street_address' => :'streetAddress',
52
+ :'postal_code' => :'postalCode',
53
+ :'address_locality' => :'addressLocality',
54
+ :'address_country' => :'addressCountry'
55
+ }
56
+ end
57
+
58
+ # Returns attribute mapping this model knows about
59
+ def self.acceptable_attribute_map
60
+ attribute_map
61
+ end
62
+
63
+ # Returns all the JSON keys this model knows about
64
+ def self.acceptable_attributes
65
+ acceptable_attribute_map.values
66
+ end
67
+
68
+ # Attribute type mapping.
69
+ def self.openapi_types
70
+ {
71
+ :'street_address' => :'String',
72
+ :'postal_code' => :'String',
73
+ :'address_locality' => :'String',
74
+ :'address_country' => :'String'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Returns attribute type mapping
85
+ def self.acceptable_openapi_types
86
+ openapi_types
87
+ end
88
+
89
+ # Returns the nullable attributes
90
+ def self.acceptable_openapi_nullable
91
+ openapi_nullable
92
+ end
93
+
94
+ # Initializes the object
95
+ # @param [Hash] attributes Model attributes in the form of hash
96
+ def initialize(attributes = {})
97
+ if (!attributes.is_a?(Hash))
98
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LongThanhSdk::BusinessAddress` initialize method"
99
+ end
100
+
101
+ # check to see if the attribute exists and convert string to symbol for hash key
102
+ acceptable_attribute_map = self.class.acceptable_attribute_map
103
+ attributes = attributes.each_with_object({}) { |(k, v), h|
104
+ if (!acceptable_attribute_map.key?(k.to_sym))
105
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LongThanhSdk::BusinessAddress`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
106
+ end
107
+ h[k.to_sym] = v
108
+ }
109
+
110
+ if attributes.key?(:'street_address')
111
+ self.street_address = attributes[:'street_address']
112
+ else
113
+ self.street_address = nil
114
+ end
115
+
116
+ if attributes.key?(:'postal_code')
117
+ self.postal_code = attributes[:'postal_code']
118
+ else
119
+ self.postal_code = nil
120
+ end
121
+
122
+ if attributes.key?(:'address_locality')
123
+ self.address_locality = attributes[:'address_locality']
124
+ else
125
+ self.address_locality = nil
126
+ end
127
+
128
+ if attributes.key?(:'address_country')
129
+ self.address_country = attributes[:'address_country']
130
+ else
131
+ self.address_country = nil
132
+ end
133
+ end
134
+
135
+ # Show invalid properties with the reasons. Usually used together with valid?
136
+ # @return Array for valid properties with the reasons
137
+ def list_invalid_properties
138
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
139
+ invalid_properties = Array.new
140
+ if @street_address.nil?
141
+ invalid_properties.push('invalid value for "street_address", street_address cannot be nil.')
142
+ end
143
+
144
+ if @postal_code.nil?
145
+ invalid_properties.push('invalid value for "postal_code", postal_code cannot be nil.')
146
+ end
147
+
148
+ if @address_locality.nil?
149
+ invalid_properties.push('invalid value for "address_locality", address_locality cannot be nil.')
150
+ end
151
+
152
+ if @address_country.nil?
153
+ invalid_properties.push('invalid value for "address_country", address_country cannot be nil.')
154
+ end
155
+
156
+ invalid_properties
157
+ end
158
+
159
+ # Check to see if the all the properties in the model are valid
160
+ # @return true if the model is valid
161
+ def valid?
162
+ warn '[DEPRECATED] the `valid?` method is obsolete'
163
+ return false if @street_address.nil?
164
+ return false if @postal_code.nil?
165
+ return false if @address_locality.nil?
166
+ return false if @address_country.nil?
167
+ address_country_validator = EnumAttributeValidator.new('String', ["DE"])
168
+ return false unless address_country_validator.valid?(@address_country)
169
+ true
170
+ end
171
+
172
+ # Custom attribute writer method with validation
173
+ # @param [Object] street_address Value to be assigned
174
+ def street_address=(street_address)
175
+ if street_address.nil?
176
+ fail ArgumentError, 'street_address cannot be nil'
177
+ end
178
+
179
+ @street_address = street_address
180
+ end
181
+
182
+ # Custom attribute writer method with validation
183
+ # @param [Object] postal_code Value to be assigned
184
+ def postal_code=(postal_code)
185
+ if postal_code.nil?
186
+ fail ArgumentError, 'postal_code cannot be nil'
187
+ end
188
+
189
+ @postal_code = postal_code
190
+ end
191
+
192
+ # Custom attribute writer method with validation
193
+ # @param [Object] address_locality Value to be assigned
194
+ def address_locality=(address_locality)
195
+ if address_locality.nil?
196
+ fail ArgumentError, 'address_locality cannot be nil'
197
+ end
198
+
199
+ @address_locality = address_locality
200
+ end
201
+
202
+ # Custom attribute writer method checking allowed values (enum).
203
+ # @param [Object] address_country Object to be assigned
204
+ def address_country=(address_country)
205
+ validator = EnumAttributeValidator.new('String', ["DE"])
206
+ unless validator.valid?(address_country)
207
+ fail ArgumentError, "invalid value for \"address_country\", must be one of #{validator.allowable_values}."
208
+ end
209
+ @address_country = address_country
210
+ end
211
+
212
+ # Checks equality by comparing each attribute.
213
+ # @param [Object] Object to be compared
214
+ def ==(o)
215
+ return true if self.equal?(o)
216
+ self.class == o.class &&
217
+ street_address == o.street_address &&
218
+ postal_code == o.postal_code &&
219
+ address_locality == o.address_locality &&
220
+ address_country == o.address_country
221
+ end
222
+
223
+ # @see the `==` method
224
+ # @param [Object] Object to be compared
225
+ def eql?(o)
226
+ self == o
227
+ end
228
+
229
+ # Calculates hash code according to all attributes.
230
+ # @return [Integer] Hash code
231
+ def hash
232
+ [street_address, postal_code, address_locality, address_country].hash
233
+ end
234
+
235
+ # Builds the object from hash
236
+ # @param [Hash] attributes Model attributes in the form of hash
237
+ # @return [Object] Returns the model itself
238
+ def self.build_from_hash(attributes)
239
+ return nil unless attributes.is_a?(Hash)
240
+ attributes = attributes.transform_keys(&:to_sym)
241
+ # include attributes inherited from allOf parents (the nearest declaration wins)
242
+ map = acceptable_attribute_map
243
+ transformed_hash = {}
244
+ acceptable_openapi_types.each_pair do |key, type|
245
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
246
+ transformed_hash["#{key}"] = nil
247
+ elsif type =~ /\AArray<(.*)>/i
248
+ # check to ensure the input is an array given that the attribute
249
+ # is documented as an array but the input is not
250
+ if attributes[map[key]].is_a?(Array)
251
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
252
+ end
253
+ elsif !attributes[map[key]].nil?
254
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
255
+ end
256
+ end
257
+ new(transformed_hash)
258
+ end
259
+
260
+ # Returns the object in the form of hash
261
+ # @return [Hash] Returns the object in the form of hash
262
+ def to_hash
263
+ hash = {}
264
+ # include attributes inherited from allOf parents (the nearest declaration wins)
265
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
266
+ value = self.send(attr)
267
+ if value.nil?
268
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
269
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
270
+ end
271
+
272
+ hash[param] = _to_hash(value)
273
+ end
274
+ hash
275
+ end
276
+
277
+ end
278
+
279
+ end