Module: Gmail::Base::Update

Included in:
Draft, Label
Defined in:
lib/gmail/base/update.rb

Instance Method Summary collapse

Instance Method Details

#update(body) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/gmail/base/update.rb', line 15

def update(body)
  if id.nil?
    d = self.class.create(body)
  else
    response = Gmail.request(self.class.base_method.send("update"),{id: id}, body)
    d = Util.convert_to_gmail_object(response, self.class.class_name.downcase)
  end
  d
end

#update!(body) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/gmail/base/update.rb', line 4

def update!(body)
  if id.nil?
    d = self.class.create(body)
  else
    response = Gmail.request(self.class.base_method.send("update"),{id: id}, body)
    d = Util.convert_to_gmail_object(response, self.class.class_name.downcase)
  end
  @values = d.values
  self
end