Class: Sorcery::Providers::Base
- Inherits:
-
Object
- Object
- Sorcery::Providers::Base
- Defined in:
- lib/sorcery/providers/base.rb
Direct Known Subclasses
Auth0, Battlenet, Discord, Facebook, Github, Google, Heroku, Instagram, Jira, Line, Linkedin, Liveid, Microsoft, Paypal, Salesforce, Slack, Twitter, Vk, Wechat, Xing
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#callback_url ⇒ Object
Returns the value of attribute callback_url.
-
#key ⇒ Object
Returns the value of attribute key.
-
#original_callback_url ⇒ Object
Returns the value of attribute original_callback_url.
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#site ⇒ Object
Returns the value of attribute site.
-
#state ⇒ Object
Returns the value of attribute state.
-
#user_info_mapping ⇒ Object
Returns the value of attribute user_info_mapping.
Class Method Summary collapse
-
.descendants ⇒ Object
Ensure that all descendant classes are loaded before run this.
- .name ⇒ Object
Instance Method Summary collapse
- #auth_hash(access_token, hash = {}) ⇒ Object
- #has_callback? ⇒ Boolean
-
#initialize ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
13 14 15 |
# File 'lib/sorcery/providers/base.rb', line 13 def initialize @user_info_mapping = {} end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/sorcery/providers/base.rb', line 4 def access_token @access_token end |
#callback_url ⇒ Object
Returns the value of attribute callback_url.
6 7 8 |
# File 'lib/sorcery/providers/base.rb', line 6 def callback_url @callback_url end |
#key ⇒ Object
Returns the value of attribute key.
6 7 8 |
# File 'lib/sorcery/providers/base.rb', line 6 def key @key end |
#original_callback_url ⇒ Object
Returns the value of attribute original_callback_url.
6 7 8 |
# File 'lib/sorcery/providers/base.rb', line 6 def original_callback_url @original_callback_url end |
#secret ⇒ Object
Returns the value of attribute secret.
6 7 8 |
# File 'lib/sorcery/providers/base.rb', line 6 def secret @secret end |
#site ⇒ Object
Returns the value of attribute site.
6 7 8 |
# File 'lib/sorcery/providers/base.rb', line 6 def site @site end |
#state ⇒ Object
Returns the value of attribute state.
6 7 8 |
# File 'lib/sorcery/providers/base.rb', line 6 def state @state end |
#user_info_mapping ⇒ Object
Returns the value of attribute user_info_mapping.
6 7 8 |
# File 'lib/sorcery/providers/base.rb', line 6 def user_info_mapping @user_info_mapping end |
Class Method Details
.descendants ⇒ Object
Ensure that all descendant classes are loaded before run this
33 34 35 |
# File 'lib/sorcery/providers/base.rb', line 33 def self.descendants ObjectSpace.each_object(Class).select { |klass| klass < self } end |
.name ⇒ Object
28 29 30 |
# File 'lib/sorcery/providers/base.rb', line 28 def self.name super.gsub(/Sorcery::Providers::/, '').downcase end |
Instance Method Details
#auth_hash(access_token, hash = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sorcery/providers/base.rb', line 17 def auth_hash(access_token, hash = {}) return hash if access_token.nil? token_hash = hash.dup token_hash[:token] = access_token.token if access_token.respond_to?(:token) token_hash[:refresh_token] = access_token.refresh_token if access_token.respond_to?(:refresh_token) token_hash[:expires_at] = access_token.expires_at if access_token.respond_to?(:expires_at) token_hash[:expires_in] = access_token.expires_at if access_token.respond_to?(:expires_in) token_hash end |
#has_callback? ⇒ Boolean
9 10 11 |
# File 'lib/sorcery/providers/base.rb', line 9 def has_callback? true end |