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.



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

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.



6
7
8
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 6

def secret
  @secret
end

#tokenObject

Returns the value of attribute token.



6
7
8
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 6

def token
  @token
end

Instance Method Details

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



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

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

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



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

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

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



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

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

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



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

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

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



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

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

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



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 16

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

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

  rsp
end

#sign!(*args) ⇒ Object



49
50
51
# File 'lib/oauth_active_resource/fake_oauth_access_token.rb', line 49

def sign!(*args)
  # do nothing
end