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