module ONEAccess::Serializable

Public Instance Methods

from_json(json) click to toggle source
# File lib/oneaccess/serializable.rb, line 9
def from_json(json)
  if collection?
    collection = []
    @representer_class.new(collection).from_json(json)
    collection
  else
    obj = new
    @representer_class.new(obj).from_json(json)
    obj
  end
end
represented_by(representer_class) click to toggle source
# File lib/oneaccess/serializable.rb, line 5
def represented_by(representer_class)
  @representer_class = representer_class
end

Private Instance Methods

collection?() click to toggle source
# File lib/oneaccess/serializable.rb, line 23
def collection?
  false
end