Class: Unit::Types::Relationship

Inherits:
Object
  • Object
show all
Defined in:
lib/unit/types/relationship.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, id) ⇒ Relationship

Returns a new instance of Relationship.

Parameters:

  • id (String)

    The id of the relationship

  • type (String)

    The type



11
12
13
14
# File 'lib/unit/types/relationship.rb', line 11

def initialize(type, id)
  @type = type
  @id = id
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/unit/types/relationship.rb', line 7

def id
  @id
end

#typeObject

Returns the value of attribute type.



7
8
9
# File 'lib/unit/types/relationship.rb', line 7

def type
  @type
end

Instance Method Details

#to_hashObject



16
17
18
# File 'lib/unit/types/relationship.rb', line 16

def to_hash
  { "data": { "type": type, "id": id } }
end