Module: ParamsEncoding

Defined in:
lib/params_encoding.rb,
lib/params_encoding/version.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.decode(options) ⇒ Object



14
15
16
17
18
19
# File 'lib/params_encoding.rb', line 14

def self.decode(options)
  return if options.blank?
  raise 'Type error, currently only hash supported!' unless options.is_a?(Hash)
  token = JWT.decode options, nil, false
  token
end

.encode(options) ⇒ Object



7
8
9
10
11
12
# File 'lib/params_encoding.rb', line 7

def self.encode(options)
  return if options.blank?
  raise 'Type error, currently only hash supported!' unless options.is_a?(Hash)
  token = JWT.encode options, nil, 'none'
  token
end