Sha256: 110e8922bef4058a27a2872f02c8264f32beb4aa39c61c0a97dd8fab5a94ff56

Contents?: true

Size: 830 Bytes

Versions: 2

Compression:

Stored size: 830 Bytes

Contents

require 'cgi'
require 'faraday'

module Smartsheet
  module API
    class PathFileSpec
      attr_reader :upload_io, :filename, :content_type, :file_length

      def initialize(path, filename, content_type)
        @file_length = File.size(path)
        @filename = filename.nil? ? File.basename(path) : filename
        @upload_io = Faraday::UploadIO.new(path, content_type, CGI::escape(@filename))
        @content_type = content_type
      end
    end

    class ObjectFileSpec
      attr_reader :upload_io, :filename, :content_type, :file_length

      def initialize(file, filename, file_length, content_type)
        @file_length = file_length
        @filename = filename
        @upload_io = Faraday::UploadIO.new(file, content_type, CGI::escape(filename))
        @content_type = content_type
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
smartsheet-1.0.0.beta.2 lib/smartsheet/api/file_spec.rb
smartsheet-1.0.0.beta.0 lib/smartsheet/api/file_spec.rb