Sha256: cef0af379523b9b46307dfbc12b1dae68d1b8571e3cc43e54af356a656003dbf

Contents?: true

Size: 799 Bytes

Versions: 12

Compression:

Stored size: 799 Bytes

Contents

module Rack
  module OAuth2
    class Client
      class Grant
        include AttrRequired, AttrOptional

        def initialize(attributes = {})
          (required_attributes + optional_attributes).each do |key|
            self.send "#{key}=", attributes[key]
          end
          attr_missing!
        end

        def to_hash
          (required_attributes + optional_attributes).inject({
            :grant_type => self.class.name.demodulize.underscore.to_sym
          }) do |hash, key|
            hash.merge! key => self.send(key)
          end
        end
      end
    end
  end
end

require 'rack/oauth2/client/grant/authorization_code'
require 'rack/oauth2/client/grant/password'
require 'rack/oauth2/client/grant/client_credentials'
require 'rack/oauth2/client/grant/refresh_token'

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rack-oauth2-0.11.0 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.10.1 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.10.0 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.10.0.alpha lib/rack/oauth2/client/grant.rb
rack-oauth2-0.9.5 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.9.4 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.9.3 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.9.2 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.9.1 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.9.0 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.9.0.alpha lib/rack/oauth2/client/grant.rb
rack-oauth2-0.8.7 lib/rack/oauth2/client/grant.rb