Class: Metaforce::Services::Client
- Inherits:
-
AbstractClient
- Object
- AbstractClient
- Metaforce::Services::Client
- Defined in:
- lib/metaforce/services/client.rb
Instance Method Summary collapse
-
#describe_layout(sobject, record_type_id = nil) ⇒ Object
Public: Retrieves layout information for the specified sobject.
-
#get_server_timestamp ⇒ Object
Public: Retrieves the current system timestamp (Coordinated Universal Time (UTC) time zone) from the API.
-
#get_user_info ⇒ Object
Public: Retrieves personal information for the user associated with the current session.
- #inspect ⇒ Object
-
#picklist_values(sobject, record_type_id, field) ⇒ Object
Public: Get active picklists for a record type.
-
#send_email(options = {}) ⇒ Object
Public: Sends an email using Salesforce.
Methods inherited from AbstractClient
Constructor Details
This class inherits a constructor from Metaforce::AbstractClient
Instance Method Details
permalink #describe_layout(sobject, record_type_id = nil) ⇒ Object
Public: Retrieves layout information for the specified sobject.
sobject - String name of the sobject. record_type_id - String id of a record type to filter on.
Examples
client.describe_layout('Account', '012000000000000AAA')
Returns the layout metadata for the sobject.
39 40 41 42 43 44 |
# File 'lib/metaforce/services/client.rb', line 39 def describe_layout(sobject, record_type_id=nil) request :describe_layout do |soap| soap.body = { 'sObjectType' => sobject } soap.body.merge!('recordTypeID' => record_type_id) if record_type_id end end |
permalink #get_server_timestamp ⇒ Object
Public: Retrieves the current system timestamp
(Coordinated Universal Time (UTC) time zone) from the API.
Example: client.services.send(:get_server_timestamp)
72 73 74 |
# File 'lib/metaforce/services/client.rb', line 72 def request :get_server_timestamp end |
permalink #get_user_info ⇒ Object
Public: Retrieves personal information for the user associated
with the current session.
Example: client.services.send(:get_user_info)
79 80 81 |
# File 'lib/metaforce/services/client.rb', line 79 def get_user_info request :get_user_info end |
permalink #inspect ⇒ Object
[View source]
64 65 66 |
# File 'lib/metaforce/services/client.rb', line 64 def inspect "#<#{self.class} @options=#{@options.inspect}>" end |
permalink #picklist_values(sobject, record_type_id, field) ⇒ Object
Public: Get active picklists for a record type.
sobject - String name of the sobject. record_type_id - String id of a record type to filter on. field - String name of the field to get picklist values for.
Examples
client.picklist_values('Account', '012000000000000AAA', 'Some_Field__c')
# => [['Label', 'Value']]
Returns the picklist_values
58 59 60 61 62 |
# File 'lib/metaforce/services/client.rb', line 58 def picklist_values(sobject, record_type_id, field) describe_layout(sobject, record_type_id).record_type_mappings.picklists_for_record_type .select { |p| p.picklist_name == field }.first.picklist_values .select { |p| p.active }.collect { |p| [ p.label, p.value ] } end |
permalink #send_email(options = {}) ⇒ Object
Public: Sends an email using Salesforce.
options - Hash of email options (www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_sendemail.htm)
Examples
client.send_email(
to_addresses: ['foo@bar.com'],
subject: 'Hello World',
plain_text_body: 'Hello World'
)
Returns the result.
20 21 22 23 24 25 26 27 |
# File 'lib/metaforce/services/client.rb', line 20 def send_email(={}) request :send_email do |soap| soap.body = { :messages => , :attributes! => { 'ins0:messages' => { 'xsi:type' => 'ins0:SingleEmailMessage' } } } end end |