- B
- C
- E
- I
- M
- P
- R
- U
Instance Public methods
bearer_token() Link
Source: show
# File app/controllers/v2/application_controller.rb, line 30 def bearer_token pattern = /^Bearer / header = request.headers["Authorization"] header.gsub(pattern, "") if header&.match(pattern) end
cors_preflight_check() Link
Source: show
# File app/controllers/v2/application_controller.rb, line 24 def cors_preflight_check return unless request.method == "OPTIONS" head :ok end
e2e_email?() Link
Source: show
# File app/controllers/v2/application_controller.rb, line 50 def e2e_email? params[:email]&.match(/^e2etest/) || params[:new_email]&.match(/^e2etest/) end
info_for_paper_trail() Link
paper_trail gem-specific magic method keywords: PaperTrail, whodunnit
Source: show
# File app/controllers/v2/application_controller.rb, line 79 def info_for_paper_trail { ip:, site_id: widget_site_id, user_agent: request.user_agent } end
ip() Link
Source: show
# File app/controllers/v2/application_controller.rb, line 87 def ip request.remote_ip end
member_ip_address() Link
Source: show
# File app/controllers/v2/application_controller.rb, line 67 def member_ip_address request.env["HTTP_X_REAL_IP"] || ip end
paginate(collection) Link
Helper method for setting pagination headers
Source: show
# File app/controllers/v2/application_controller.rb, line 13 def paginate(collection) headers["X-Page"] = collection.current_page headers["X-Per-Page"] = collection.limit_value headers["X-Total-Pages"] = collection.total_pages headers["X-Total-Count"] = collection.total_count headers["X-Next-Page"] = collection.next_page headers["X-Previous-Page"] = collection.prev_page headers["X-Last-Page"] = collection.last_page? headers["X-First-Page"] = collection.first_page? end
params() Link
override params implementation
Source: show
# File app/controllers/v2/application_controller.rb, line 61 def params ActionController::Parameters.new( request.params.deep_transform_keys!(&:underscore) ) end
recaptcha!() Link
Source: show
# File app/controllers/v2/application_controller.rb, line 36 def recaptcha! return if recaptcha_verifier.verify(params[:captcha], request.ip) return_failed_recaptcha end
recaptcha_verifier() Link
Source: show
# File app/controllers/v2/application_controller.rb, line 42 def recaptcha_verifier if !!ENV["FAKE_RECAPTCHA_FOR_E2ETEST_EMAILS"] && e2e_email? MemberApi::Action::GoogleE2eRecaptcha else Member::GoogleRecaptcha end end