Module: BooticClient

Defined in:
lib/bootic_client.rb,
lib/bootic_client/client.rb,
lib/bootic_client/entity.rb,
lib/bootic_client/errors.rb,
lib/bootic_client/version.rb,
lib/bootic_client/relation.rb,
lib/bootic_client/whiny_uri.rb,
lib/bootic_client/configuration.rb,
lib/bootic_client/stores/memcache.rb,
lib/bootic_client/response_handlers.rb,
lib/bootic_client/strategies/bearer.rb,
lib/bootic_client/strategies/strategy.rb,
lib/bootic_client/strategies/authorized.rb,
lib/bootic_client/strategies/basic_auth.rb,
lib/bootic_client/strategies/oauth2_strategy.rb,
lib/bootic_client/strategies/client_credentials.rb

Defined Under Namespace

Modules: EnumerableEntity, ResponseHandlers, Stores, Strategies Classes: AccessForbiddenError, AuthorizationError, Client, ClientError, Configuration, Entity, InvalidURLError, NotFoundError, Relation, ServerError, TransportError, UnauthorizedError, WhinyURI

Constant Summary collapse

VERSION =
"0.0.31".freeze
InvalidConfigurationError =
Class.new(StandardError)
VERY_BASIC_URL_CHECK =
/^(http|https):/.freeze
AUTH_HOST =
'https://auth.bootic.net'.freeze
API_ROOT =
'https://api.bootic.net/v1'.freeze

Class Method Summary collapse

Class Method Details

.client(strategy_name, client_opts = {}, &on_new_token) ⇒ Object


14
15
16
17
18
19
20
21
22
# File 'lib/bootic_client.rb', line 14

def client(strategy_name, client_opts = {}, &on_new_token)
  opts = client_opts.dup
  opts[:logging] = configuration.logging
  opts[:logger] = configuration.logger if configuration.logging
  opts[:cache_store] = configuration.cache_store if configuration.cache_store
  opts[:user_agent] = configuration.user_agent if configuration.user_agent
  require "bootic_client/strategies/#{strategy_name}"
  strategies.fetch(strategy_name.to_sym).new configuration, opts, &on_new_token
end

.configurationObject


28
29
30
# File 'lib/bootic_client.rb', line 28

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:


24
25
26
# File 'lib/bootic_client.rb', line 24

def configure(&block)
  yield configuration
end

.strategiesObject


10
11
12
# File 'lib/bootic_client.rb', line 10

def strategies
  @strategies ||= {}
end