class Ncmb::FileStore

Public Instance Methods

all() click to toggle source
# File lib/ncmb_rb_wrapper.rb, line 300
def all
  super_get('/files')
end
delete(name) click to toggle source
Calls superclass method Ncmb::Client#delete
# File lib/ncmb_rb_wrapper.rb, line 296
def delete(name)
  super("/files/#{name}")
end
get(name) click to toggle source
# File lib/ncmb_rb_wrapper.rb, line 284
def get(name)
  path = "/files/#{name}"
  request(:GET, path) { |http, path, current_time, signature|
    res = http.get(path, header(signature, current_time))
    res.body
  }
end
Also aliased as: super_get
post(file, acl = {}) click to toggle source
# File lib/ncmb_rb_wrapper.rb, line 271
def post(file, acl = {})
  name = File.basename(file)
  path = "/files/#{name}"
  request(:POST, path, acl) { |http, path, current_time, signature|
    req = Net::HTTP::Post::Multipart.new(
      path, {file: UploadIO.new(file, MimeMagic.by_path(name).to_s)},
      header(signature, current_time, 'multipart/form-data')
    )
    res = http.request(req)
    JSON.parse(res.body)
  }
end
put(name, acl) click to toggle source
Calls superclass method Ncmb::Client#put
# File lib/ncmb_rb_wrapper.rb, line 292
def put(name, acl)
  super("/files/#{name}/", acl: acl)
end
super_get(name)
Alias for: get
where(hash_query) click to toggle source

noinspection RubyArgCount

# File lib/ncmb_rb_wrapper.rb, line 305
def where(hash_query)
  super_get('/files', where: hash_query)
end