All http_"verb" (http_post) method calls use method missing in connection class which uses run_verb
# File lib/dm-rest-adapter/adapter.rb, line 7 def create(resources) resources.each do |resource| model = resource.model response = connection.http_post("#{resource_name(model)}", resource.to_xml) update_with_response(resource, response) end end
# File lib/dm-rest-adapter/adapter.rb, line 49 def delete(collection) collection.select do |resource| model = resource.model key = model.key id = key.get(resource).join response = connection.http_delete("#{resource_name(model)}/#{id}") response.kind_of?(Net::HTTPSuccess) end.size end
# File lib/dm-rest-adapter/adapter.rb, line 17 def read(query) model = query.model records = if id = extract_id_from_query(query) response = connection.http_get("#{resource_name(model)}/#{id}") [ parse_resource(response.body, model) ] else query_string = if (params = extract_params_from_query(query)).any? params.map { |k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join('&') end response = connection.http_get("#{resource_name(model)}#{'?' << query_string if query_string}") parse_resources(response.body, model) end query.filter_records(records) end
# File lib/dm-rest-adapter/adapter.rb, line 35 def update(dirty_attributes, collection) collection.select do |resource| model = resource.model key = model.key id = key.get(resource).join dirty_attributes.each { |p, v| p.set!(resource, v) } response = connection.http_put("#{resource_name(model)}/#{id}", resource.to_xml) update_with_response(resource, response) end.size end
Generated with the Darkfish Rdoc Generator 2.