Class: Koinz::OAuth2Client::UserManager

Inherits:
Object
  • Object
show all
Defined in:
lib/koinz/omniauth_client.rb

Class Method Summary collapse

Class Method Details

.call(access_token, uri, options = {}) ⇒ Object

Example:

Koinz::OAuth2::UserManager.call(@user_session.auth_token, '/users/sign_out.json')

Parameters:

  • the (String)

    access token

  • uri (String)

    for invocation on remote host

  • options. (Hash)

    :method => :get (default) [ :put, :post, :delete ]



15
16
17
18
19
20
21
22
23
# File 'lib/koinz/omniauth_client.rb', line 15

def self.call(access_token, uri, options = {})
  access_token = OAuth2::AccessToken.new($KOINZ_PROVIDER.client, access_token )

  method = options.fetch(:method, :get)
  result = access_token.send(method, uri)
  result = MultiJson.decode(result)
  rescue Exception => e
    return { :error => e.message }
end