Class: AuthRocket::AuthProvider
- Inherits:
-
Resource
- Object
- Resource
- AuthRocket::AuthProvider
- Defined in:
- lib/authrocket/auth_provider.rb
Instance Attribute Summary collapse
-
#auth_url ⇒ Object
readonly
readonly.
-
#authorization_url ⇒ Object
readonly
Returns the value of attribute authorization_url.
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#email_field ⇒ Object
readonly
Returns the value of attribute email_field.
-
#email_verified_field ⇒ Object
readonly
Returns the value of attribute email_verified_field.
-
#first_name_field ⇒ Object
readonly
Returns the value of attribute first_name_field.
-
#id_field ⇒ Object
readonly
Returns the value of attribute id_field.
-
#last_name_field ⇒ Object
readonly
Returns the value of attribute last_name_field.
-
#loginrocket_domain ⇒ Object
readonly
Returns the value of attribute loginrocket_domain.
-
#min_complexity ⇒ Object
readonly
Returns the value of attribute min_complexity.
-
#min_length ⇒ Object
readonly
Returns the value of attribute min_length.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#name_field ⇒ Object
readonly
Returns the value of attribute name_field.
-
#profile_url ⇒ Object
readonly
Returns the value of attribute profile_url.
-
#provider_type ⇒ Object
readonly
Returns the value of attribute provider_type.
-
#required_chars ⇒ Object
readonly
Returns the value of attribute required_chars.
-
#scopes ⇒ Object
readonly
Returns the value of attribute scopes.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#token_url ⇒ Object
readonly
Returns the value of attribute token_url.
Class Method Summary collapse
-
.authorize(attribs = {}) ⇒ Object
attribs - :code - required - :nonce - optional - :state - required returns: Session always returns a new object; check .errors? or .valid? to see how it went.
-
.authorize_url(auth_provider_id, attribs = {}) ⇒ Object
attribs - :redirect_uri - required - :nonce - optional returns: simplified AuthProvider.
-
.authorize_urls(attribs = {}) ⇒ Object
attribs - :redirect_uri - required - :nonce - optional returns: Array of simplified AuthProviders.
Instance Method Summary collapse
-
#authorize_token(attribs = {}) ⇒ Object
attribs - :access_token - required returns: Session always returns a new object; check .errors? or .valid? to see how it went.
-
#authorize_url(attribs = {}) ⇒ Object
same as self.authorize_url(self.id, …).
Instance Attribute Details
#auth_url ⇒ Object (readonly)
readonly
13 14 15 |
# File 'lib/authrocket/auth_provider.rb', line 13 def auth_url @auth_url end |
#authorization_url ⇒ Object (readonly)
Returns the value of attribute authorization_url.
11 12 13 |
# File 'lib/authrocket/auth_provider.rb', line 11 def @authorization_url end |
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
9 10 11 |
# File 'lib/authrocket/auth_provider.rb', line 9 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
9 10 11 |
# File 'lib/authrocket/auth_provider.rb', line 9 def client_secret @client_secret end |
#email_field ⇒ Object (readonly)
Returns the value of attribute email_field.
12 13 14 |
# File 'lib/authrocket/auth_provider.rb', line 12 def email_field @email_field end |
#email_verified_field ⇒ Object (readonly)
Returns the value of attribute email_verified_field.
12 13 14 |
# File 'lib/authrocket/auth_provider.rb', line 12 def email_verified_field @email_verified_field end |
#first_name_field ⇒ Object (readonly)
Returns the value of attribute first_name_field.
12 13 14 |
# File 'lib/authrocket/auth_provider.rb', line 12 def first_name_field @first_name_field end |
#id_field ⇒ Object (readonly)
Returns the value of attribute id_field.
12 13 14 |
# File 'lib/authrocket/auth_provider.rb', line 12 def id_field @id_field end |
#last_name_field ⇒ Object (readonly)
Returns the value of attribute last_name_field.
12 13 14 |
# File 'lib/authrocket/auth_provider.rb', line 12 def last_name_field @last_name_field end |
#loginrocket_domain ⇒ Object (readonly)
Returns the value of attribute loginrocket_domain.
10 11 12 |
# File 'lib/authrocket/auth_provider.rb', line 10 def loginrocket_domain @loginrocket_domain end |
#min_complexity ⇒ Object (readonly)
Returns the value of attribute min_complexity.
8 9 10 |
# File 'lib/authrocket/auth_provider.rb', line 8 def min_complexity @min_complexity end |
#min_length ⇒ Object (readonly)
Returns the value of attribute min_length.
8 9 10 |
# File 'lib/authrocket/auth_provider.rb', line 8 def min_length @min_length end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/authrocket/auth_provider.rb', line 7 def name @name end |
#name_field ⇒ Object (readonly)
Returns the value of attribute name_field.
12 13 14 |
# File 'lib/authrocket/auth_provider.rb', line 12 def name_field @name_field end |
#profile_url ⇒ Object (readonly)
Returns the value of attribute profile_url.
11 12 13 |
# File 'lib/authrocket/auth_provider.rb', line 11 def profile_url @profile_url end |
#provider_type ⇒ Object (readonly)
Returns the value of attribute provider_type.
7 8 9 |
# File 'lib/authrocket/auth_provider.rb', line 7 def provider_type @provider_type end |
#required_chars ⇒ Object (readonly)
Returns the value of attribute required_chars.
8 9 10 |
# File 'lib/authrocket/auth_provider.rb', line 8 def required_chars @required_chars end |
#scopes ⇒ Object (readonly)
Returns the value of attribute scopes.
9 10 11 |
# File 'lib/authrocket/auth_provider.rb', line 9 def scopes @scopes end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
7 8 9 |
# File 'lib/authrocket/auth_provider.rb', line 7 def state @state end |
#token_url ⇒ Object (readonly)
Returns the value of attribute token_url.
11 12 13 |
# File 'lib/authrocket/auth_provider.rb', line 11 def token_url @token_url end |
Class Method Details
.authorize(attribs = {}) ⇒ Object
attribs - :code - required
- :nonce - optional
- :state - required
returns: Session always returns a new object; check .errors? or .valid? to see how it went
63 64 65 66 67 |
# File 'lib/authrocket/auth_provider.rb', line 63 def (attribs={}) params = parse_request_params(attribs) parsed, creds = request(:post, resource_path+'/authorize', params) factory(parsed, creds) end |
.authorize_url(auth_provider_id, attribs = {}) ⇒ Object
attribs - :redirect_uri - required
- :nonce - optional
returns: simplified AuthProvider
51 52 53 54 55 56 |
# File 'lib/authrocket/auth_provider.rb', line 51 def (auth_provider_id, attribs={}) params = parse_request_params(attribs) parsed, creds = request(:get, resource_path+"/#{CGI.escape auth_provider_id}/authorize", params) raise QueryError, parsed[:errors] if parsed[:errors].any? factory(parsed, creds) end |
.authorize_urls(attribs = {}) ⇒ Object
attribs - :redirect_uri - required
- :nonce - optional
returns: Array of simplified AuthProviders
36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/authrocket/auth_provider.rb', line 36 def (attribs={}) params = parse_request_params(attribs) parsed, creds = request(:get, resource_path+'/authorize', params) raise QueryError, parsed[:errors] if parsed[:errors].any? NCore::Collection.new.tap do |coll| coll. = parsed[:metadata] parsed[:data].each do |hash| coll << factory({data: hash, metadata: parsed[:metadata]}, creds) end end end |
Instance Method Details
#authorize_token(attribs = {}) ⇒ Object
attribs - :access_token - required returns: Session always returns a new object; check .errors? or .valid? to see how it went
24 25 26 27 28 |
# File 'lib/authrocket/auth_provider.rb', line 24 def (attribs={}) params = parse_request_params(attribs) parsed, creds = request(:post, resource_path+'/authorize', params) self.class.factory(parsed, creds) end |
#authorize_url(attribs = {}) ⇒ Object
same as self.authorize_url(self.id, …)
17 18 19 |
# File 'lib/authrocket/auth_provider.rb', line 17 def (attribs={}) self.class. id, attribs.reverse_merge(credentials: api_creds) end |