# ncmb_rb_wrapper Ruby wrapper for NIFTY Cloud mobile backend REST API. #### [NIFTY Cloud mobile backend](http://mb.cloud.nifty.com/) - Free for Basic Plan - 2,000,000 API requests/month - 2,000,000 Push Notifications/month - 5GB Object Storage - [And more...](http://mb.cloud.nifty.com/price.htm) ## Installation Add to Gemlist ```ruby:Gemfile gem 'ncmb_rb_wrapper', :github => 'yutaszk/ncmb_rb_wrapper' ``` ## Usage ### RestClient Client class wrap API request. Please refer to [REST API Reference](http://mb.cloud.nifty.com/doc/current/rest/common/format.html) ```ruby @ncmb = Ncmb::Client.new(application_key, client_key) @ncmb.get("/classes/app/") #=> all object in 'App' class ``` ### DataStore ```ruby @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 ```ruby @ds = Ncmb::DataStore.new(pplication_key, client_key) @ds.post({foo: :bar}, 'App) ``` ### FileStore lease refer to [REST API File Store Reference](http://mb.cloud.nifty.com/doc/current/rest/filestore/fileRegistration.html) ```ruby @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 ```ruby @ncmb.file.post(file, acl) ``` ### Ruby Friendly Sugar Syntax ```ruby @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](http://opensource.org/licenses/MIT).