Sha256: c6aaa3eda9236627bb14a6071abda7aa6d879fafd566b86754711c58fd349c10

Contents?: true

Size: 558 Bytes

Versions: 3

Compression:

Stored size: 558 Bytes

Contents

module Zesty
  class Auth

    AUTH_URL = "https://auth.api.zesty.io"

    def self.get_token(email, password)
      self.new.login(email, password).dig(:meta, :token)
    end

    def initialize(**options)
      @options = options
    end

    def login(email, password)
      Request.post_form(
        "#{AUTH_URL}/login",
        params: {
          email: email,
          password: password
        }
      )
    end

    def verify_token(token)
      Request.get("#{AUTH_URL}/verify", headers: { Authorization: "Bearer #{token}" })
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
zesty-0.3.0 lib/zesty/auth.rb
zesty-0.2.1 lib/zesty/auth.rb
zesty-0.2.0 lib/zesty/auth.rb