Class: Grape::API

Inherits:
Object
  • Object
show all
Includes:
Tokeeo
Defined in:
lib/grape/tokeeo.rb

Constant Summary

Constants included from Tokeeo

Tokeeo::DEFAULT_HEADER, Tokeeo::DEFAULT_INVALID_MESSAGE, Tokeeo::DEFAULT_MISSING_MESSAGE, Tokeeo::VERSION

Class Method Summary collapse

Methods included from Tokeeo

build_model_token_security, build_preshared_token_security, define_before_for, found_in_model?, header_for, header_to_verify, header_token, message_for_invalid_token, message_for_missing_token, use_supported_orm?, verification_passed?

Class Method Details

.ensure_token(options = {}) ⇒ Object



9
10
11
12
# File 'lib/grape/tokeeo.rb', line 9

def ensure_token(options={})
  Grape::Tokeeo.build_preshared_token_security(options, self) if options[:is].present?
  Grape::Tokeeo.build_model_token_security(options, self) if options[:in].present?
end

.ensure_token_with(options = {}, &block) ⇒ Object



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

def ensure_token_with(options={}, &block)
  Grape::Tokeeo.define_before_for(self, options, &block)
end

.validate_token(options = {}) ⇒ Object



18
19
20
21
# File 'lib/grape/tokeeo.rb', line 18

def validate_token(options={} )
  warn "[DEPRECATED] 'validate_token' is deprecated, use 'ensure_token' instead"
  ensure_token(options)
end

.validate_token_with(options = {}, &block) ⇒ Object



23
24
25
26
# File 'lib/grape/tokeeo.rb', line 23

def validate_token_with(options={}, &block)
  warn "[DEPRECATED] 'validate_token_with' is deprecated, use 'ensure_token_with' instead"
  ensure_token_with(options, &block)
end