Class: Houston::Provider

Inherits:
Object
  • Object
show all
Defined in:
lib/houston/boot/provider.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Provider

Returns a new instance of Provider.



5
6
7
# File 'lib/houston/boot/provider.rb', line 5

def initialize(name)
  @name = name
end

Instance Attribute Details

#authorize_pathObject

Returns the value of attribute authorize_path.



3
4
5
# File 'lib/houston/boot/provider.rb', line 3

def authorize_path
  @authorize_path
end

#client_idObject

Returns the value of attribute client_id.



3
4
5
# File 'lib/houston/boot/provider.rb', line 3

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



3
4
5
# File 'lib/houston/boot/provider.rb', line 3

def client_secret
  @client_secret
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/houston/boot/provider.rb', line 3

def name
  @name
end

#siteObject

Returns the value of attribute site.



3
4
5
# File 'lib/houston/boot/provider.rb', line 3

def site
  @site
end

#token_pathObject

Returns the value of attribute token_path.



3
4
5
# File 'lib/houston/boot/provider.rb', line 3

def token_path
  @token_path
end

Instance Method Details

#authorize_url(params = {}) ⇒ Object



9
10
11
# File 'lib/houston/boot/provider.rb', line 9

def authorize_url(params={})
  client.auth_code.authorize_url params.merge(redirect_uri: oauth2_callback_url)
end

#redeem_access_token(code, params = {}) ⇒ Object



13
14
15
# File 'lib/houston/boot/provider.rb', line 13

def redeem_access_token(code, params={})
  client.auth_code.get_token(code, params.merge(redirect_uri: oauth2_callback_url))
end

#refresh_access_token(authorization) ⇒ Object



17
18
19
# File 'lib/houston/boot/provider.rb', line 17

def refresh_access_token(authorization)
  OAuth2::AccessToken.from_hash(client, authorization.attributes).refresh!
end