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,231 @@
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 MenuSection < ApiModelBase
18
+ attr_accessor :id
19
+
20
+ attr_accessor :name
21
+
22
+ attr_accessor :items
23
+
24
+ # Attribute mapping from ruby-style variable name to JSON key.
25
+ def self.attribute_map
26
+ {
27
+ :'id' => :'id',
28
+ :'name' => :'name',
29
+ :'items' => :'items'
30
+ }
31
+ end
32
+
33
+ # Returns attribute mapping this model knows about
34
+ def self.acceptable_attribute_map
35
+ attribute_map
36
+ end
37
+
38
+ # Returns all the JSON keys this model knows about
39
+ def self.acceptable_attributes
40
+ acceptable_attribute_map.values
41
+ end
42
+
43
+ # Attribute type mapping.
44
+ def self.openapi_types
45
+ {
46
+ :'id' => :'String',
47
+ :'name' => :'String',
48
+ :'items' => :'Array<MenuItem>'
49
+ }
50
+ end
51
+
52
+ # List of attributes with nullable: true
53
+ def self.openapi_nullable
54
+ Set.new([
55
+ ])
56
+ end
57
+
58
+ # Returns attribute type mapping
59
+ def self.acceptable_openapi_types
60
+ openapi_types
61
+ end
62
+
63
+ # Returns the nullable attributes
64
+ def self.acceptable_openapi_nullable
65
+ openapi_nullable
66
+ end
67
+
68
+ # Initializes the object
69
+ # @param [Hash] attributes Model attributes in the form of hash
70
+ def initialize(attributes = {})
71
+ if (!attributes.is_a?(Hash))
72
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LongThanhSdk::MenuSection` initialize method"
73
+ end
74
+
75
+ # check to see if the attribute exists and convert string to symbol for hash key
76
+ acceptable_attribute_map = self.class.acceptable_attribute_map
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!acceptable_attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LongThanhSdk::MenuSection`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'id')
85
+ self.id = attributes[:'id']
86
+ else
87
+ self.id = nil
88
+ end
89
+
90
+ if attributes.key?(:'name')
91
+ self.name = attributes[:'name']
92
+ else
93
+ self.name = nil
94
+ end
95
+
96
+ if attributes.key?(:'items')
97
+ if (value = attributes[:'items']).is_a?(Array)
98
+ self.items = value
99
+ end
100
+ else
101
+ self.items = nil
102
+ end
103
+ end
104
+
105
+ # Show invalid properties with the reasons. Usually used together with valid?
106
+ # @return Array for valid properties with the reasons
107
+ def list_invalid_properties
108
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
109
+ invalid_properties = Array.new
110
+ if @id.nil?
111
+ invalid_properties.push('invalid value for "id", id cannot be nil.')
112
+ end
113
+
114
+ if @name.nil?
115
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
116
+ end
117
+
118
+ if @items.nil?
119
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
120
+ end
121
+
122
+ invalid_properties
123
+ end
124
+
125
+ # Check to see if the all the properties in the model are valid
126
+ # @return true if the model is valid
127
+ def valid?
128
+ warn '[DEPRECATED] the `valid?` method is obsolete'
129
+ return false if @id.nil?
130
+ return false if @name.nil?
131
+ return false if @items.nil?
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] id Value to be assigned
137
+ def id=(id)
138
+ if id.nil?
139
+ fail ArgumentError, 'id cannot be nil'
140
+ end
141
+
142
+ @id = id
143
+ end
144
+
145
+ # Custom attribute writer method with validation
146
+ # @param [Object] name Value to be assigned
147
+ def name=(name)
148
+ if name.nil?
149
+ fail ArgumentError, 'name cannot be nil'
150
+ end
151
+
152
+ @name = name
153
+ end
154
+
155
+ # Custom attribute writer method with validation
156
+ # @param [Object] items Value to be assigned
157
+ def items=(items)
158
+ if items.nil?
159
+ fail ArgumentError, 'items cannot be nil'
160
+ end
161
+
162
+ @items = items
163
+ end
164
+
165
+ # Checks equality by comparing each attribute.
166
+ # @param [Object] Object to be compared
167
+ def ==(o)
168
+ return true if self.equal?(o)
169
+ self.class == o.class &&
170
+ id == o.id &&
171
+ name == o.name &&
172
+ items == o.items
173
+ end
174
+
175
+ # @see the `==` method
176
+ # @param [Object] Object to be compared
177
+ def eql?(o)
178
+ self == o
179
+ end
180
+
181
+ # Calculates hash code according to all attributes.
182
+ # @return [Integer] Hash code
183
+ def hash
184
+ [id, name, items].hash
185
+ end
186
+
187
+ # Builds the object from hash
188
+ # @param [Hash] attributes Model attributes in the form of hash
189
+ # @return [Object] Returns the model itself
190
+ def self.build_from_hash(attributes)
191
+ return nil unless attributes.is_a?(Hash)
192
+ attributes = attributes.transform_keys(&:to_sym)
193
+ # include attributes inherited from allOf parents (the nearest declaration wins)
194
+ map = acceptable_attribute_map
195
+ transformed_hash = {}
196
+ acceptable_openapi_types.each_pair do |key, type|
197
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
198
+ transformed_hash["#{key}"] = nil
199
+ elsif type =~ /\AArray<(.*)>/i
200
+ # check to ensure the input is an array given that the attribute
201
+ # is documented as an array but the input is not
202
+ if attributes[map[key]].is_a?(Array)
203
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
204
+ end
205
+ elsif !attributes[map[key]].nil?
206
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
207
+ end
208
+ end
209
+ new(transformed_hash)
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ # include attributes inherited from allOf parents (the nearest declaration wins)
217
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
218
+ value = self.send(attr)
219
+ if value.nil?
220
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
221
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
222
+ end
223
+
224
+ hash[param] = _to_hash(value)
225
+ end
226
+ hash
227
+ end
228
+
229
+ end
230
+
231
+ end
@@ -0,0 +1,362 @@
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
+ # RFC 9457 problem details with code and resolution extension members. status matches the HTTP status.
18
+ class Problem < ApiModelBase
19
+ attr_accessor :type
20
+
21
+ attr_accessor :title
22
+
23
+ attr_accessor :status
24
+
25
+ attr_accessor :detail
26
+
27
+ attr_accessor :code
28
+
29
+ attr_accessor :resolution
30
+
31
+ # Requested path. Query values are omitted.
32
+ attr_accessor :instance
33
+
34
+ class EnumAttributeValidator
35
+ attr_reader :datatype
36
+ attr_reader :allowable_values
37
+
38
+ def initialize(datatype, allowable_values)
39
+ @allowable_values = allowable_values.map do |value|
40
+ case datatype.to_s
41
+ when /Integer/i
42
+ value.to_i
43
+ when /Float/i
44
+ value.to_f
45
+ else
46
+ value
47
+ end
48
+ end
49
+ end
50
+
51
+ def valid?(value)
52
+ !value || allowable_values.include?(value)
53
+ end
54
+ end
55
+
56
+ # Attribute mapping from ruby-style variable name to JSON key.
57
+ def self.attribute_map
58
+ {
59
+ :'type' => :'type',
60
+ :'title' => :'title',
61
+ :'status' => :'status',
62
+ :'detail' => :'detail',
63
+ :'code' => :'code',
64
+ :'resolution' => :'resolution',
65
+ :'instance' => :'instance'
66
+ }
67
+ end
68
+
69
+ # Returns attribute mapping this model knows about
70
+ def self.acceptable_attribute_map
71
+ attribute_map
72
+ end
73
+
74
+ # Returns all the JSON keys this model knows about
75
+ def self.acceptable_attributes
76
+ acceptable_attribute_map.values
77
+ end
78
+
79
+ # Attribute type mapping.
80
+ def self.openapi_types
81
+ {
82
+ :'type' => :'String',
83
+ :'title' => :'String',
84
+ :'status' => :'Integer',
85
+ :'detail' => :'String',
86
+ :'code' => :'String',
87
+ :'resolution' => :'String',
88
+ :'instance' => :'String'
89
+ }
90
+ end
91
+
92
+ # List of attributes with nullable: true
93
+ def self.openapi_nullable
94
+ Set.new([
95
+ ])
96
+ end
97
+
98
+ # Returns attribute type mapping
99
+ def self.acceptable_openapi_types
100
+ openapi_types
101
+ end
102
+
103
+ # Returns the nullable attributes
104
+ def self.acceptable_openapi_nullable
105
+ openapi_nullable
106
+ end
107
+
108
+ # Initializes the object
109
+ # @param [Hash] attributes Model attributes in the form of hash
110
+ def initialize(attributes = {})
111
+ if (!attributes.is_a?(Hash))
112
+ fail ArgumentError, "The input argument (attributes) must be a hash in `LongThanhSdk::Problem` initialize method"
113
+ end
114
+
115
+ # check to see if the attribute exists and convert string to symbol for hash key
116
+ acceptable_attribute_map = self.class.acceptable_attribute_map
117
+ attributes = attributes.each_with_object({}) { |(k, v), h|
118
+ if (!acceptable_attribute_map.key?(k.to_sym))
119
+ fail ArgumentError, "`#{k}` is not a valid attribute in `LongThanhSdk::Problem`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
120
+ end
121
+ h[k.to_sym] = v
122
+ }
123
+
124
+ if attributes.key?(:'type')
125
+ self.type = attributes[:'type']
126
+ else
127
+ self.type = nil
128
+ end
129
+
130
+ if attributes.key?(:'title')
131
+ self.title = attributes[:'title']
132
+ else
133
+ self.title = nil
134
+ end
135
+
136
+ if attributes.key?(:'status')
137
+ self.status = attributes[:'status']
138
+ else
139
+ self.status = nil
140
+ end
141
+
142
+ if attributes.key?(:'detail')
143
+ self.detail = attributes[:'detail']
144
+ else
145
+ self.detail = nil
146
+ end
147
+
148
+ if attributes.key?(:'code')
149
+ self.code = attributes[:'code']
150
+ else
151
+ self.code = nil
152
+ end
153
+
154
+ if attributes.key?(:'resolution')
155
+ self.resolution = attributes[:'resolution']
156
+ else
157
+ self.resolution = nil
158
+ end
159
+
160
+ if attributes.key?(:'instance')
161
+ self.instance = attributes[:'instance']
162
+ end
163
+ end
164
+
165
+ # Show invalid properties with the reasons. Usually used together with valid?
166
+ # @return Array for valid properties with the reasons
167
+ def list_invalid_properties
168
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
169
+ invalid_properties = Array.new
170
+ if @type.nil?
171
+ invalid_properties.push('invalid value for "type", type cannot be nil.')
172
+ end
173
+
174
+ if @title.nil?
175
+ invalid_properties.push('invalid value for "title", title cannot be nil.')
176
+ end
177
+
178
+ if @status.nil?
179
+ invalid_properties.push('invalid value for "status", status cannot be nil.')
180
+ end
181
+
182
+ if @status > 599
183
+ invalid_properties.push('invalid value for "status", must be smaller than or equal to 599.')
184
+ end
185
+
186
+ if @status < 400
187
+ invalid_properties.push('invalid value for "status", must be greater than or equal to 400.')
188
+ end
189
+
190
+ if @detail.nil?
191
+ invalid_properties.push('invalid value for "detail", detail cannot be nil.')
192
+ end
193
+
194
+ if @code.nil?
195
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
196
+ end
197
+
198
+ if @resolution.nil?
199
+ invalid_properties.push('invalid value for "resolution", resolution cannot be nil.')
200
+ end
201
+
202
+ invalid_properties
203
+ end
204
+
205
+ # Check to see if the all the properties in the model are valid
206
+ # @return true if the model is valid
207
+ def valid?
208
+ warn '[DEPRECATED] the `valid?` method is obsolete'
209
+ return false if @type.nil?
210
+ type_validator = EnumAttributeValidator.new('String', ["about:blank"])
211
+ return false unless type_validator.valid?(@type)
212
+ return false if @title.nil?
213
+ return false if @status.nil?
214
+ return false if @status > 599
215
+ return false if @status < 400
216
+ return false if @detail.nil?
217
+ return false if @code.nil?
218
+ code_validator = EnumAttributeValidator.new('String', ["INVALID_PARAMETER", "NOT_FOUND", "METHOD_NOT_ALLOWED", "RATE_LIMITED", "INTERNAL_ERROR", "SERVICE_UNAVAILABLE", "INVALID_REQUEST", "FORBIDDEN", "PAYLOAD_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE"])
219
+ return false unless code_validator.valid?(@code)
220
+ return false if @resolution.nil?
221
+ true
222
+ end
223
+
224
+ # Custom attribute writer method checking allowed values (enum).
225
+ # @param [Object] type Object to be assigned
226
+ def type=(type)
227
+ validator = EnumAttributeValidator.new('String', ["about:blank"])
228
+ unless validator.valid?(type)
229
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
230
+ end
231
+ @type = type
232
+ end
233
+
234
+ # Custom attribute writer method with validation
235
+ # @param [Object] title Value to be assigned
236
+ def title=(title)
237
+ if title.nil?
238
+ fail ArgumentError, 'title cannot be nil'
239
+ end
240
+
241
+ @title = title
242
+ end
243
+
244
+ # Custom attribute writer method with validation
245
+ # @param [Object] status Value to be assigned
246
+ def status=(status)
247
+ if status.nil?
248
+ fail ArgumentError, 'status cannot be nil'
249
+ end
250
+
251
+ if status > 599
252
+ fail ArgumentError, 'invalid value for "status", must be smaller than or equal to 599.'
253
+ end
254
+
255
+ if status < 400
256
+ fail ArgumentError, 'invalid value for "status", must be greater than or equal to 400.'
257
+ end
258
+
259
+ @status = status
260
+ end
261
+
262
+ # Custom attribute writer method with validation
263
+ # @param [Object] detail Value to be assigned
264
+ def detail=(detail)
265
+ if detail.nil?
266
+ fail ArgumentError, 'detail cannot be nil'
267
+ end
268
+
269
+ @detail = detail
270
+ end
271
+
272
+ # Custom attribute writer method checking allowed values (enum).
273
+ # @param [Object] code Object to be assigned
274
+ def code=(code)
275
+ validator = EnumAttributeValidator.new('String', ["INVALID_PARAMETER", "NOT_FOUND", "METHOD_NOT_ALLOWED", "RATE_LIMITED", "INTERNAL_ERROR", "SERVICE_UNAVAILABLE", "INVALID_REQUEST", "FORBIDDEN", "PAYLOAD_TOO_LARGE", "UNSUPPORTED_MEDIA_TYPE"])
276
+ unless validator.valid?(code)
277
+ fail ArgumentError, "invalid value for \"code\", must be one of #{validator.allowable_values}."
278
+ end
279
+ @code = code
280
+ end
281
+
282
+ # Custom attribute writer method with validation
283
+ # @param [Object] resolution Value to be assigned
284
+ def resolution=(resolution)
285
+ if resolution.nil?
286
+ fail ArgumentError, 'resolution cannot be nil'
287
+ end
288
+
289
+ @resolution = resolution
290
+ end
291
+
292
+ # Checks equality by comparing each attribute.
293
+ # @param [Object] Object to be compared
294
+ def ==(o)
295
+ return true if self.equal?(o)
296
+ self.class == o.class &&
297
+ type == o.type &&
298
+ title == o.title &&
299
+ status == o.status &&
300
+ detail == o.detail &&
301
+ code == o.code &&
302
+ resolution == o.resolution &&
303
+ instance == o.instance
304
+ end
305
+
306
+ # @see the `==` method
307
+ # @param [Object] Object to be compared
308
+ def eql?(o)
309
+ self == o
310
+ end
311
+
312
+ # Calculates hash code according to all attributes.
313
+ # @return [Integer] Hash code
314
+ def hash
315
+ [type, title, status, detail, code, resolution, instance].hash
316
+ end
317
+
318
+ # Builds the object from hash
319
+ # @param [Hash] attributes Model attributes in the form of hash
320
+ # @return [Object] Returns the model itself
321
+ def self.build_from_hash(attributes)
322
+ return nil unless attributes.is_a?(Hash)
323
+ attributes = attributes.transform_keys(&:to_sym)
324
+ # include attributes inherited from allOf parents (the nearest declaration wins)
325
+ map = acceptable_attribute_map
326
+ transformed_hash = {}
327
+ acceptable_openapi_types.each_pair do |key, type|
328
+ if attributes.key?(map[key]) && attributes[map[key]].nil?
329
+ transformed_hash["#{key}"] = nil
330
+ elsif type =~ /\AArray<(.*)>/i
331
+ # check to ensure the input is an array given that the attribute
332
+ # is documented as an array but the input is not
333
+ if attributes[map[key]].is_a?(Array)
334
+ transformed_hash["#{key}"] = attributes[map[key]].map { |v| _deserialize($1, v) }
335
+ end
336
+ elsif !attributes[map[key]].nil?
337
+ transformed_hash["#{key}"] = _deserialize(type, attributes[map[key]])
338
+ end
339
+ end
340
+ new(transformed_hash)
341
+ end
342
+
343
+ # Returns the object in the form of hash
344
+ # @return [Hash] Returns the object in the form of hash
345
+ def to_hash
346
+ hash = {}
347
+ # include attributes inherited from allOf parents (the nearest declaration wins)
348
+ self.class.acceptable_attribute_map.each_pair do |attr, param|
349
+ value = self.send(attr)
350
+ if value.nil?
351
+ is_nullable = self.class.acceptable_openapi_nullable.include?(attr)
352
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
353
+ end
354
+
355
+ hash[param] = _to_hash(value)
356
+ end
357
+ hash
358
+ end
359
+
360
+ end
361
+
362
+ end
@@ -0,0 +1,15 @@
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
+ module LongThanhSdk
14
+ VERSION = '0.1.0'
15
+ end
@@ -0,0 +1,49 @@
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
+ # Common files
14
+ require 'long_thanh_sdk/api_client'
15
+ require 'long_thanh_sdk/api_error'
16
+ require 'long_thanh_sdk/api_model_base'
17
+ require 'long_thanh_sdk/version'
18
+ require 'long_thanh_sdk/configuration'
19
+
20
+ # Models
21
+ require 'long_thanh_sdk/models/business'
22
+ require 'long_thanh_sdk/models/business_address'
23
+ require 'long_thanh_sdk/models/business_opening_hours'
24
+ require 'long_thanh_sdk/models/business_ordering'
25
+ require 'long_thanh_sdk/models/menu'
26
+ require 'long_thanh_sdk/models/menu_item'
27
+ require 'long_thanh_sdk/models/menu_section'
28
+ require 'long_thanh_sdk/models/problem'
29
+
30
+ # APIs
31
+ require 'long_thanh_sdk/api/default_api'
32
+
33
+ module LongThanhSdk
34
+ class << self
35
+ # Customize default settings for the SDK using block.
36
+ # LongThanhSdk.configure do |config|
37
+ # config.username = "xxx"
38
+ # config.password = "xxx"
39
+ # end
40
+ # If no block given, return the default Configuration object.
41
+ def configure
42
+ if block_given?
43
+ yield(Configuration.default)
44
+ else
45
+ Configuration.default
46
+ end
47
+ end
48
+ end
49
+ end