ncmb_rb_wrapper

Ruby wrapper for NIFTY Cloud mobile backend REST API.

NIFTY Cloud mobile backend

  • Free for Basic Plan
  • 2,000,000 API requests/month
  • 2,000,000 Push Notifications/month
  • 5GB Object Storage
  • And more...

Installation

Add to Gemlist

gem 'ncmb_rb_wrapper', :github => 'yutaszk/ncmb_rb_wrapper'

Usage

RestClient

Client class wrap API request. Please refer to REST API Reference

@ncmb = Ncmb::Client.new(application_key, client_key)
@ncmb.get("/classes/app/") #=> all object in 'App' class

DataStore

@app = Ncmb::DataStore.new(application_key, client_key, 'App')
@app.post({foo: :bar})
@app.get(id}
@app.put(id, {foo: :baz})
@app.delete(id)
@app.all()
@app.search(where: {foo: :bar})
@app.where({foo: :bar})
@app.batch_post([{foo: :bar}, {one: 1, two:2}])
@app.batch_put([{id: ID, query: {foo: baz}, {id: ID, query: {one: :first}])
@app.batch_delete([ID, ID])

or call method with class name

@ds = Ncmb::DataStore.new(pplication_key, client_key)
@ds.post({foo: :bar}, 'App)

FileStore

lease refer to REST API File Store Reference

@fs = Ncmb::FileStore.new(application_key, client_key)
@fs.post(file, acl)
@fs.get(name) #=> binary
@fs.delete(name)
@fs.all()
@fs.where({fileName: :hoge)

#TODO: @fs.put(name, acl)
#TODO: @fs.public_file(name, application_id)

or call file method by Ncmb::Client object

@ncmb.file.post(file, acl)

Ruby Friendly Sugar Syntax

@app.find #=> search
@app.save #=> post
@app.update #=> put
@app.destroy #=> delete

Supported

ruby 2.0+

License

The gem is available as open source under the terms of the MIT License.