Module: Safie

Defined in:
lib/safie.rb,
lib/safie/client.rb,
lib/safie/exception.rb,
lib/safie/access_token.rb

Defined Under Namespace

Classes: AccessToken, BadRequest, Client, Exception, Forbidden, HttpError, Unauthorized, ValidationFailed

Constant Summary collapse

ISSUER =
'https://app.safie.link'
DEFAULT_SCOPE =
:use
ENDPOINTS =
{
  authorization: File.join(ISSUER, '/auth/authorize'),
  token: File.join(ISSUER, '/auth/token'),
  token_info: File.join(ISSUER, '/auth/tokeninfo')
}
VERSION =
File.read(
  File.join(File.dirname(__FILE__), '../VERSION')
).chomp

Class Method Summary collapse

Class Method Details

.debug(&block) ⇒ Object



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/safie.rb', line 42

def self.debug(&block)
  sub_protocol_originals = @sub_protocols.inject({}) do |sub_protocol_originals, klass|
    sub_protocol_originals.merge!(klass => klass.debugging?)
  end
  original = self.debugging?
  debug!
  yield
ensure
  @sub_protocols.each do |klass|
    klass.debugging = sub_protocol_originals[klass]
  end
  self.debugging = original
end

.debug!Object



36
37
38
39
40
41
# File 'lib/safie.rb', line 36

def self.debug!
  @sub_protocols.each do |klass|
    klass.debug!
  end
  self.debugging = true
end

.debugging=(boolean) ⇒ Object



30
31
32
33
34
35
# File 'lib/safie.rb', line 30

def self.debugging=(boolean)
  @sub_protocols.each do |klass|
    klass.debugging = boolean
  end
  @@debugging = boolean
end

.debugging?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/safie.rb', line 27

def self.debugging?
  @@debugging
end

.loggerObject



15
16
17
# File 'lib/safie.rb', line 15

def self.logger
  @@logger
end

.logger=(logger) ⇒ Object



18
19
20
# File 'lib/safie.rb', line 18

def self.logger=(logger)
  @@logger = logger
end