Sha256: e4f93a6e8d2be6a1e2f7ded43b0146980b78d99e47a5572f1ef0d206e569d601

Contents?: true

Size: 813 Bytes

Versions: 27

Compression:

Stored size: 813 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 as_json(options = {})
          (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

27 entries across 27 versions & 1 rubygems

Version Path
rack-oauth2-1.1.1 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.1.0 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.10 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.9 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.8 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.7 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.6 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.5 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.4 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.3 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.2 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.1 lib/rack/oauth2/client/grant.rb
rack-oauth2-1.0.0 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.14.9 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.14.8 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.14.7 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.14.6 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.14.5 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.14.4 lib/rack/oauth2/client/grant.rb
rack-oauth2-0.14.3 lib/rack/oauth2/client/grant.rb