Sha256: eb37038ea97690b9011af57dfbeac5835c9c41378a838a47f7174f7a777fff85
Contents?: true
Size: 663 Bytes
Versions: 7
Compression:
Stored size: 663 Bytes
Contents
module Restly::Base::Instance::Persistence def exists? return false unless id begin @response ||= connection.get(path, force: true) rescue OAuth2::Error => e @response = e.response end status = @response.status.to_i status < 300 && status >= 200 end def persisted? exists? && !changed? end def new_record? !exists? end def reload! raise Restly::Error::MissingId, "Cannot reload #{resource_name}, either it hasn't been created or it is missing an ID." unless id set_attributes_from_response connection.get(path, force: true) @loaded = true self end alias :load! :reload! end
Version data entries
7 entries across 7 versions & 1 rubygems