Module: Campaigning::Helpers::ClassMethods

Defined in:
lib/campaigning/helpers/helpers.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) ).



17
18
19
20
21
22
# File 'lib/campaigning/helpers/helpers.rb', line 17

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