class AuthpartyConnect::Connection

Public Class Methods

new(api_key, api_secret, host) click to toggle source
# File lib/authparty-connect/connection.rb, line 5
def initialize(api_key, api_secret, host)
  @base_api_url = 'http://' + host.to_s + '/api/v1/'
  @credentials = {:api_key => api_key.to_s, :api_secret => api_secret.to_s}
end

Public Instance Methods

authorize_qrcode() click to toggle source

Acquire QR-code

# File lib/authparty-connect/connection.rb, line 20
def authorize_qrcode
  @qrcode = HTTParty.get(@base_api_url + 'providers/authorize_qrcode?api_key=' + @credentials[:api_key] + '&callback_url=' + @base_api_url + 'providers/authorize_login')
  return @qrcode
end
list_providers() click to toggle source
# File lib/authparty-connect/connection.rb, line 10
def list_providers
  puts HTTParty.get(@base_api_url + 'providers')
end
login_path() click to toggle source

Get Login Path (For Official Authparty Login Pages)

# File lib/authparty-connect/connection.rb, line 15
def login_path
  puts HTTParty.get(@base_api_url + 'providers/authorize_url?api_key=' + @credentials[:api_key])
end

Protected Instance Methods

response_code(response) click to toggle source
# File lib/authparty-connect/connection.rb, line 26
def response_code(response)
  return response.code
end