Module: Restforce::DB
- Extended by:
- Forwardable
- Defined in:
- lib/restforce/db.rb,
lib/restforce/db/dsl.rb,
lib/restforce/db/task.rb,
lib/restforce/db/model.rb,
lib/restforce/db/client.rb,
lib/restforce/db/runner.rb,
lib/restforce/db/worker.rb,
lib/restforce/db/adapter.rb,
lib/restforce/db/cleaner.rb,
lib/restforce/db/command.rb,
lib/restforce/db/mapping.rb,
lib/restforce/db/railtie.rb,
lib/restforce/db/tracker.rb,
lib/restforce/db/version.rb,
lib/restforce/db/attacher.rb,
lib/restforce/db/loggable.rb,
lib/restforce/db/registry.rb,
lib/restforce/db/strategy.rb,
lib/restforce/db/collector.rb,
lib/restforce/db/associator.rb,
lib/restforce/db/accumulator.rb,
lib/restforce/db/initializer.rb,
lib/restforce/db/record_cache.rb,
lib/restforce/db/synchronizer.rb,
lib/restforce/db/task_manager.rb,
lib/restforce/db/attribute_map.rb,
lib/restforce/db/configuration.rb,
lib/restforce/db/instances/base.rb,
lib/restforce/db/field_processor.rb,
lib/restforce/db/timestamp_cache.rb,
lib/restforce/db/association_cache.rb,
lib/restforce/db/associations/base.rb,
lib/restforce/db/record_types/base.rb,
lib/restforce/db/strategies/always.rb,
lib/restforce/db/strategies/passive.rb,
lib/restforce/db/associations/has_one.rb,
lib/restforce/db/instances/salesforce.rb,
lib/restforce/db/associations/has_many.rb,
lib/restforce/db/strategies/associated.rb,
lib/restforce/db/synchronization_error.rb,
lib/restforce/db/associations/belongs_to.rb,
lib/restforce/db/attribute_maps/database.rb,
lib/restforce/db/instances/active_record.rb,
lib/restforce/db/record_types/salesforce.rb,
lib/restforce/db/associations/foreign_key.rb,
lib/restforce/db/attribute_maps/salesforce.rb,
lib/restforce/db/record_types/active_record.rb,
lib/restforce/db/middleware/store_request_body.rb
Overview
:nodoc:
Defined Under Namespace
Modules: Associations, AttributeMaps, Instances, Loggable, Middleware, Model, RecordTypes, Strategies Classes: Accumulator, Adapter, AssociationCache, Associator, Attacher, AttributeMap, Cleaner, Client, Collector, Command, Configuration, DSL, FieldProcessor, Initializer, Mapping, Railtie, RecordCache, Registry, Runner, Strategy, SynchronizationError, Synchronizer, Task, TaskManager, TaskMapping, TimestampCache, Tracker, Worker
Constant Summary collapse
- VERSION =
"4.0.4"
Class Attribute Summary collapse
-
.configuration ⇒ Object
Public: Get the current configuration for Restforce::DB.
-
.last_run ⇒ Object
Returns the value of attribute last_run.
Class Method Summary collapse
-
.client ⇒ Object
Public: Get a Restforce client based on the currently configured settings.
-
.configure {|configuration| ... } ⇒ Object
Public: Configure Restforce::DB by assigning values to the current configuration.
-
.reset ⇒ Object
Public: Clear all globally cached values for Restforce::DB.
-
.reset! ⇒ Object
Public: Eliminate all customizations to the current Restforce::DB configuration and client.
-
.user_id ⇒ Object
Public: Get the ID of the Salesforce user which is being used to access the Salesforce API.
Class Attribute Details
.configuration ⇒ Object
Public: Get the current configuration for Restforce::DB.
Returns a Restforce::DB::Configuration instance.
75 76 77 |
# File 'lib/restforce/db.rb', line 75 def self.configuration @configuration ||= Configuration.new end |
.last_run ⇒ Object
Returns the value of attribute last_run.
59 60 61 |
# File 'lib/restforce/db.rb', line 59 def last_run @last_run end |
Class Method Details
.client ⇒ Object
Public: Get a Restforce client based on the currently configured settings.
Returns a Restforce::Data::Client instance.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/restforce/db.rb', line 82 def self.client @client ||= begin DB::Client.new( username: configuration.username, password: configuration.password, security_token: configuration.security_token, client_id: configuration.client_id, client_secret: configuration.client_secret, host: configuration.host, api_version: configuration.api_version, timeout: configuration.timeout, adapter: configuration.adapter, ) end end |
.configure {|configuration| ... } ⇒ Object
Public: Configure Restforce::DB by assigning values to the current configuration.
Yields the current configuration. Returns the current configuration.
111 112 113 114 |
# File 'lib/restforce/db.rb', line 111 def self.configure yield(configuration) configuration end |
.reset ⇒ Object
Public: Clear all globally cached values for Restforce::DB.
NOTE: This is an “idempotent” reset; following invocation, all functions should still work as before, but globally cached values will be repopulated.
Returns nothing.
123 124 125 126 127 |
# File 'lib/restforce/db.rb', line 123 def self.reset FieldProcessor.reset @user_id = nil @client = nil end |
.reset! ⇒ Object
Public: Eliminate all customizations to the current Restforce::DB configuration and client.
NOTE: This is a hard reset; following invocation, Restforce::DB will need to be reconfigured in order for functionality to be restored.
Returns nothing.
136 137 138 139 140 141 |
# File 'lib/restforce/db.rb', line 136 def self.reset! reset @configuration = nil @last_run = nil end |
.user_id ⇒ Object
Public: Get the ID of the Salesforce user which is being used to access the Salesforce API.
Returns a String.
102 103 104 |
# File 'lib/restforce/db.rb', line 102 def self.user_id @user_id ||= client.user_info.user_id end |