module Slots::JWT::Tests

Public Instance Methods

authorized_delete(current_user, url, headers: {}, **options) click to toggle source
# File lib/slots/jwt/tests.rb, line 18
def authorized_delete(current_user, url, headers: {}, **options)
  authorized_protocal :delete, current_user, url, headers: headers, **options
end
authorized_get(current_user, url, headers: {}, **options) click to toggle source
# File lib/slots/jwt/tests.rb, line 6
def authorized_get(current_user, url, headers: {}, **options)
  authorized_protocal :get, current_user, url, headers: headers, **options
end
authorized_patch(current_user, url, headers: {}, **options) click to toggle source
# File lib/slots/jwt/tests.rb, line 12
def authorized_patch(current_user, url, headers: {}, **options)
  authorized_protocal :patch, current_user, url, headers: headers, **options
end
authorized_post(current_user, url, headers: {}, **options) click to toggle source
# File lib/slots/jwt/tests.rb, line 9
def authorized_post(current_user, url, headers: {}, **options)
  authorized_protocal :post, current_user, url, headers: headers, **options
end
authorized_protocal(type, current_user, url, headers: {}, session: false, **options) click to toggle source
# File lib/slots/jwt/tests.rb, line 22
def authorized_protocal(type, current_user, url, headers: {}, session: false, **options)
  @token = current_user&.create_token(session)
  headers = headers.merge(token_header(@token)) if @token
  send(type, url, headers: headers, **options)
end
authorized_put(current_user, url, headers: {}, **options) click to toggle source
# File lib/slots/jwt/tests.rb, line 15
def authorized_put(current_user, url, headers: {}, **options)
  authorized_protocal :put, current_user, url, headers: headers, **options
end
current_token() click to toggle source
# File lib/slots/jwt/tests.rb, line 28
def current_token
  @token
end
token_header(token) click to toggle source
# File lib/slots/jwt/tests.rb, line 32
def token_header(token)
  {'authorization' => %{Bearer token="#{token}"}}
end