Include base_object model into module structure

This commit is contained in:
xhh 2015-05-18 16:44:10 +08:00
parent f766614b4d
commit 6eaaa5cc69
3 changed files with 75 additions and 76 deletions

View File

@ -1,5 +1,6 @@
# base class containing fundamental method such as to_hash, build_from_hash and more
class BaseObject
module {{moduleName}}
# base class containing fundamental method such as to_hash, build_from_hash and more
class BaseObject
# return the object in the form of hash
def to_body
@ -47,13 +48,11 @@ class BaseObject
false
end
else # model
_model = Object.const_get(type).new
_model = {{moduleName}}.const_get(type).new
_model.build_from_hash(value)
end
end
# to_body is an alias to to_body (backward compatibility)
def to_hash
hash = {}
@ -80,4 +79,5 @@ class BaseObject
end
end
end
end

View File

@ -1,5 +1,3 @@
require_relative 'base_object'
module {{moduleName}}
{{#models}} # {{description}}
{{#model}} class {{classname}} < BaseObject

View File

@ -7,6 +7,7 @@ require '{{gemName}}/swagger/response'
require '{{gemName}}/swagger/version'
# Models
require '{{modelPackage}}/base_object'
{{#models}}
{{#model}}
require '{{importPath}}'