Class: Thron::Gateway::Base

Inherits:
Object
  • Object
show all
Includes:
Routable
Defined in:
lib/thron/gateway/base.rb

Direct Known Subclasses

AccessManager, Session

Constant Summary collapse

NO_ACTIVE_SESSION =
"Please provide a valid token ID"

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Routable

included, info, #route

Instance Attribute Details

#token_idObject

Returns the value of attribute token_id.



30
31
32
# File 'lib/thron/gateway/base.rb', line 30

def token_id
  @token_id
end

Class Method Details

.client_idObject



26
27
28
# File 'lib/thron/gateway/base.rb', line 26

def self.client_id
  @client_id ||= Config.thron.client_id
end

.service_nameObject



22
23
24
# File 'lib/thron/gateway/base.rb', line 22

def self.service_name
  self.name.split('::').last.downcase
end

Instance Method Details

#check_sessionObject



36
37
38
# File 'lib/thron/gateway/base.rb', line 36

def check_session
  fail NoActiveSessionError, NO_ACTIVE_SESSION unless token_id
end

#client_idObject



32
33
34
# File 'lib/thron/gateway/base.rb', line 32

def client_id
  self.class.client_id
end