Sha256: 5fb2c5619c7df6feded3e6d693b3f26c59f7d674eae07f5aa759ab9bba5a7c99

Contents?: true

Size: 683 Bytes

Versions: 5

Compression:

Stored size: 683 Bytes

Contents

# frozen_string_literal: true

module Quickmail
  class Authentication

    class << self
      def oauth(payload = {})
        RestClient::Request.new({
            method: :post,
            url: Quickmail.api_base + '/token',
            payload: payload,
            headers: {content_type: "application/x-www-form-urlencoded"}
          }).execute do |response, request, result|
          if response.code != 200
            raise ApiRequestError.new(
              response_code: response.code,
              response_headers: response.headers,
              response_body: response.to_str
            )
          end
          response
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
quickmail-0.15.0 lib/quickmail/authentication.rb
quickmail-0.14.0 lib/quickmail/authentication.rb
quickmail-0.13.0 lib/quickmail/authentication.rb
quickmail-0.12.0 lib/quickmail/authentication.rb
quickmail-0.10.0 lib/quickmail/authentication.rb