Class: FolderSerializer

Inherits:
Object
  • Object
show all
Defined in:
lib/serializers/folder_serializer.rb

Class Method Summary collapse

Class Method Details

.from_json(json) ⇒ Object



5
6
7
8
9
10
# File 'lib/serializers/folder_serializer.rb', line 5

def from_json(json)
  json = JSON.parse(json, symbolize_names: true)
  data = json[:data] || json
  attributes = data[:attributes]
  Folder.new(name: attributes[:name], id: data[:id])
end