Class: OpenStax::Accounts::Configuration
- Inherits:
-
Object
- Object
- OpenStax::Accounts::Configuration
- Defined in:
- lib/openstax/accounts/configuration.rb
Instance Attribute Summary collapse
-
#account_user_mapper ⇒ Object
account_user_mapper This class teaches the gem how to convert between accounts and users See the “account_user_mapper” discussion in the README.
-
#default_errors_added_trigger ⇒ Object
Returns the value of attribute default_errors_added_trigger.
-
#default_errors_html_id ⇒ Object
Returns the value of attribute default_errors_html_id.
-
#default_errors_partial ⇒ Object
Returns the value of attribute default_errors_partial.
-
#enable_stubbing ⇒ Object
enable_stubbing Set to true if you want this engine to fake all interaction with the accounts site.
-
#forwardable_login_param_keys ⇒ Object
forwardable_login_param_keys Which params are forwarded on the accounts login path.
- #logout_redirect_url(request) ⇒ Object
-
#logout_via ⇒ Object
logout_via HTTP method to accept for logout requests.
-
#max_search_items ⇒ Object
max_search_items The maximum number of accounts that can be returned in a call to the AccountsSearch handler If more would be returned, the result will be empty instead.
-
#max_user_updates_per_request ⇒ Object
max_user_updates_per_request When the user profile sync operation is called, this parameter will limit the number of returned profile updates from Accounts; helpful when all accounts have been marked as updated on Accounts so that we don’t get overloaded.
-
#min_search_characters ⇒ Object
min_search_characters The minimum number of characters that can be used as a query in a call to the AccountsSearch handler If less are used, the handler will return an error instead.
-
#openstax_accounts_url ⇒ Object
openstax_accounts_url Base URL for OpenStax Accounts.
-
#openstax_application_id ⇒ Object
openstax_application_id OAuth client_id received from OpenStax Accounts.
-
#openstax_application_secret ⇒ Object
openstax_application_secret OAuth client_secret received from OpenStax Accounts.
-
#return_to_url_approver ⇒ Object
writeonly
Sets the attribute return_to_url_approver.
-
#security_transgression_exception ⇒ Object
security_transgression_exception Class to be used for security transgression exceptions.
Instance Method Summary collapse
- #default_logout_redirect_url ⇒ Object
- #enable_stubbing? ⇒ Boolean
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #is_return_to_url_approved?(return_to_url) ⇒ Boolean
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/openstax/accounts/configuration.rb', line 93 def initialize @openstax_application_id = 'SET ME!' @openstax_application_secret = 'SET ME!' @openstax_accounts_url = 'https://accounts.openstax.org/' @enable_stubbing = true @logout_via = :get @default_errors_partial = 'openstax/accounts/shared/attention' @default_errors_html_id = 'openstax-accounts-attention' @default_errors_added_trigger = 'openstax-accounts-errors-added' @security_transgression_exception = SecurityTransgression @account_user_mapper = OpenStax::Accounts::DefaultAccountUserMapper @min_search_characters = 3 @max_search_items = 10 @logout_redirect_url = nil @return_to_url_approver = nil @forwardable_login_param_keys = [ :signup_at, :go, :sp # "signed payload"; "sp" for short to keep nested parameter names short ] @max_user_updates_per_request = 250 super end |
Instance Attribute Details
#account_user_mapper ⇒ Object
account_user_mapper This class teaches the gem how to convert between accounts and users See the “account_user_mapper” discussion in the README
42 43 44 |
# File 'lib/openstax/accounts/configuration.rb', line 42 def account_user_mapper @account_user_mapper end |
#default_errors_added_trigger ⇒ Object
Returns the value of attribute default_errors_added_trigger.
33 34 35 |
# File 'lib/openstax/accounts/configuration.rb', line 33 def default_errors_added_trigger @default_errors_added_trigger end |
#default_errors_html_id ⇒ Object
Returns the value of attribute default_errors_html_id.
32 33 34 |
# File 'lib/openstax/accounts/configuration.rb', line 32 def default_errors_html_id @default_errors_html_id end |
#default_errors_partial ⇒ Object
Returns the value of attribute default_errors_partial.
31 32 33 |
# File 'lib/openstax/accounts/configuration.rb', line 31 def default_errors_partial @default_errors_partial end |
#enable_stubbing ⇒ Object
enable_stubbing Set to true if you want this engine to fake all interaction with the accounts site.
25 26 27 |
# File 'lib/openstax/accounts/configuration.rb', line 25 def enable_stubbing @enable_stubbing end |
#forwardable_login_param_keys ⇒ Object
forwardable_login_param_keys Which params are forwarded on the accounts login path
65 66 67 |
# File 'lib/openstax/accounts/configuration.rb', line 65 def forwardable_login_param_keys @forwardable_login_param_keys end |
#logout_redirect_url(request) ⇒ Object
74 75 76 77 78 79 |
# File 'lib/openstax/accounts/configuration.rb', line 74 def logout_redirect_url(request) (@logout_redirect_url.is_a?(Proc) ? @logout_redirect_url.call(request) : @logout_redirect_url) || default_logout_redirect_url end |
#logout_via ⇒ Object
logout_via HTTP method to accept for logout requests
29 30 31 |
# File 'lib/openstax/accounts/configuration.rb', line 29 def logout_via @logout_via end |
#max_search_items ⇒ Object
max_search_items The maximum number of accounts that can be returned in a call to the AccountsSearch handler If more would be returned, the result will be empty instead
54 55 56 |
# File 'lib/openstax/accounts/configuration.rb', line 54 def max_search_items @max_search_items end |
#max_user_updates_per_request ⇒ Object
max_user_updates_per_request When the user profile sync operation is called, this parameter will limit the number of returned profile updates from Accounts; helpful when all accounts have been marked as updated on Accounts so that we don’t get overloaded.
72 73 74 |
# File 'lib/openstax/accounts/configuration.rb', line 72 def max_user_updates_per_request @max_user_updates_per_request end |
#min_search_characters ⇒ Object
min_search_characters The minimum number of characters that can be used as a query in a call to the AccountsSearch handler If less are used, the handler will return an error instead
48 49 50 |
# File 'lib/openstax/accounts/configuration.rb', line 48 def min_search_characters @min_search_characters end |
#openstax_accounts_url ⇒ Object
openstax_accounts_url Base URL for OpenStax Accounts
6 7 8 |
# File 'lib/openstax/accounts/configuration.rb', line 6 def openstax_accounts_url @openstax_accounts_url end |
#openstax_application_id ⇒ Object
openstax_application_id OAuth client_id received from OpenStax Accounts
16 17 18 |
# File 'lib/openstax/accounts/configuration.rb', line 16 def openstax_application_id @openstax_application_id end |
#openstax_application_secret ⇒ Object
openstax_application_secret OAuth client_secret received from OpenStax Accounts
20 21 22 |
# File 'lib/openstax/accounts/configuration.rb', line 20 def openstax_application_secret @openstax_application_secret end |
#return_to_url_approver=(value) ⇒ Object (writeonly)
Sets the attribute return_to_url_approver
85 86 87 |
# File 'lib/openstax/accounts/configuration.rb', line 85 def return_to_url_approver=(value) @return_to_url_approver = value end |
#security_transgression_exception ⇒ Object
security_transgression_exception Class to be used for security transgression exceptions
37 38 39 |
# File 'lib/openstax/accounts/configuration.rb', line 37 def security_transgression_exception @security_transgression_exception end |
Instance Method Details
#default_logout_redirect_url ⇒ Object
81 82 83 |
# File 'lib/openstax/accounts/configuration.rb', line 81 def default_logout_redirect_url URI.join(openstax_accounts_url, "logout").to_s end |
#enable_stubbing? ⇒ Boolean
117 118 119 |
# File 'lib/openstax/accounts/configuration.rb', line 117 def enable_stubbing? !Rails.env.production? && enable_stubbing end |
#is_return_to_url_approved?(return_to_url) ⇒ Boolean
87 88 89 90 91 |
# File 'lib/openstax/accounts/configuration.rb', line 87 def is_return_to_url_approved?(return_to_url) return_to_url && @return_to_url_approver.is_a?(Proc) && @return_to_url_approver.call(return_to_url) end |