Sha256: 159b64050930ab299df97c67b59b2a4c0413838106013e2342371214379cb05c

Contents?: true

Size: 735 Bytes

Versions: 1

Compression:

Stored size: 735 Bytes

Contents

require 'kintone/command'

class Kintone::Command::Records < Kintone::Command
  def self.path
    'records'
  end

  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

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

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

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

  alias create register
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kintone-0.1.5 lib/kintone/command/records.rb