Sha256: 1aaabeacb4ba44098008ee3a11b6ae25e8ce36992b78962ca76fab1249259250
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
# frozen_string_literal: true module NCMB class Script include NCMB def initialize(name) @name = name @params = {} end def get(params = {}) self.set(params).execute('get') end def post(params = {}) self.set(params).execute('post') end def put(params = {}) self.set(params).execute('put') end def delete(params = {}) self.set(params) @@client.delete end def set(params) params = Hash[ params.map{ |k, v| [k.to_sym, v] } ] self .headers(params[:headers]) .body(params[:body]) .query(params[:query]) self end def headers(params) @params[:headers] = params self end def body(params) @params[:body] = params self end def query(params) @params[:query] = params self end def execute(method) @@client.send(method, "/#{@@client.script_api_version}/script/#{@name}", (@params[:query] || {}).merge(@params[:body] || {}), @params[:headers]) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ncmb-ruby-client-0.1.5 | lib/ncmb/script.rb |