Sha256: 6288a6318c85870ccc77e5e5b00fa88c844b4261ecef27e99530a68f4cb4671c

Contents?: true

Size: 757 Bytes

Versions: 21

Compression:

Stored size: 757 Bytes

Contents

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

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

        def to_hash
          required_attributes.inject({
            :grant_type => self.class.name.split('::').last.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

21 entries across 21 versions & 1 rubygems

Version Path
rack-oauth2-0.8.4 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.8.3 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.8.2 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.8.1 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.8.0 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.8.0.alpha lib/rack/oauth2/client/grant.rb
rack-oauth2-0.7.0 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.9 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.8 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.7 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.6 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.5 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.4 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.3 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.2 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.1 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.0 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.6.0.alpha lib/rack/oauth2/client/grant.rb
rack-oauth2-0.5.1 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.5.0 lib/rack/oauth2/client/grant.rb