Module: Hull

Extended by:
Config
Defined in:
lib/hull.rb,
lib/hull/client.rb,
lib/hull/config.rb,
lib/hull/paywall.rb,
lib/hull/request.rb,
lib/hull/version.rb,
lib/hull/connection.rb,
lib/hull/request/auth.rb

Defined Under Namespace

Modules: Config, Connection, Middlewares, Request, Response Classes: Client, Entity, Paywall

Constant Summary collapse

VERSION =
"0.4.0"

Constants included from Config

Config::DEFAULT_ADAPTER, Config::DEFAULT_APP_ID, Config::DEFAULT_APP_SECRET, Config::DEFAULT_CACHE_STORE, Config::DEFAULT_CONNECTION_OPTIONS, Config::DEFAULT_CURRENT_USER, Config::DEFAULT_JS_URL, Config::DEFAULT_LOGGER, Config::DEFAULT_ORG_URL, Config::DEFAULT_PROXY, Config::DEFAULT_USER_AGENT, Config::VALID_OPTIONS_KEYS

Class Method Summary collapse

Methods included from Config

configure, domain, extended, options, reset

Class Method Details

.as(user) ⇒ Object



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

def as(user)
  if user.is_a?(String)
    Hull::Client.new({ user_id: user })
  else
    Hull::Client.new({ access_token: self.user_token(user) })
  end
end

.log(msg, level = :debug) ⇒ Object



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

def log msg, level=:debug
  Hull.logger.send(level.to_sym, "[hull:#{Hull.domain}] #{msg}") if Hull.logger && Hull.logger.respond_to?(level.to_sym)
end

.method_missing(method, *args, &block) ⇒ Object

Delegate to Hull::Client



25
26
27
28
# File 'lib/hull.rb', line 25

def method_missing(method, *args, &block)
  return super unless new.respond_to?(method)
  new.send(method, *args, &block)
end

.new(options = {}) ⇒ Hull::Client

Alias for Hull::Client.new

Returns:



12
13
14
# File 'lib/hull.rb', line 12

def new(options={})
  Hull::Client.new(options)
end

.respond_to?(method, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


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

def respond_to?(method, include_private=false)
  new.respond_to?(method, include_private) || super(method, include_private)
end