Sha256: 2f7b6591cc98a6b398da23fb37243b7ad02b54aaaf0b0a6aea199aa5f685da4f

Contents?: true

Size: 650 Bytes

Versions: 7

Compression:

Stored size: 650 Bytes

Contents

module Docusigner
  class Oauth2 < Docusigner::Base
    singleton

    class << self
      def token(username, password, integrator_key)
        @headers = {
          "Accept" => "application/json",
          "Content-Type" => "application/x-www-form-urlencoded"
        }
        body = "grant_type=password&client_id=#{integrator_key}&username=#{username}&password=#{password}&scope=api"
        resp = post(:token, {}, body) 
        format.decode(resp.body)["access_token"]
      end

      def revoke(token)
        @headers = {
          "Authorization" => "Bearer #{token}"
        }
        post(:revoke, {}, "")
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
docusigner-0.0.8 lib/docusigner/oauth2.rb
docusigner-0.0.6 lib/docusigner/oauth2.rb
docusigner-0.0.5 lib/docusigner/oauth2.rb
docusigner-0.0.4 lib/docusigner/oauth2.rb
docusigner-0.0.3 lib/docusigner/oauth2.rb
docusigner-0.0.2 lib/docusigner/oauth2.rb
docusigner-0.0.1 lib/docusigner/oauth2.rb