Class: Streamforce::Client
- Inherits:
-
Object
- Object
- Streamforce::Client
- Defined in:
- lib/streamforce/client.rb
Instance Attribute Summary collapse
-
#api_version ⇒ Object
readonly
Returns the value of attribute api_version.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
-
#security_token ⇒ Object
readonly
Returns the value of attribute security_token.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
- #subscribe(channels = [], &blk) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/streamforce/client.rb', line 5 def initialize(opts = {}) @host = opts.fetch(:host, ENV["SALESFORCE_HOST"]) @username = opts.fetch(:username, ENV["SALESFORCE_USERNAME"]) @password = opts.fetch(:password, ENV["SALESFORCE_PASSWORD"]) @client_id = opts.fetch(:client_id, ENV["SALESFORCE_CLIENT_ID"]) @client_secret = opts.fetch(:client_secret, ENV["SALESFORCE_CLIENT_SECRET"]) @security_token = opts.fetch(:security_token, ENV["SALESFORCE_SECURITY_TOKEN"]) @api_version = opts.fetch(:api_version, ENV["SALESFORCE_API_VERSION"]) @logger = opts.fetch(:logger, Logger.new($stdout)) @logger.level = ENV.fetch("STREAMFORCE_LOG_LEVEL", Logger::INFO) end |
Instance Attribute Details
#api_version ⇒ Object (readonly)
Returns the value of attribute api_version.
2 3 4 |
# File 'lib/streamforce/client.rb', line 2 def api_version @api_version end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
2 3 4 |
# File 'lib/streamforce/client.rb', line 2 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
2 3 4 |
# File 'lib/streamforce/client.rb', line 2 def client_secret @client_secret end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
2 3 4 |
# File 'lib/streamforce/client.rb', line 2 def host @host end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
2 3 4 |
# File 'lib/streamforce/client.rb', line 2 def password @password end |
#security_token ⇒ Object (readonly)
Returns the value of attribute security_token.
2 3 4 |
# File 'lib/streamforce/client.rb', line 2 def security_token @security_token end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
2 3 4 |
# File 'lib/streamforce/client.rb', line 2 def username @username end |
Instance Method Details
#subscribe(channels = [], &blk) ⇒ Object
18 19 20 |
# File 'lib/streamforce/client.rb', line 18 def subscribe(channels = [], &blk) EM.run { subscribe_to_channels(faye, Array(channels), &blk) } end |