Class: LsaTdxFeedback::Configuration
- Inherits:
-
Object
- Object
- LsaTdxFeedback::Configuration
- Defined in:
- lib/lsa_tdx_feedback/configuration.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#api_base_url ⇒ Object
Returns the value of attribute api_base_url.
-
#app_id ⇒ Object
Returns the value of attribute app_id.
-
#cache_expiry ⇒ Object
Returns the value of attribute cache_expiry.
-
#cache_store ⇒ Object
Returns the value of attribute cache_store.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#default_classification ⇒ Object
Returns the value of attribute default_classification.
-
#default_form_id ⇒ Object
Returns the value of attribute default_form_id.
-
#default_priority_id ⇒ Object
Returns the value of attribute default_priority_id.
-
#default_responsible_group_id ⇒ Object
Returns the value of attribute default_responsible_group_id.
-
#default_service_id ⇒ Object
Returns the value of attribute default_service_id.
-
#default_source_id ⇒ Object
Returns the value of attribute default_source_id.
-
#default_status_id ⇒ Object
Returns the value of attribute default_status_id.
-
#default_type_id ⇒ Object
Returns the value of attribute default_type_id.
-
#oauth_url ⇒ Object
Returns the value of attribute oauth_url.
-
#service_offering_id ⇒ Object
Returns the value of attribute service_offering_id.
Instance Method Summary collapse
- #debug_info ⇒ Object
- #grant_type ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #oauth_scope ⇒ Object
- #valid? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 9 def initialize # All values must be configured by the application for security @oauth_url = nil @api_base_url = nil @client_id = nil @client_secret = nil @app_id = nil @default_type_id = nil @default_form_id = nil @default_classification = nil @default_status_id = nil @default_priority_id = nil @default_source_id = nil @default_responsible_group_id = nil @default_service_id = nil @service_offering_id = nil @account_id = nil # Cache configuration @cache_store = :redis_cache_store @cache_expiry = 3600 # 1 hour for OAuth tokens end |
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def account_id @account_id end |
#api_base_url ⇒ Object
Returns the value of attribute api_base_url.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def api_base_url @api_base_url end |
#app_id ⇒ Object
Returns the value of attribute app_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def app_id @app_id end |
#cache_expiry ⇒ Object
Returns the value of attribute cache_expiry.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def cache_expiry @cache_expiry end |
#cache_store ⇒ Object
Returns the value of attribute cache_store.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def cache_store @cache_store end |
#client_id ⇒ Object
Returns the value of attribute client_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def client_secret @client_secret end |
#default_classification ⇒ Object
Returns the value of attribute default_classification.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def default_classification @default_classification end |
#default_form_id ⇒ Object
Returns the value of attribute default_form_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def default_form_id @default_form_id end |
#default_priority_id ⇒ Object
Returns the value of attribute default_priority_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def default_priority_id @default_priority_id end |
#default_responsible_group_id ⇒ Object
Returns the value of attribute default_responsible_group_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def default_responsible_group_id @default_responsible_group_id end |
#default_service_id ⇒ Object
Returns the value of attribute default_service_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def default_service_id @default_service_id end |
#default_source_id ⇒ Object
Returns the value of attribute default_source_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def default_source_id @default_source_id end |
#default_status_id ⇒ Object
Returns the value of attribute default_status_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def default_status_id @default_status_id end |
#default_type_id ⇒ Object
Returns the value of attribute default_type_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def default_type_id @default_type_id end |
#oauth_url ⇒ Object
Returns the value of attribute oauth_url.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def oauth_url @oauth_url end |
#service_offering_id ⇒ Object
Returns the value of attribute service_offering_id.
3 4 5 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 3 def service_offering_id @service_offering_id end |
Instance Method Details
#debug_info ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 76 def debug_info { oauth_url: oauth_url, api_base_url: api_base_url, client_id: client_id ? "#{client_id[0..4]}..." : nil, client_secret: client_secret ? "#{client_secret[0..4]}..." : nil, app_id: app_id, grant_type: grant_type, oauth_scope: oauth_scope, valid: valid? } end |
#grant_type ⇒ Object
36 37 38 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 36 def grant_type 'client_credentials' end |
#oauth_scope ⇒ Object
32 33 34 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 32 def oauth_scope 'https://gw-test.api.it.umich.edu/um/it tdxticket' end |
#valid? ⇒ Boolean
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 40 def valid? !oauth_url.nil? && !oauth_url.empty? && !api_base_url.nil? && !api_base_url.empty? && !client_id.nil? && !client_id.empty? && !client_secret.nil? && !client_secret.empty? && !app_id.nil? && !default_type_id.nil? && !default_form_id.nil? && !default_classification.nil? && (default_classification.is_a?(String) ? !default_classification.empty? : true) && !default_status_id.nil? && !default_priority_id.nil? && !default_source_id.nil? && !default_responsible_group_id.nil? && !default_service_id.nil? && !service_offering_id.nil? && !account_id.nil? end |
#validate! ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/lsa_tdx_feedback/configuration.rb', line 58 def validate! raise Error, 'oauth_url is required' unless oauth_url && !oauth_url.empty? raise Error, 'api_base_url is required' unless api_base_url && !api_base_url.empty? raise Error, 'client_id is required' unless client_id && !client_id.empty? raise Error, 'client_secret is required' unless client_secret && !client_secret.empty? raise Error, 'app_id is required' unless app_id raise Error, 'default_type_id is required' unless default_type_id raise Error, 'default_form_id is required' unless default_form_id raise Error, 'default_classification is required' unless default_classification && (default_classification.is_a?(String) ? !default_classification.empty? : true) raise Error, 'default_status_id is required' unless default_status_id raise Error, 'default_priority_id is required' unless default_priority_id raise Error, 'default_source_id is required' unless default_source_id raise Error, 'default_responsible_group_id is required' unless default_responsible_group_id raise Error, 'default_service_id is required' unless default_service_id raise Error, 'service_offering_id is required' unless service_offering_id raise Error, 'account_id is required' unless account_id end |