Class: OAuth::Server
- Inherits:
-
Object
show all
- Includes:
- Helper
- Defined in:
- lib/oauth/server.rb
Overview
This is mainly used to create consumer credentials and can pretty much be
ignored if you want to create your own
Constant Summary
- @@server_paths =
{
:request_token_path => "/oauth/request_token",
:authorize_path => "/oauth/authorize",
:access_token_path => "/oauth/access_token"
}
Instance Attribute Summary (collapse)
Instance Method Summary
(collapse)
Methods included from Helper
#escape, #generate_key, #generate_timestamp, #normalize, #parse_header, #stringify_keys, #unescape
Constructor Details
- (Server) initialize(base_url, paths = {})
Create a new server instance
17
18
19
20
|
# File 'lib/oauth/server.rb', line 17
def initialize(base_url, paths = {})
@base_url = base_url
@paths = @@server_paths.merge(paths)
end
|
Instance Attribute Details
- (Object) base_url
Returns the value of attribute base_url
8
9
10
|
# File 'lib/oauth/server.rb', line 8
def base_url
@base_url
end
|
Instance Method Details
- (Object) access_token_path
58
59
60
|
# File 'lib/oauth/server.rb', line 58
def access_token_path
@paths[:access_token_path]
end
|
- (Object) access_token_url
62
63
64
|
# File 'lib/oauth/server.rb', line 62
def access_token_url
base_url + access_token_path
end
|
- (Object) authorize_path
50
51
52
|
# File 'lib/oauth/server.rb', line 50
def authorize_path
@paths[:authorize_path]
end
|
- (Object) authorize_url
54
55
56
|
# File 'lib/oauth/server.rb', line 54
def authorize_url
base_url + authorize_path
end
|
- (Object) create_consumer
mainly for testing purposes
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/oauth/server.rb', line 31
def create_consumer
creds = generate_credentials
Consumer.new(creds[0], creds[1],
{
:site => base_url,
:request_token_path => request_token_path,
:authorize_path => authorize_path,
:access_token_path => access_token_path
})
end
|
- (Object) generate_consumer_credentials(params = {})
26
27
28
|
# File 'lib/oauth/server.rb', line 26
def generate_consumer_credentials(params = {})
Consumer.new(*generate_credentials)
end
|
- (Object) generate_credentials
22
23
24
|
# File 'lib/oauth/server.rb', line 22
def generate_credentials
[generate_key(16), generate_key]
end
|
- (Object) request_token_path
42
43
44
|
# File 'lib/oauth/server.rb', line 42
def request_token_path
@paths[:request_token_path]
end
|
- (Object) request_token_url
46
47
48
|
# File 'lib/oauth/server.rb', line 46
def request_token_url
base_url + request_token_path
end
|