Permalink
Browse files

Add CRUD to readme.

  • Loading branch information...
ejholmes committed Mar 23, 2012
1 parent f94c5b4 commit a75a5c0be081948d9efb9e7f5e14deb6463be1f0
Showing with 17 additions and 4 deletions.
  1. +9 −0 README.md
  2. +6 −2 lib/metaforce/metadata/crud.rb
  3. +2 −2 spec/lib/metadata/crud_spec.rb
View
@@ -34,6 +34,15 @@ deployment.result
# Retrieve the metadata components specified in package.xml and unzip to the "retrieved" directory
client.retrieve(File.expand_path('path/to/package.xml')).to('retrieved')
+
+# Create a Visualforce page
+client.create_apex_page(:full_name => 'TestPage', :label => 'TestPage')
+
+# Update a Visualforce page
+client.update_apex_page('OldName', :full_name => 'NewName')
+
+# Delete a Visualforce page
+client.delete_apex_page('TestPage')
```
## Roadmap
@@ -48,8 +48,12 @@ def update(type, current_name, metadata={})
# == Examples
#
# client.delete(:apex_page, :full_name => 'TestPage')
- def delete(type, metadata={})
- metadata = [metadata] unless metadata.is_a?(Array)
+ def delete(type, full_name)
+ full_name = [full_name] unless full_name.is_a?(Array)
+ metadata = []
+ full_name.each do |f|
+ metadata << { :full_name => f }
+ end
type = type.to_s.camelcase
response = @client.request(:delete) do |soap|
soap.header = @header
@@ -36,14 +36,14 @@
it "returns a transaction" do
savon.expects(:delete).with(:metadata => [{:full_name => 'component'}], :attributes! => {'ins0:metadata' => {'xsi:type' => 'wsdl:ApexComponent'}}).returns(:in_progress)
savon.expects(:check_status).with(:ids => ['04sU0000000WNWoIAO']).returns(:done);
- response = client.delete(:apex_component, :full_name => 'component')
+ response = client.delete(:apex_component, 'component')
response.should be_a(Metaforce::Transaction)
end
it "responds to method missing" do
savon.expects(:delete).with(:metadata => [{:full_name => 'component'}], :attributes! => {'ins0:metadata' => {'xsi:type' => 'wsdl:ApexComponent'}}).returns(:in_progress)
savon.expects(:check_status).with(:ids => ['04sU0000000WNWoIAO']).returns(:done);
- response = client.delete_apex_component(:full_name => 'component')
+ response = client.delete_apex_component('component')
response.should be_a(Metaforce::Transaction)
end
end

0 comments on commit a75a5c0

Please sign in to comment.