Class: Kintone::Command::Record

Inherits:
Kintone::Command show all
Defined in:
lib/kintone/command/record.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/record.rb', line 4

def self.path
  'record'
end

Instance Method Details

#get(app, id) ⇒ Object



8
9
10
# File 'lib/kintone/command/record.rb', line 8

def get(app, id)
  @api.get(@url, app: app, id: id)
end

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



12
13
14
# File 'lib/kintone/command/record.rb', line 12

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

#update(app, id, record, revision: nil) ⇒ Object



16
17
18
19
20
# File 'lib/kintone/command/record.rb', line 16

def update(app, id, record, revision: nil)
  body = { app: app, id: id, record: record.to_kintone }
  body[:revision] = revision if revision
  @api.put(@url, body)
end