Module: RemoteResource::Builder

Extended by:
ActiveSupport::Concern
Defined in:
lib/remote_resource/builder.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#rebuild_resource(collection, response_hash = {}) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/remote_resource/builder.rb', line 38

def rebuild_resource(collection, response_hash = {})
  if collection.is_a? Hash
    self.attributes = collection.merge(response_hash)
  else
    self.attributes = response_hash
  end and self
end

#rebuild_resource_from_response(response) ⇒ Object



34
35
36
# File 'lib/remote_resource/builder.rb', line 34

def rebuild_resource_from_response(response)
  rebuild_resource response.sanitized_response_body, response_hash(response)
end