Method: OAuth::AccessToken#request

Defined in:
lib/oauth/tokens/access_token.rb

#request(http_method, path, *arguments) ⇒ Object

The less intrusive way. Otherwise, if we are to do it correctly inside consumer, we need to restructure and touch more methods: request(), sign!(), etc.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/oauth/tokens/access_token.rb', line 6

def request(http_method, path, *arguments)
  request_uri = URI.parse(path)
  site_uri = consumer.uri
  is_service_uri_different = (request_uri.absolute? && request_uri != site_uri)
  begin
    consumer.uri(request_uri) if is_service_uri_different
    @response = super(http_method, path, *arguments)
  ensure
    # NOTE: reset for wholesomeness? meaning that we admit only AccessToken service calls may use different URIs?
    # so reset in case consumer is still used for other token-management tasks subsequently?
    consumer.uri(site_uri) if is_service_uri_different
  end
  @response
end