Class: OAuth2::AccessToken

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, token) ⇒ AccessToken

Returns a new instance of AccessToken.



5
6
7
8
# File 'lib/oauth2/access_token.rb', line 5

def initialize(client, token)
  @client = client
  @token = token
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



3
4
5
# File 'lib/oauth2/access_token.rb', line 3

def client
  @client
end

#tokenObject (readonly)

Returns the value of attribute token.



3
4
5
# File 'lib/oauth2/access_token.rb', line 3

def token
  @token
end

Instance Method Details

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



26
27
28
# File 'lib/oauth2/access_token.rb', line 26

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

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



14
15
16
# File 'lib/oauth2/access_token.rb', line 14

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

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



18
19
20
# File 'lib/oauth2/access_token.rb', line 18

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

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



22
23
24
# File 'lib/oauth2/access_token.rb', line 22

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

#request(verb, path, params = {}, headers = {}) ⇒ Object



10
11
12
# File 'lib/oauth2/access_token.rb', line 10

def request(verb, path, params = {}, headers = {})
  @client.request(verb, path, params.merge('access_token' => @token), headers)
end