Module: Campaigning::ModuleMixin::ClassMethods

Defined in:
lib/campaigning/module_mixin.rb

Overview

All methods above will became Object methods

Instance Method Summary collapse

Instance Method Details

#handle_response(response) ⇒ Object

Method responsable to handle all response from the API server and raising an exception when the API returns an error code (different from 0 (zero) ).



21
22
23
24
25
26
# File 'lib/campaigning/module_mixin.rb', line 21

def handle_response(response)
  if (response.class == Campaigning::Result && response.code != 0)
    raise response.code.to_s + " - " + response.message
  end
  response
end