module Transloadit::Rails::ParamsDecoder

Public Instance Methods

decode_transloadit_json() click to toggle source
# File lib/transloadit/rails/params_decoder.rb, line 14
def decode_transloadit_json
  params[:transloadit] = transloadit_params
end
transloadit?() click to toggle source

Returns true if the current request has transloadit data.

# File lib/transloadit/rails/params_decoder.rb, line 19
def transloadit?
  params[:transloadit].present?
end
transloadit_params() click to toggle source

Returns the decoded transloadit parameters, or nil if the current request does not contain them.

# File lib/transloadit/rails/params_decoder.rb, line 24
def transloadit_params
  return unless transloadit?

  # wrap transloadit params in a HashWithIndifferentAccess
  ActiveSupport::HashWithIndifferentAccess.new(
    ActiveSupport::JSON.decode params[:transloadit]
  )
end