Class: Object

Inherits:
BasicObject
Defined in:
lib/rail-locator-api/api_request.rb

Instance Method Summary collapse

Instance Method Details

#to_params(key) ⇒ Object



400
401
402
403
404
405
406
407
408
409
410
411
412
413
# File 'lib/rail-locator-api/api_request.rb', line 400

def to_params(key)
  if self.is_a? ActionDispatch::Http::UploadedFile
    [key.to_param, File.open(self.path),
       {
        :filename => self.original_filename,
        :content_type => self.content_type
       }
    ]
  elsif %w[File Tempfile StringIO].include?(self.class.name)
    self
  else
    [key.to_param, to_param.to_s]
  end
end