Class: BingAdsRubySdk::Errors::ErrorHandler
- Inherits:
-
Object
- Object
- BingAdsRubySdk::Errors::ErrorHandler
- Defined in:
- lib/bing_ads_ruby_sdk/errors/error_handler.rb
Overview
Parses the response from the API to raise errors if they are returned
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(response) ⇒ ErrorHandler
constructor
A new instance of ErrorHandler.
Constructor Details
#initialize(response) ⇒ ErrorHandler
Returns a new instance of ErrorHandler.
7 8 9 |
# File 'lib/bing_ads_ruby_sdk/errors/error_handler.rb', line 7 def initialize(response) @response = response end |
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 |
# File 'lib/bing_ads_ruby_sdk/errors/error_handler.rb', line 11 def call # Some operations don't return a response, for example: # https://msdn.microsoft.com/en-us/library/bing-ads-customer-management-deleteaccount.aspx return unless response.is_a? Hash raise fault_class.new(response) if contains_error? end |