Module: Schwab

Defined in:
lib/schwab.rb,
lib/schwab/error.rb,
lib/schwab/oauth.rb,
lib/schwab/client.rb,
lib/schwab/version.rb,
lib/schwab/accounts.rb,
lib/schwab/connection.rb,
lib/schwab/market_data.rb,
lib/schwab/configuration.rb,
lib/schwab/resources/base.rb,
lib/schwab/resources/order.rb,
lib/schwab/resources/account.rb,
lib/schwab/resources/position.rb,
lib/schwab/resources/strategy.rb,
lib/schwab/middleware/rate_limit.rb,
lib/schwab/resources/transaction.rb,
lib/schwab/account_number_resolver.rb,
lib/schwab/middleware/authentication.rb

Overview

Main namespace for the Schwab API SDK

Defined Under Namespace

Modules: Accounts, Connection, MarketData, Middleware, OAuth, Resources Classes: AccountNumberResolver, ApiError, AuthenticationError, AuthorizationError, BadRequestError, Client, Configuration, Error, NotFoundError, RateLimitError, ServerError, TokenExpiredError, UnexpectedResponseError

Constant Summary collapse

VERSION =

The current version of the Schwab SDK

"0.2.0"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.clientObject

Global client instance (optional, for convenience)



19
20
21
# File 'lib/schwab.rb', line 19

def client
  @client
end

.configurationObject

Access the global configuration



22
23
24
# File 'lib/schwab.rb', line 22

def configuration
  @configuration ||= Configuration.new
end

Class Method Details

.configure {|Configuration| ... } ⇒ Object

Configure the SDK globally

Examples:

Schwab.configure do |config|
  config.client_id = ENV['SCHWAB_CLIENT_ID']
  config.client_secret = ENV['SCHWAB_CLIENT_SECRET']
  config.redirect_uri = ENV['SCHWAB_REDIRECT_URI']
  config.logger = Rails.logger
end

Yields:



37
38
39
# File 'lib/schwab.rb', line 37

def configure
  yield(configuration)
end

.reset_configuration!Object

Reset the global configuration to defaults



42
43
44
# File 'lib/schwab.rb', line 42

def reset_configuration!
  @configuration = Configuration.new
end