Module: Paggi::Rest::Capture

Included in:
Charge
Defined in:
lib/paggi/rest/capture.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/paggi/rest/capture.rb', line 5

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

Instance Method Details

#captureObject



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/paggi/rest/capture.rb', line 10

def capture
  result = self.class.capture(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