Method: Jacoat::Document::ResourceIdentifier.from_jsonapi
- Defined in:
- lib/jacoat/document/resource_identifier.rb
.from_jsonapi(body) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/jacoat/document/resource_identifier.rb', line 5 def self.from_jsonapi(body) if body.is_a?(Array) resources = [] body.each do |item| resources << ResourceIdentifier.new(item[:id], item[:type]).process_jsonapi(item) end else resources = ResourceIdentifier.new(body[:id], body[:type]).process_jsonapi(body) end resources end |