Class: SwaggerModel::SwaggerV2::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger_model/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Relation

Returns a new instance of Relation.



8
9
10
# File 'lib/swagger_model/relation.rb', line 8

def initialize(hash)
  @type = hash['type']
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/swagger_model/relation.rb', line 7

def type
  @type
end

Instance Method Details

#to_swagger_hashObject



12
13
14
15
16
17
# File 'lib/swagger_model/relation.rb', line 12

def to_swagger_hash
  model_name = ActiveSupport::Inflector.classify(@type.gsub('-', '_'))
  {
      '$ref' => "#/definitions/#{model_name}"
  }
end