Class: OAuthActiveResource::FakeOAuthAccessToken

Inherits:
OAuth::Consumer
  • Object
show all
Defined in:
lib/oauth_active_resource/fake_oauth_access_token.rb

Overview

just simulates the request and sign! methods of a oauth access token

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeFakeOAuthAccessToken

Returns a new instance of FakeOAuthAccessToken.



5
6
7
8
9
10
11
12
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 5

def initialize()
  @key    = nil
  token   = 'Anonymous'
  secret  = 'Anonymous'
  
  # ensure that keys are symbols
  @options = @@default_options
end

Instance Attribute Details

#secretObject

Returns the value of attribute secret.



4
5
6
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 4

def secret
  @secret
end

#tokenObject

Returns the value of attribute token.



4
5
6
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 4

def token
  @token
end

Instance Method Details

#delete(path, headers = {}) ⇒ Object



40
41
42
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 40

def delete(path, headers = {})
  request(:delete, path, headers)
end

#get(path, headers = {}) ⇒ Object



24
25
26
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 24

def get(path, headers = {})
  request(:get, path, headers)
end

#head(path, headers = {}) ⇒ Object



28
29
30
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 28

def head(path, headers = {})
  request(:head, path, headers)
end

#post(path, body = '', headers = {}) ⇒ Object



32
33
34
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 32

def post(path, body = '', headers = {})
  request(:post, path, body, headers)
end

#put(path, body = '', headers = {}) ⇒ Object



36
37
38
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 36

def put(path, body = '', headers = {})
  request(:put, path, body, headers)
end

#request(http_method, path, token = nil, request_options = {}, *arguments) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 14

def request(http_method, path, token = nil, request_options = {}, *arguments)
  if path !~ /^\//
    @http = create_http(path)
    _uri = URI.parse(path)
    path = "#{_uri.path}#{_uri.query ? "?#{_uri.query}" : ""}"
  end

  http.request(create_http_request(http_method, path, token, request_options, *arguments))
end

#sign!(*args) ⇒ Object



44
45
46
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 44

def sign!(*args)
  # do nothing
end