Sha256: e2162dd46e3b3059ea978ff662d7efbb1202dfc151cfe7d7e6f1958953e52c41
Contents?: true
Size: 694 Bytes
Versions: 3
Compression:
Stored size: 694 Bytes
Contents
# frozen_string_literal: true 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 @content = nil end def save @fields[:file] = open(self.file) super end alias :update :save def get @content = @@client.get path end def path "#{base_path}/#{@fields[:fileName]}" end def base_path "/#{@@client.api_version}/files" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ncmb-ruby-client-0.1.6 | lib/ncmb/file.rb |
ncmb-ruby-client-0.1.5 | lib/ncmb/file.rb |
ncmb-ruby-client-0.1.4 | lib/ncmb/file.rb |