Class: GrapeTokenAuth::OmniAuthSuccessHTML
- Inherits:
-
OmniAuthHTMLBase
- Object
- OmniAuthHTMLBase
- GrapeTokenAuth::OmniAuthSuccessHTML
- Extended by:
- Forwardable
- Defined in:
- lib/grape_token_auth/omniauth/omniauth_success_html.rb
Constant Summary collapse
- SUCCESS_MESSAGE =
'deliverCredentials'
Class Method Summary collapse
Instance Method Summary collapse
- #auth_origin_url ⇒ Object
- #full_redirect_url ⇒ Object
-
#initialize(oauth_resource, auth_hash, omniauth_params) ⇒ OmniAuthSuccessHTML
constructor
A new instance of OmniAuthSuccessHTML.
- #json_post_data ⇒ Object
- #window_type ⇒ Object
Methods inherited from OmniAuthHTMLBase
Constructor Details
#initialize(oauth_resource, auth_hash, omniauth_params) ⇒ OmniAuthSuccessHTML
Returns a new instance of OmniAuthSuccessHTML.
10 11 12 13 14 |
# File 'lib/grape_token_auth/omniauth/omniauth_success_html.rb', line 10 def initialize(oauth_resource, auth_hash, omniauth_params) @oauth_resource = oauth_resource @auth_hash = auth_hash @omniauth_params = omniauth_params end |
Class Method Details
.build(resource_class, auth_hash, omniauth_params) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/grape_token_auth/omniauth/omniauth_success_html.rb', line 16 def self.build(resource_class, auth_hash, omniauth_params) oauth_resource = OmniAuthResource.fetch_or_create(resource_class, auth_hash, omniauth_params) new(oauth_resource, auth_hash, omniauth_params) end |
Instance Method Details
#auth_origin_url ⇒ Object
23 24 25 |
# File 'lib/grape_token_auth/omniauth/omniauth_success_html.rb', line 23 def auth_origin_url @omniauth_params['auth_origin_url'] || @omniauth_params[:auth_origin_url] end |
#full_redirect_url ⇒ Object
32 33 34 |
# File 'lib/grape_token_auth/omniauth/omniauth_success_html.rb', line 32 def full_redirect_url "#{auth_origin_url}?#{auth_origin_query_params.to_query}" end |
#json_post_data ⇒ Object
36 37 38 39 40 |
# File 'lib/grape_token_auth/omniauth/omniauth_success_html.rb', line 36 def json_post_data success_attributes = { 'message' => SUCCESS_MESSAGE, 'config' => omniauth_params['config'] } oauth_resource.attributes.merge(success_attributes).to_json end |
#window_type ⇒ Object
27 28 29 30 |
# File 'lib/grape_token_auth/omniauth/omniauth_success_html.rb', line 27 def window_type @omniauth_params['omniauth_window_type'] || @omniauth_params[:omniauth_window_type] end |