Improve model class of ruby-client (#1670)

* Add Model.build_from_hash

* Use Model.build_from_hash instead of Model.new.build_from_hash

* Update sample for ruby-client

* Update sample for openapi3 ruby-client
This commit is contained in:
meganemura 2018-12-15 17:24:03 +09:00 committed by William Cheng
parent cacce1f707
commit 82fcde1d91
76 changed files with 581 additions and 148 deletions

View File

@ -204,9 +204,7 @@ module {{moduleName}}
end end
else else
# models, e.g. Pet # models, e.g. Pet
{{moduleName}}.const_get(return_type).new.tap do |model| {{moduleName}}.const_get(return_type).build_from_hash(data)
model.build_from_hash data
end
end end
end end

View File

@ -1,3 +1,10 @@
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -58,8 +65,7 @@
end end
end end
else # model else # model
temp_model = {{moduleName}}.const_get(type).new {{moduleName}}.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -2,6 +2,13 @@
{{#allowableValues}}{{#enumVars}} {{#allowableValues}}{{#enumVars}}
{{{name}}} = {{{value}}}.freeze{{/enumVars}}{{/allowableValues}} {{{name}}} = {{{value}}}.freeze{{/enumVars}}{{/allowableValues}}
# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def self.build_from_hash(value)
new.build_from_hash(value)
end
# Builds the enum from string # Builds the enum from string
# @param [String] The enum value in the form of the string # @param [String] The enum value in the form of the string
# @return [String] The enum value # @return [String] The enum value
@ -10,4 +17,4 @@
raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty? raise "Invalid ENUM value #{value} for class #{{{classname}}}" if constantValues.empty?
value value
end end
end end

View File

@ -239,8 +239,7 @@
{{#-first}} {{#-first}}
_any_of_found = false _any_of_found = false
openapi_any_of.each do |_class| openapi_any_of.each do |_class|
_any_of = {{moduleName}}.const_get(_class).new _any_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash)
_any_of.build_from_hash(self.to_hash)
if _any_of.valid? if _any_of.valid?
_any_of_found = true _any_of_found = true
end end
@ -256,8 +255,7 @@
{{#-first}} {{#-first}}
_one_of_found = false _one_of_found = false
openapi_one_of.each do |_class| openapi_one_of.each do |_class|
_one_of = {{moduleName}}.const_get(_class).new _one_of = {{moduleName}}.const_get(_class).build_from_hash(self.to_hash)
_one_of.build_from_hash(self.to_hash)
if _one_of.valid? if _one_of.valid?
if _one_of_found? if _one_of_found?
return false return false

View File

@ -210,9 +210,7 @@ module Petstore
end end
else else
# models, e.g. Pet # models, e.g. Pet
Petstore.const_get(return_type).new.tap do |model| Petstore.const_get(return_type).build_from_hash(data)
model.build_from_hash data
end
end end
end end

View File

@ -89,6 +89,13 @@ module Petstore
[map_property, map_of_map_property].hash [map_property, map_of_map_property].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -146,8 +153,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -97,6 +97,13 @@ module Petstore
[class_name, color].hash [class_name, color].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -154,8 +161,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -94,6 +94,13 @@ module Petstore
[code, type, message].hash [code, type, message].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -151,8 +158,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -78,6 +78,13 @@ module Petstore
[array_array_number].hash [array_array_number].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -135,8 +142,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -78,6 +78,13 @@ module Petstore
[array_number].hash [array_number].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -135,8 +142,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -100,6 +100,13 @@ module Petstore
[array_of_string, array_array_of_integer, array_array_of_model].hash [array_of_string, array_array_of_integer, array_array_of_model].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -157,8 +164,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -122,6 +122,13 @@ module Petstore
[small_camel, capital_camel, small_snake, capital_snake, sca_eth_flow_points, att_name].hash [small_camel, capital_camel, small_snake, capital_snake, sca_eth_flow_points, att_name].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -179,8 +186,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -86,6 +86,13 @@ module Petstore
[declawed].hash [declawed].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -144,8 +151,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -92,6 +92,13 @@ module Petstore
[id, name].hash [id, name].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -149,8 +156,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -77,6 +77,13 @@ module Petstore
[_class].hash [_class].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -134,8 +141,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[client].hash [client].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -86,6 +86,13 @@ module Petstore
[breed].hash [breed].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -144,8 +151,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -121,6 +121,13 @@ module Petstore
[just_symbol, array_enum].hash [just_symbol, array_enum].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -178,8 +185,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -19,6 +19,13 @@ module Petstore
EFG = '-efg'.freeze EFG = '-efg'.freeze
XYZ = '(xyz)'.freeze XYZ = '(xyz)'.freeze
# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def self.build_from_hash(value)
new.build_from_hash(value)
end
# Builds the enum from string # Builds the enum from string
# @param [String] The enum value in the form of the string # @param [String] The enum value in the form of the string
# @return [String] The enum value # @return [String] The enum value
@ -28,4 +35,5 @@ module Petstore
value value
end end
end end
end end

View File

@ -187,6 +187,13 @@ module Petstore
[enum_string, enum_string_required, enum_integer, enum_number, outer_enum].hash [enum_string, enum_string_required, enum_integer, enum_number, outer_enum].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -244,8 +251,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -78,6 +78,13 @@ module Petstore
[source_uri].hash [source_uri].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -135,8 +142,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -87,6 +87,13 @@ module Petstore
[file, files].hash [file, files].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -144,8 +151,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -390,6 +390,13 @@ module Petstore
[integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password].hash [integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -447,8 +454,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -85,6 +85,13 @@ module Petstore
[bar, foo].hash [bar, foo].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -142,8 +149,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[_123_list].hash [_123_list].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -133,6 +133,13 @@ module Petstore
[map_map_of_string, map_of_enum_string, direct_map, indirect_map].hash [map_map_of_string, map_of_enum_string, direct_map, indirect_map].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -190,8 +197,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -96,6 +96,13 @@ module Petstore
[uuid, date_time, map].hash [uuid, date_time, map].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -153,8 +160,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -86,6 +86,13 @@ module Petstore
[name, _class].hash [name, _class].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -143,8 +150,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -77,6 +77,13 @@ module Petstore
[_return].hash [_return].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -134,8 +141,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -109,6 +109,13 @@ module Petstore
[name, snake_case, property, _123_number].hash [name, snake_case, property, _123_number].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -166,8 +173,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[just_number].hash [just_number].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -158,6 +158,13 @@ module Petstore
[id, pet_id, quantity, ship_date, status, complete].hash [id, pet_id, quantity, ship_date, status, complete].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -215,8 +222,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -94,6 +94,13 @@ module Petstore
[my_number, my_string, my_boolean].hash [my_number, my_string, my_boolean].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -151,8 +158,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -19,6 +19,13 @@ module Petstore
APPROVED = 'approved'.freeze APPROVED = 'approved'.freeze
DELIVERED = 'delivered'.freeze DELIVERED = 'delivered'.freeze
# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def self.build_from_hash(value)
new.build_from_hash(value)
end
# Builds the enum from string # Builds the enum from string
# @param [String] The enum value in the form of the string # @param [String] The enum value in the form of the string
# @return [String] The enum value # @return [String] The enum value
@ -28,4 +35,5 @@ module Petstore
value value
end end
end end
end end

View File

@ -170,6 +170,13 @@ module Petstore
[id, category, name, photo_urls, tags, status].hash [id, category, name, photo_urls, tags, status].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -227,8 +234,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -85,6 +85,13 @@ module Petstore
[bar, baz].hash [bar, baz].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -142,8 +149,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[special_property_name].hash [special_property_name].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -85,6 +85,13 @@ module Petstore
[id, name].hash [id, name].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -142,8 +149,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -140,6 +140,13 @@ module Petstore
[id, username, first_name, last_name, email, password, phone, user_status].hash [id, username, first_name, last_name, email, password, phone, user_status].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -197,8 +204,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -210,9 +210,7 @@ module Petstore
end end
else else
# models, e.g. Pet # models, e.g. Pet
Petstore.const_get(return_type).new.tap do |model| Petstore.const_get(return_type).build_from_hash(data)
model.build_from_hash data
end
end end
end end

View File

@ -89,6 +89,13 @@ module Petstore
[map_property, map_of_map_property].hash [map_property, map_of_map_property].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -146,8 +153,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -97,6 +97,13 @@ module Petstore
[class_name, color].hash [class_name, color].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -154,8 +161,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -94,6 +94,13 @@ module Petstore
[code, type, message].hash [code, type, message].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -151,8 +158,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -78,6 +78,13 @@ module Petstore
[array_array_number].hash [array_array_number].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -135,8 +142,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -78,6 +78,13 @@ module Petstore
[array_number].hash [array_number].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -135,8 +142,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -100,6 +100,13 @@ module Petstore
[array_of_string, array_array_of_integer, array_array_of_model].hash [array_of_string, array_array_of_integer, array_array_of_model].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -157,8 +164,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -122,6 +122,13 @@ module Petstore
[small_camel, capital_camel, small_snake, capital_snake, sca_eth_flow_points, att_name].hash [small_camel, capital_camel, small_snake, capital_snake, sca_eth_flow_points, att_name].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -179,8 +186,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -86,6 +86,13 @@ module Petstore
[declawed].hash [declawed].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -144,8 +151,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -92,6 +92,13 @@ module Petstore
[id, name].hash [id, name].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -149,8 +156,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -77,6 +77,13 @@ module Petstore
[_class].hash [_class].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -134,8 +141,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[client].hash [client].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -86,6 +86,13 @@ module Petstore
[breed].hash [breed].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -144,8 +151,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -121,6 +121,13 @@ module Petstore
[just_symbol, array_enum].hash [just_symbol, array_enum].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -178,8 +185,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -19,6 +19,13 @@ module Petstore
EFG = '-efg'.freeze EFG = '-efg'.freeze
XYZ = '(xyz)'.freeze XYZ = '(xyz)'.freeze
# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def self.build_from_hash(value)
new.build_from_hash(value)
end
# Builds the enum from string # Builds the enum from string
# @param [String] The enum value in the form of the string # @param [String] The enum value in the form of the string
# @return [String] The enum value # @return [String] The enum value
@ -28,4 +35,5 @@ module Petstore
value value
end end
end end
end end

View File

@ -187,6 +187,13 @@ module Petstore
[enum_string, enum_string_required, enum_integer, enum_number, outer_enum].hash [enum_string, enum_string_required, enum_integer, enum_number, outer_enum].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -244,8 +251,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -78,6 +78,13 @@ module Petstore
[source_uri].hash [source_uri].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -135,8 +142,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -87,6 +87,13 @@ module Petstore
[file, files].hash [file, files].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -144,8 +151,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -78,6 +78,13 @@ module Petstore
[bar].hash [bar].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -135,8 +142,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -421,6 +421,13 @@ module Petstore
[integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password, pattern_with_digits, pattern_with_digits_and_delimiter].hash [integer, int32, int64, number, float, double, string, byte, binary, date, date_time, uuid, password, pattern_with_digits, pattern_with_digits_and_delimiter].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -478,8 +485,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -85,6 +85,13 @@ module Petstore
[bar, foo].hash [bar, foo].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -142,8 +149,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[string].hash [string].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[_123_list].hash [_123_list].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -133,6 +133,13 @@ module Petstore
[map_map_of_string, map_of_enum_string, direct_map, indirect_map].hash [map_map_of_string, map_of_enum_string, direct_map, indirect_map].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -190,8 +197,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -96,6 +96,13 @@ module Petstore
[uuid, date_time, map].hash [uuid, date_time, map].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -153,8 +160,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -86,6 +86,13 @@ module Petstore
[name, _class].hash [name, _class].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -143,8 +150,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -77,6 +77,13 @@ module Petstore
[_return].hash [_return].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -134,8 +141,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -109,6 +109,13 @@ module Petstore
[name, snake_case, property, _123_number].hash [name, snake_case, property, _123_number].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -166,8 +173,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[just_number].hash [just_number].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -158,6 +158,13 @@ module Petstore
[id, pet_id, quantity, ship_date, status, complete].hash [id, pet_id, quantity, ship_date, status, complete].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -215,8 +222,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -94,6 +94,13 @@ module Petstore
[my_number, my_string, my_boolean].hash [my_number, my_string, my_boolean].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -151,8 +158,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -19,6 +19,13 @@ module Petstore
APPROVED = 'approved'.freeze APPROVED = 'approved'.freeze
DELIVERED = 'delivered'.freeze DELIVERED = 'delivered'.freeze
# Builds the enum from string
# @param [String] The enum value in the form of the string
# @return [String] The enum value
def self.build_from_hash(value)
new.build_from_hash(value)
end
# Builds the enum from string # Builds the enum from string
# @param [String] The enum value in the form of the string # @param [String] The enum value in the form of the string
# @return [String] The enum value # @return [String] The enum value
@ -28,4 +35,5 @@ module Petstore
value value
end end
end end
end end

View File

@ -170,6 +170,13 @@ module Petstore
[id, category, name, photo_urls, tags, status].hash [id, category, name, photo_urls, tags, status].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -227,8 +234,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -85,6 +85,13 @@ module Petstore
[bar, baz].hash [bar, baz].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -142,8 +149,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -76,6 +76,13 @@ module Petstore
[special_property_name].hash [special_property_name].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -133,8 +140,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -85,6 +85,13 @@ module Petstore
[id, name].hash [id, name].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -142,8 +149,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end

View File

@ -140,6 +140,13 @@ module Petstore
[id, username, first_name, last_name, email, password, phone, user_status].hash [id, username, first_name, last_name, email, password, phone, user_status].hash
end end
# Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself
def self.build_from_hash(attributes)
new.build_from_hash(attributes)
end
# Builds the object from hash # Builds the object from hash
# @param [Hash] attributes Model attributes in the form of hash # @param [Hash] attributes Model attributes in the form of hash
# @return [Object] Returns the model itself # @return [Object] Returns the model itself
@ -197,8 +204,7 @@ module Petstore
end end
end end
else # model else # model
temp_model = Petstore.const_get(type).new Petstore.const_get(type).build_from_hash(value)
temp_model.build_from_hash(value)
end end
end end