Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add CRUD to readme.

  • Loading branch information...
commit a75a5c0be081948d9efb9e7f5e14deb6463be1f0 1 parent f94c5b4
@ejholmes authored
View
9 README.md
@@ -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
View
8 lib/metaforce/metadata/crud.rb
@@ -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
View
4 spec/lib/metadata/crud_spec.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.