Class: Kintone::Command::Records

Inherits:
Kintone::Command show all
Defined in:
lib/kintone/command/records.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Kintone::Command

#initialize

Constructor Details

This class inherits a constructor from Kintone::Command

Class Method Details

.pathObject



4
5
6
# File 'lib/kintone/command/records.rb', line 4

def self.path
  'records'
end

Instance Method Details

#create(app, records) ⇒ Object



18
19
20
# File 'lib/kintone/command/records.rb', line 18

def create(app, records)
  register(app, records)
end

#delete(app, ids) ⇒ Object



26
27
28
29
# File 'lib/kintone/command/records.rb', line 26

def delete(app, ids)
  params = { app: app, ids: ids }
  @api.delete(@url, params)
end

#get(app, query, fields) ⇒ Object



8
9
10
11
12
# File 'lib/kintone/command/records.rb', line 8

def get(app, query, fields)
  params = { app: app, query: query.to_s }
  fields.each_with_index { |v, i| params["fields[#{i}]"] = v }
  @api.get(@url, params)
end

#register(app, records) ⇒ Object



14
15
16
# File 'lib/kintone/command/records.rb', line 14

def register(app, records)
  @api.post(@url, app: app, records: records.to_kintone)
end

#update(app, records) ⇒ Object



22
23
24
# File 'lib/kintone/command/records.rb', line 22

def update(app, records)
  @api.put(@url, app: app, records: records.to_kintone)
end