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

#delete(app, ids, revisions: nil) ⇒ Object



23
24
25
26
27
# File 'lib/kintone/command/records.rb', line 23

def delete(app, ids, revisions: nil)
  params = { app: app, ids: ids }
  params[:revisions] = revisions if revisions
  @api.delete(@url, params)
end

#get(app, query, fields, total_count: nil) ⇒ Object



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

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

#register(app, records) ⇒ Object Also known as: create



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

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

#update(app, records) ⇒ Object



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

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