Class: OAuth2::Headers::Authenticate

Inherits:
Object
  • Object
show all
Defined in:
lib/oauth2/headers/authenticate.rb

Constant Summary collapse

Attributes =
[
  :realm, :algorithms, :auth_uri, :token_uri, :error
]

Instance Method Summary collapse

Instance Method Details

#to_hashObject



22
23
24
25
26
27
28
# File 'lib/oauth2/headers/authenticate.rb', line 22

def to_hash
  Attributes.inject(Hash.new) do |hash, attribute|
    value = send(attribute)
    hash[attribute] = value unless value.nil?
    hash
  end
end

#to_sObject



30
31
32
33
34
35
# File 'lib/oauth2/headers/authenticate.rb', line 30

def to_s
  to_hash.collect do |key, value|
    name = key.to_s.gsub('_', '-')
    "#{name}='#{value}'"
  end.join(",\n      ")
end

#valid?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/oauth2/headers/authenticate.rb', line 17

def valid?
  raise "Realm not set" unless realm
  
end