Module: Restforce::Concerns::Base
- Included in:
- AbstractClient
- Defined in:
- lib/restforce/concerns/base.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(opts = {}) {|builder| ... } ⇒ Object
Public: Creates a new client instance.
- #inspect ⇒ Object
- #instance_url ⇒ Object
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/restforce/concerns/base.rb', line 5 def @options end |
Instance Method Details
#initialize(opts = {}) {|builder| ... } ⇒ Object
Public: Creates a new client instance
opts - A hash of options to be passed in (default: {}).
:username - The String username to use (required for password authentication).
:password - The String password to use (required for password authentication).
:security_token - The String security token to use (required for password authentication).
:oauth_token - The String oauth access token to authenticate api
calls (required unless password
authentication is used).
:refresh_token - The String refresh token to obtain fresh
oauth access tokens (required if oauth
authentication is used).
:instance_url - The String base url for all api requests
(required if oauth authentication is used).
:client_id - The oauth client id to use. Needed for both
password and oauth authentication
:client_secret - The oauth client secret to use.
:host - The String hostname to use during
authentication requests (default: 'login.salesforce.com').
:api_version - The String REST api version to use (default: '24.0')
:authentication_retries - The number of times that client
should attempt to reauthenticate
before raising an exception (default: 3).
:compress - Set to true to have Salesforce compress the response (default: false).
:timeout - Faraday connection request read/open timeout. (default: nil).
:proxy_uri - Proxy URI: 'http://proxy.example.com:port' or 'http://user@pass:proxy.example.com:port'
:authentication_callback
- A Proc that is called with the response body after a successful authentication.
43 44 45 46 47 48 |
# File 'lib/restforce/concerns/base.rb', line 43 def initialize(opts = {}) raise ArgumentError, 'Please specify a hash of options' unless opts.is_a?(Hash) @options = Hash[Restforce.configuration..map { |option| [option, Restforce.configuration.send(option)] }] @options.merge! opts yield builder if block_given? end |
#inspect ⇒ Object
55 56 57 |
# File 'lib/restforce/concerns/base.rb', line 55 def inspect "#<#{self.class} @options=#{@options.inspect}>" end |
#instance_url ⇒ Object
50 51 52 53 |
# File 'lib/restforce/concerns/base.rb', line 50 def instance_url authenticate! unless [:instance_url] [:instance_url] end |