Sha256: 1583802b52d42edc233b08f4f717c42b0e7880c8899edce80404d73a42b7e70c

Contents?: true

Size: 934 Bytes

Versions: 2

Compression:

Stored size: 934 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'rubygems'
require 'ncmb'
require 'yaml'
require 'open-uri'
yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
NCMB.initialize(
  application_key: yaml['application_key'],
  client_key: yaml['client_key']
)

f = NCMB::NFile.new('https://mbaas.nifcloud.com/assets/images/logo.png')
f.acl.public('read', true)
f.acl.public('write', true)
f.fileName = 'test.png'
f.save()
puts 'Uploaded'
f.file = 'http://k.yimg.jp/images/top/sp2/cmn/logo-ns_d_131205.png'
f.update()
puts 'Updated'
f.delete()
puts 'Deleted'

f = NCMB::NFile.new('https://mbaas.nifcloud.com/assets/images/logo.png')
f.acl.public('read', true)
f.acl.public('write', true)
f.fileName = 'test.png'
f.save()
file = NCMB::NFile.new('test.png')
fp = open('test.png', 'w')
fp.write(file.get)
fp.close

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ncmb-ruby-client-0.2.0 examples/file_test.rb
ncmb-ruby-client-0.1.7 examples/file_test.rb