Class: Repost::Senpai
Constant Summary collapse
- DEFAULT_SUBMIT_BUTTON_TEXT =
'Continue'
- DEFAULT_CHARSET =
'UTF-8'
Instance Method Summary collapse
-
#initialize(url, params: {}, options: {}) ⇒ Senpai
constructor
A new instance of Senpai.
- #perform ⇒ Object
Methods inherited from Action
Constructor Details
#initialize(url, params: {}, options: {}) ⇒ Senpai
Returns a new instance of Senpai.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/repost/senpai.rb', line 6 def initialize(url, params: {}, options: {}) @url = url @params = params @options = @method = .fetch(:method, :post) @authenticity_token = .fetch(:authenticity_token, nil) @charset = .fetch(:charset, DEFAULT_CHARSET) @form_id = .fetch(:form_id, generated_form_id) @autosubmit = .fetch(:autosubmit, true) @autosubmit_nonce = .fetch(:autosubmit_nonce, nil) @section_classes = .dig(:decor, :section, :classes) @section_html = .dig(:decor, :section, :html) @submit_classes = .dig(:decor, :submit, :classes) @submit_text = .dig(:decor, :submit, :text) || DEFAULT_SUBMIT_BUTTON_TEXT end |
Instance Method Details
#perform ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/repost/senpai.rb', line 22 def perform compiled_body = if autosubmit form_body << auto_submit_script << no_script else form_body << submit_section end form_head << compiled_body << end |