All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ruby.model.mustache Maven / Gradle / Ivy

module {{moduleName}}
{{#models}}  # {{description}}
{{#model}}  class {{classname}} < BaseObject
    attr_accessor {{#vars}}:{{{name}}}{{#hasMore}}, {{/hasMore}}{{/vars}}{{newline}}
    # attribute mapping from ruby-style variable name to JSON key
    def self.attribute_map
      {
        {{#vars}}
        # {{description}}
        :'{{{name}}}' => :'{{{baseName}}}'{{#hasMore}},{{/hasMore}}
        {{/vars}}
      }
    end

    # attribute type
    def self.swagger_types
      {
        {{#vars}}:'{{{name}}}' => :'{{{datatype}}}'{{#hasMore}},{{/hasMore}}
        {{/vars}}
      }
    end

    def initialize(attributes = {})
      return if !attributes.is_a?(Hash) || attributes.empty?

      # convert string to symbol for hash key
      attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}

      {{#vars}}
      if attributes[:'{{{baseName}}}']
        {{#isContainer}}if (value = attributes[:'{{{baseName}}}']).is_a?(Array)
          @{{{name}}} = value
        end{{/isContainer}}{{^isContainer}}@{{{name}}} = attributes[:'{{{baseName}}}']{{/isContainer}}
      end
      {{/vars}}
    end
  end
{{/model}}
{{/models}}
end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy