Module: Campaigning::Helpers

Included in:
Campaigning, Campaign, Client, List, Subscriber
Defined in:
lib/campaigning/helpers/helpers.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.handle_request(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) ).



11
12
13
14
15
16
# File 'lib/campaigning/helpers/helpers.rb', line 11

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

Instance Method Details

#handle_request(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) ).



5
6
7
# File 'lib/campaigning/helpers/helpers.rb', line 5

def handle_request(response)
  Helpers.handle_request response
end