Sha256: 94efdf66476339685886144882de5ac36e481ad64d63859814a3d3f1328e376b

Contents?: true

Size: 793 Bytes

Versions: 4

Compression:

Stored size: 793 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

4 entries across 4 versions & 1 rubygems

Version Path
quickmail-0.19.0 lib/quickmail/authentication.rb
quickmail-0.18.0 lib/quickmail/authentication.rb
quickmail-0.17.0 lib/quickmail/authentication.rb
quickmail-0.16.0 lib/quickmail/authentication.rb