Class: Quickmail::Authentication

Inherits:
Object
  • Object
show all
Defined in:
lib/quickmail/authentication.rb

Class Method Summary collapse

Class Method Details

.oauth(payload = {}) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/quickmail/authentication.rb', line 7

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|
    str_response = response.to_str
    str_response.blank? ? '' : JSON.parse(str_response)
  end
end