class Adminbox::Command
Attributes
encoded_jwt[R]
Public Class Methods
new(jwt)
click to toggle source
# File lib/adminbox/command.rb, line 5 def initialize(jwt) @encoded_jwt = jwt end
Public Instance Methods
decoded_jwt()
click to toggle source
# File lib/adminbox/command.rb, line 18 def decoded_jwt @decoded_jwt ||= begin JWT.decode(encoded_jwt, shared_secret) rescue JWT::VerificationError raise Adminbox::InvalidSignature rescue JWT::ExpiredSignature raise Adminbox::ExpiredSignature end end
execute()
click to toggle source
# File lib/adminbox/command.rb, line 9 def execute subcommand = Object.const_get("Commands::#{table_module}::#{name}") subcommand.new(encoded_jwt).execute end
headers()
click to toggle source
# File lib/adminbox/command.rb, line 32 def headers decoded_jwt[1] end
ids()
click to toggle source
# File lib/adminbox/command.rb, line 48 def ids payload["ids"] end
name()
click to toggle source
# File lib/adminbox/command.rb, line 36 def name payload["command"] end
payload()
click to toggle source
# File lib/adminbox/command.rb, line 28 def payload decoded_jwt[0] end
table()
click to toggle source
# File lib/adminbox/command.rb, line 40 def table payload["table"] end
table_module()
click to toggle source
# File lib/adminbox/command.rb, line 44 def table_module table.split('_').collect(&:capitalize).join end