Module: EY::GateKeeper

Defined in:
lib/ey_gatekeeper.rb,
lib/ey_gatekeeper/util.rb,
lib/ey_gatekeeper/token.rb,
lib/ey_gatekeeper/client.rb,
lib/ey_gatekeeper/version.rb,
lib/ey_gatekeeper/responses.rb,
lib/ey_gatekeeper/client/consumer.rb,
lib/ey_gatekeeper/access_control_list.rb,
lib/ey_gatekeeper/client/server_response.rb,
lib/ey_gatekeeper/client/middlewares/authentication.rb,
lib/ey_gatekeeper/client/middlewares/service_token_authentication.rb

Defined Under Namespace

Modules: Client, Responses, Util Classes: AccessControl, AccessControlList, Token

Constant Summary collapse

VERSION =
'0.1.35'

Class Method Summary collapse

Class Method Details

.default_mongodbObject



39
40
41
42
43
44
45
46
# File 'lib/ey_gatekeeper.rb', line 39

def self.default_mongodb
  {
    :hosts => [["localhost", 27017]],
    :safe_write_options => {
      :fsync => false
    }
  }
end

.mock!Object



11
12
13
14
15
16
# File 'lib/ey_gatekeeper.rb', line 11

def self.mock!
  @mocking = true

  require 'ey_gatekeeper/server'
  EY::GateKeeper::Server.mock!
end

.mocking?Boolean

Returns:

  • (Boolean)


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

def self.mocking?
  @mocking
end

.needs_reset?Boolean

Returns:

  • (Boolean)


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

def self.needs_reset?
  !!@needs_reset
end

.new(*a) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/ey_gatekeeper.rb', line 3

def self.new(*a)
  if mocking?
    EY::GateKeeper::Client.mock(*a)
  else
    EY::GateKeeper::Client.new(*a)
  end
end

.reset!(config = default_mongodb) ⇒ Object



30
31
32
33
34
35
36
37
# File 'lib/ey_gatekeeper.rb', line 30

def self.reset!(config = default_mongodb)
  if mocking?
    CloudKit.setup_storage_adapter(CloudKit::MemoryTable.new)
    EY::GateKeeper::AuthStore.setup_master_credentials('77zxcvbnm77','77zxcvbnm77')
  else
    raise "Don't use reset! when not mocking"
  end
end

.was_reset!Object



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

def self.was_reset!
  @needs_reset = false
end