Class: SwaggerModel::SwaggerV2::RelationData

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ RelationData

Returns a new instance of RelationData.



5
6
7
# File 'lib/swagger_model/relation_data.rb', line 5

def initialize(hash)
  @relation = Relation.new(hash)
end

Instance Attribute Details

#relationObject

Returns the value of attribute relation.



4
5
6
# File 'lib/swagger_model/relation_data.rb', line 4

def relation
  @relation
end

Instance Method Details

#to_swagger_hash(key, parent_name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/swagger_model/relation_data.rb', line 9

def to_swagger_hash(key, parent_name)
  name = parent_name + ActiveSupport::Inflector.classify(key.gsub('-', '_')) + 'Data'
  {
    name => {
      'type' => 'object',
      'properties' => {
        'data' => @relation.to_swagger_hash
      }
    }
  }
end