Sha256: c4ba4b3ab28e555207a13543fa8e2ea20061b10b3d8fba9650dcaded1a691a50
Contents?: true
Size: 582 Bytes
Versions: 2
Compression:
Stored size: 582 Bytes
Contents
require 'mime/types' module NCMB class NFile < NCMB::Object include NCMB def initialize(file_path = nil) @fields = {acl: NCMB::Acl.new, file: file_path} if file_path @fields[:fileName] = File.basename(file_path) @fields['mime-type'.to_sym] = MIME::Types.type_for(file_path)[0] end end def save @fields[:file] = open(self.file) super end alias :update :save def path "#{base_path}/#{@fields[:fileName]}" end def base_path "/#{@@client.api_version}/files" end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ncmb-ruby-client-0.1.2 | lib/ncmb/file.rb |
ncmb-ruby-client-0.1.1 | lib/ncmb/file.rb |