Class: OpenStax::Accounts::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/openstax_accounts.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/openstax_accounts.rb', line 95

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
  super
end

Instance Attribute Details

#account_user_mapperObject

account_user_mapper This class teaches the gem how to convert between accounts and users See the “account_user_mapper” discussion in the README



75
76
77
# File 'lib/openstax_accounts.rb', line 75

def 
  @account_user_mapper
end

#default_errors_added_triggerObject

Returns the value of attribute default_errors_added_trigger.



66
67
68
# File 'lib/openstax_accounts.rb', line 66

def default_errors_added_trigger
  @default_errors_added_trigger
end

#default_errors_html_idObject

Returns the value of attribute default_errors_html_id.



65
66
67
# File 'lib/openstax_accounts.rb', line 65

def default_errors_html_id
  @default_errors_html_id
end

#default_errors_partialObject

Returns the value of attribute default_errors_partial.



64
65
66
# File 'lib/openstax_accounts.rb', line 64

def default_errors_partial
  @default_errors_partial
end

#enable_stubbingObject

enable_stubbing Set to true if you want this engine to fake all interaction with the accounts site.



58
59
60
# File 'lib/openstax_accounts.rb', line 58

def enable_stubbing
  @enable_stubbing
end

#logout_viaObject

logout_via HTTP method to accept for logout requests



62
63
64
# File 'lib/openstax_accounts.rb', line 62

def logout_via
  @logout_via
end

#max_search_itemsObject

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



87
88
89
# File 'lib/openstax_accounts.rb', line 87

def max_search_items
  @max_search_items
end

#min_search_charactersObject

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



81
82
83
# File 'lib/openstax_accounts.rb', line 81

def min_search_characters
  @min_search_characters
end

#openstax_accounts_urlObject

openstax_accounts_url Base URL for OpenStax Accounts



45
46
47
# File 'lib/openstax_accounts.rb', line 45

def openstax_accounts_url
  @openstax_accounts_url
end

#openstax_application_idObject

openstax_application_id OAuth client_id received from OpenStax Accounts



49
50
51
# File 'lib/openstax_accounts.rb', line 49

def openstax_application_id
  @openstax_application_id
end

#openstax_application_secretObject

openstax_application_secret OAuth client_secret received from OpenStax Accounts



53
54
55
# File 'lib/openstax_accounts.rb', line 53

def openstax_application_secret
  @openstax_application_secret
end

#security_transgression_exceptionObject

security_transgression_exception Class to be used for security transgression exceptions



70
71
72
# File 'lib/openstax_accounts.rb', line 70

def security_transgression_exception
  @security_transgression_exception
end

Instance Method Details

#enable_stubbing?Boolean

Returns:

  • (Boolean)


111
112
113
# File 'lib/openstax_accounts.rb', line 111

def enable_stubbing?
  !Rails.env.production? && enable_stubbing
end