class Pixaven::Request::Upload
Responsible for handling Upload
requests
Public Class Methods
new(key, upload_path, proxy = nil)
click to toggle source
Calls superclass method
Pixaven::Request::Base::new
# File lib/pixaven/request.rb, line 108 def initialize(key, upload_path, proxy = nil) @type = :upload @upload_path = upload_path super(key, proxy) end
Public Instance Methods
perform(binary: false, save_path: nil)
click to toggle source
Calls superclass method
Pixaven::Request::Base#perform
# File lib/pixaven/request.rb, line 114 def perform(binary: false, save_path: nil) unless File.exist?(@upload_path) return "Input file #{@upload_path} does not exist", nil, nil end super end
request_data()
click to toggle source
Returns upload request data. Multipart containing uploaded file and operations performed on it
# File lib/pixaven/request.rb, line 126 def request_data { file: File.new(@upload_path, "rb"), data: @data.to_json } end