Class: Graphiti::OpenAPI::Relationships
- Inherits:
-
Hash
- Object
- Hash
- Graphiti::OpenAPI::Relationships
- Defined in:
- app/models/graphiti/open_api/relationship.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.load(resource, data = ) ⇒ Object
55 56 57 58 59 |
# File 'app/models/graphiti/open_api/relationship.rb', line 55 def self.load(resource, data = resource.__attributes__[:relationships]) data.each_with_object(new) do |(name, data), result| result[name] = Relationship.new(data.to_hash.merge(name: name, origin: resource)) end end |
Instance Method Details
#resources ⇒ Object
61 62 63 |
# File 'app/models/graphiti/open_api/relationship.rb', line 61 def resources values.map(&:resources).flatten.uniq.compact end |