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,3 +1,4 @@
module {{moduleName}}
# base class containing fundamental method such as to_hash, build_from_hash and more # base class containing fundamental method such as to_hash, build_from_hash and more
class BaseObject class BaseObject
@ -47,13 +48,11 @@ class BaseObject
false false
end end
else # model else # model
_model = Object.const_get(type).new _model = {{moduleName}}.const_get(type).new
_model.build_from_hash(value) _model.build_from_hash(value)
end end
end end
# to_body is an alias to to_body (backward compatibility) # to_body is an alias to to_body (backward compatibility)
def to_hash def to_hash
hash = {} hash = {}
@ -81,3 +80,4 @@ class BaseObject
end end
end end
end

View File

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

View File

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