Class: ClickSession::Configuration
- Inherits:
-
Object
- Object
- ClickSession::Configuration
- Defined in:
- lib/click_session/configuration.rb
Instance Attribute Summary collapse
-
#failure_callback_url ⇒ Object
Returns the value of attribute failure_callback_url.
-
#serializer_class ⇒ Object
Returns the value of attribute serializer_class.
-
#success_callback_url ⇒ Object
Returns the value of attribute success_callback_url.
Instance Method Summary collapse
- #driver_client ⇒ Object
- #driver_client=(client) ⇒ Object
- #enable_screenshot=(enable) ⇒ Object
- #model_class ⇒ Object
- #model_class=(klass) ⇒ Object
- #notifier_class ⇒ Object
- #notifier_class=(klass) ⇒ Object
- #runner_class ⇒ Object
- #runner_class=(klass) ⇒ Object
- #screenshot ⇒ Object
- #screenshot=(screenshot) ⇒ Object
- #screenshot_enabled? ⇒ Boolean
Instance Attribute Details
#failure_callback_url ⇒ Object
Returns the value of attribute failure_callback_url.
19 20 21 |
# File 'lib/click_session/configuration.rb', line 19 def failure_callback_url @failure_callback_url end |
#serializer_class ⇒ Object
Returns the value of attribute serializer_class.
19 20 21 |
# File 'lib/click_session/configuration.rb', line 19 def serializer_class @serializer_class end |
#success_callback_url ⇒ Object
Returns the value of attribute success_callback_url.
19 20 21 |
# File 'lib/click_session/configuration.rb', line 19 def success_callback_url @success_callback_url end |
Instance Method Details
#driver_client ⇒ Object
87 88 89 |
# File 'lib/click_session/configuration.rb', line 87 def driver_client @driver_client ||= :poltergeist end |
#driver_client=(client) ⇒ Object
91 92 93 |
# File 'lib/click_session/configuration.rb', line 91 def driver_client=(client) @driver_client = client end |
#enable_screenshot=(enable) ⇒ Object
99 100 101 |
# File 'lib/click_session/configuration.rb', line 99 def enable_screenshot=(enable) @screenshot_enabled = enable end |
#model_class ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/click_session/configuration.rb', line 23 def model_class if @model_class == nil raise NameError.new(<<-ERROR.strip_heredoc, 'model_class') To use ClickSession, you must define the name of the active model you want ClickSession to operate on. See https://github.com/talltorp/click_session for more information. ERROR end @model_class.constantize end |
#model_class=(klass) ⇒ Object
35 36 37 |
# File 'lib/click_session/configuration.rb', line 35 def model_class=(klass) @model_class = klass.to_s end |
#notifier_class ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/click_session/configuration.rb', line 69 def notifier_class @notifier_class ||= "ClickSession::Notifier" constantized_notifier = @notifier_class.constantize if notifier_class_violates_interface(constantized_notifier) raise ArgumentError.new(<<-ERROR.strip_heredoc) Your custom notifier must inherit ClickSession::Notifier See https://github.com/talltorp/click_session ERROR end constantized_notifier end |
#notifier_class=(klass) ⇒ Object
83 84 85 |
# File 'lib/click_session/configuration.rb', line 83 def notifier_class=(klass) @notifier_class = klass.to_s end |
#runner_class ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/click_session/configuration.rb', line 39 def runner_class @runner_class ||= begin if Kernel.const_defined?(:ClickSessionRunner) "ClickSessionRunner" else raise NameError.new(<<-ERROR.strip_heredoc, 'ClickSessionRunner') To use ClickSession, you must either define `ClickSessionRunner` or configure a different processor. See https://github.com/talltorp/click_session for more information. ERROR end end @runner_class.constantize end |
#runner_class=(klass) ⇒ Object
56 57 58 |
# File 'lib/click_session/configuration.rb', line 56 def runner_class=(klass) @runner_class = klass.to_s end |
#screenshot ⇒ Object
103 104 105 106 107 108 109 110 111 112 |
# File 'lib/click_session/configuration.rb', line 103 def screenshot if @screenshot == nil raise ArgumentError.new("In order to save screenshots, you need to configure \ the information. https://github.com/talltorp/click_session#optional-configurations-and-extentions ") end @screenshot end |
#screenshot=(screenshot) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/click_session/configuration.rb', line 114 def screenshot=(screenshot) if screenshot[:s3_bucket] == nil raise ArgumentError.new("The s3_bucket is required") end if screenshot[:s3_key_id] == nil raise ArgumentError.new("The s3_key_id is required") end if screenshot[:s3_access_key] == nil raise ArgumentError.new("The s3_access_key is required") end @screenshot = screenshot end |
#screenshot_enabled? ⇒ Boolean
95 96 97 |
# File 'lib/click_session/configuration.rb', line 95 def screenshot_enabled? @screenshot_enabled ||= false end |