Sha256: 4ba7039968fb983d6666dfea2a55622ec09aa1b028505297132e3f8bd207d2ac

Contents?: true

Size: 728 Bytes

Versions: 5

Compression:

Stored size: 728 Bytes

Contents

require 'httparty'

module Devise
  module Capturable
    
    class API

      include HTTParty
      format :json
      #debug_output $stderr
    
      def self.token(code)
        redirect_uri = Devise.capturable_redirect_uri || 'http://stupidsettings.com'

        post("#{Devise.capturable_server}/oauth/token", :query => {
          code: code,
          redirect_uri: redirect_uri,
          grant_type: 'authorization_code',
          client_id: Devise.capturable_client_id,
          client_secret: Devise.capturable_client_secret,
        })
      end
    
      def self.entity(token)
        post("#{Devise.capturable_server}/entity", headers: { 'Authorization' => "OAuth #{token}" })
      end
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
devise_capturable-0.0.12 lib/devise_capturable/api.rb
devise_capturable-0.0.11 lib/devise_capturable/api.rb
devise_capturable-0.0.10 lib/devise_capturable/api.rb
devise_capturable-0.0.9 lib/devise_capturable/api.rb
devise_capturable-0.0.8 lib/devise_capturable/api.rb