Class: Unit::Types::Relationship
- Inherits:
-
Object
- Object
- Unit::Types::Relationship
- Defined in:
- lib/unit/types/relationship.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(id, type) ⇒ Relationship
constructor
A new instance of Relationship.
- #represent(nested: true) ⇒ Object
Constructor Details
#initialize(id, type) ⇒ Relationship
Returns a new instance of Relationship.
11 12 13 14 |
# File 'lib/unit/types/relationship.rb', line 11 def initialize(id, type) @id = id @type = type end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/unit/types/relationship.rb', line 7 def id @id end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/unit/types/relationship.rb', line 7 def type @type end |
Instance Method Details
#represent(nested: true) ⇒ Object
17 18 19 |
# File 'lib/unit/types/relationship.rb', line 17 def represent(nested: true) nested ? { "data": { "id": id, "type": type } } : { "id": id, "type": type } end |