Module: Paggi::Rest::Update

Included in:
Card, Customer
Defined in:
lib/paggi/rest/update.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
# File 'lib/paggi/rest/update.rb', line 6

def included(base)
  base.extend(ClassMethods)
end

Instance Method Details

#updateObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/paggi/rest/update.rb', line 12

def update
  result = self.class.update(self.to_json)
  raise result if result.instance_of? StandardError

  if result.instance_of? PaggiError
    self.errors = result.errors
    return false
  end

  initialize(result.to_json)
  true
end