Method: StorageRoom::Accessors::ClassMethods#new_from_response_data

Defined in:
lib/storage_room/accessors.rb

#new_from_response_data(response_data) ⇒ Object

Creates a new object of the correct class and initializes it from the response data



42
43
44
45
46
47
48
49
50
51
# File 'lib/storage_room/accessors.rb', line 42

def new_from_response_data(response_data)
  object = StorageRoom.class_for_name(response_data['@type']).new.set_from_response_data(response_data)

  if object.is_a?(Entry) && !object.loaded? && !object.proxy?
    StorageRoom.log("Return  #{response_data['url']} proxied")
    Proxy.new(object)
  else
    object
  end
end