Class: Ncmb::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/ncmb_rb_wrapper.rb

Direct Known Subclasses

DataStore, FileStore

Instance Method Summary collapse

Constructor Details

#initialize(application_key, client_key) ⇒ Client

Returns a new instance of Client.



12
13
14
15
16
17
# File 'lib/ncmb_rb_wrapper.rb', line 12

def initialize(application_key, client_key)
  @application_key = application_key
  @client_key = client_key
  @api_version = '2013-09-01'
  @domain = 'mb.api.cloud.nifty.com'
end

Instance Method Details

#batch(array_request) ⇒ Object



35
36
37
# File 'lib/ncmb_rb_wrapper.rb', line 35

def batch(array_request)
  request(:POST, '/batch', requests: array_request)
end

#data(klass = nil) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/ncmb_rb_wrapper.rb', line 43

def data(klass = nil)
  if klass.nil?
    DataStore.new(@application_key, @client_key)
  else
    DataStore.new(@application_key, @client_key, klass)
  end
end

#delete(path) ⇒ Object



31
32
33
# File 'lib/ncmb_rb_wrapper.rb', line 31

def delete(path)
  request(:DELETE, path)
end

#fileObject



39
40
41
# File 'lib/ncmb_rb_wrapper.rb', line 39

def file
  FileStore.new(@application_key, @client_key)
end

#get(path, hash_query = {}) ⇒ Object



19
20
21
# File 'lib/ncmb_rb_wrapper.rb', line 19

def get(path, hash_query = {})
  request(:GET, path, hash_query)
end

#post(path, hash_query = {}) ⇒ Object



23
24
25
# File 'lib/ncmb_rb_wrapper.rb', line 23

def post(path, hash_query = {})
  request(:POST, path, hash_query)
end

#put(path, hash_query = {}) ⇒ Object



27
28
29
# File 'lib/ncmb_rb_wrapper.rb', line 27

def put(path, hash_query = {})
  request(:PUT, path, hash_query)
end