Class: Ncmb::FileStore
Instance Method Summary
collapse
Methods inherited from Client
#batch, #data, #file, #initialize
Constructor Details
This class inherits a constructor from Ncmb::Client
Instance Method Details
#all ⇒ Object
300
301
302
|
# File 'lib/ncmb_rb_wrapper.rb', line 300
def all
super_get('/files')
end
|
#delete(name) ⇒ Object
296
297
298
|
# File 'lib/ncmb_rb_wrapper.rb', line 296
def delete(name)
super("/files/#{name}")
end
|
#get(name) ⇒ Object
284
285
286
287
288
289
290
|
# 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, (signature, current_time))
res.body
}
end
|
#post(file, acl = {}) ⇒ Object
271
272
273
274
275
276
277
278
279
280
281
282
|
# 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)},
(signature, current_time, 'multipart/form-data')
)
res = http.request(req)
JSON.parse(res.body)
}
end
|
#put(name, acl) ⇒ Object
292
293
294
|
# File 'lib/ncmb_rb_wrapper.rb', line 292
def put(name, acl)
super("/files/#{name}/", acl: acl)
end
|
#search(hash_query = {}) ⇒ Object
noinspection RubyArgCount
310
311
312
|
# File 'lib/ncmb_rb_wrapper.rb', line 310
def search(hash_query = {})
super_get('/files', hash_query)
end
|
#super_get ⇒ Object
269
|
# File 'lib/ncmb_rb_wrapper.rb', line 269
alias :super_get :get
|
#where(hash_query) ⇒ Object
noinspection RubyArgCount
305
306
307
|
# File 'lib/ncmb_rb_wrapper.rb', line 305
def where(hash_query)
super_get('/files', where: hash_query)
end
|