Module: ArgyleHelper
- Defined in:
- app/helpers/argyle_helper.rb
Instance Method Summary collapse
- #plaid_link(options) ⇒ Object
- #plaid_link_form(id, action) ⇒ Object
- #plaid_link_script(id, name, product, env, options) ⇒ Object
Instance Method Details
#plaid_link(options) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 |
# File 'app/helpers/argyle_helper.rb', line 2 def plaid_link() raise Argyle::Error, "Public key must be set in Argyle configuration" unless Argyle.configuration.key raise Argyle::Error, "options[:name] is required for Plaid Link" unless [:name] raise Argyle::Error, "options[:action] is required for Plaid Link" unless [:action] id = [:form_id] || 'plaidForm' product = [:product] || Argyle.configuration.product env = [:env] || Argyle.configuration.env plaid_link_form(id, [:action]) + plaid_link_script(id, [:name], product, env, ) end |
#plaid_link_form(id, action) ⇒ Object
14 15 16 |
# File 'app/helpers/argyle_helper.rb', line 14 def plaid_link_form(id, action) form_tag action, method: 'POST', id: id end |
#plaid_link_script(id, name, product, env, options) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/helpers/argyle_helper.rb', line 18 def plaid_link_script(id, name, product, env, ) data = { 'client-name' => name, 'form-id' => id, 'key' => Argyle.configuration.key, 'product' => product, 'env' => env } data['webhook'] = [:webhook] if [:webhook] data['token'] = [:token] if [:token] data.merge!([:data]) if [:data] javascript_tag '', src: Argyle.configuration.plaid_src, data: data end |