Class: Restforce::DB::Configuration
- Inherits:
-
Object
- Object
- Restforce::DB::Configuration
- Defined in:
- lib/restforce/db/configuration.rb
Overview
Restforce::DB::Configuration exposes a handful of straightforward write and read methods to allow users to configure Restforce::DB.
Instance Method Summary collapse
-
#load(configurations) ⇒ Object
Public: Populate this configuration object from a Hash of credentials.
-
#parse(file_path) ⇒ Object
Public: Parse a supplied YAML file for a set of credentials, and use them to populate the attributes on this configuraton object.
Instance Method Details
#load(configurations) ⇒ Object
Public: Populate this configuration object from a Hash of credentials.
configurations - A Hash of credentials, with keys matching the names
of the attributes for this class.
Returns nothing.
37 38 39 40 41 42 43 44 |
# File 'lib/restforce/db/configuration.rb', line 37 def load(configurations) self.username = parsed(configurations, "username") self.password = parsed(configurations, "password") self.security_token = parsed(configurations, "security_token") self.client_id = parsed(configurations, "client_id") self.client_secret = parsed(configurations, "client_secret") self.host = parsed(configurations, "host") end |
#parse(file_path) ⇒ Object
Public: Parse a supplied YAML file for a set of credentials, and use them to populate the attributes on this configuraton object.
file_path - A String or Path referencing a client configuration file.
Returns nothing.
26 27 28 29 |
# File 'lib/restforce/db/configuration.rb', line 26 def parse(file_path) settings = YAML.load_file(file_path) load(settings["client"]) end |