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/stores/memcache.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, Stores, Strategies Classes: AccessForbiddenError, AuthorizationError, Client, Entity, NotFoundError, Relation, ServerError, TransportError, UnauthorizedError

Constant Summary collapse

AUTH_HOST =
'https://auth.bootic.net'.freeze
API_ROOT =
'https://api.bootic.net/v1'.freeze
VERSION =
"0.0.14"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_rootObject



34
35
36
# File 'lib/bootic_client.rb', line 34

def api_root
  @api_root || API_ROOT
end

.auth_hostObject



30
31
32
# File 'lib/bootic_client.rb', line 30

def auth_host
  @auth_host || AUTH_HOST
end

.cache_storeObject

Returns the value of attribute cache_store.



14
15
16
# File 'lib/bootic_client.rb', line 14

def cache_store
  @cache_store
end

.client_idObject

Returns the value of attribute client_id.



14
15
16
# File 'lib/bootic_client.rb', line 14

def client_id
  @client_id
end

.client_secretObject

Returns the value of attribute client_secret.



14
15
16
# File 'lib/bootic_client.rb', line 14

def client_secret
  @client_secret
end

.loggerObject



38
39
40
# File 'lib/bootic_client.rb', line 38

def logger
  @logger || ::Logger.new(STDOUT)
end

.loggingObject

Returns the value of attribute logging.



14
15
16
# File 'lib/bootic_client.rb', line 14

def logging
  @logging
end

Class Method Details

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



21
22
23
24
25
26
27
28
# File 'lib/bootic_client.rb', line 21

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

.configure {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:

  • _self (BooticClient)

    the object that the method was called on



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

def configure(&block)
  yield self
end

.strategiesObject



17
18
19
# File 'lib/bootic_client.rb', line 17

def strategies
  @strategies ||= {}
end