class BingAdsRubySdk::Services::Base
Attributes
soap_client[R]
Public Class Methods
new(soap_client)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 13 def initialize(soap_client) @soap_client = soap_client end
service()
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 31 def self.service raise 'implement me' end
Public Instance Methods
call(operation_name, message = {})
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 17 def call(operation_name, message = {}) camelized_name = BingAdsRubySdk::StringUtils.camelize(operation_name.to_s) response = soap_client.call( camelized_name, preprocess(message, camelized_name), ) postprocess(response) end
call_wrapper(action, message, *response_nesting)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 26 def call_wrapper(action, message, *response_nesting) response = call(action, message) wrap_array(dig_response(response, response_nesting)) end
Private Instance Methods
camelize(hash)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 56 def camelize(hash) ::BingAdsRubySdk::Preprocessors::Camelize.new(hash).call end
cast_long_arrays(hash)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 64 def cast_long_arrays(hash) ::BingAdsRubySdk::Postprocessors::CastLongArrays.new(hash).call end
dig_response(response, keys)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 68 def dig_response(response, keys) response.dig(*keys) rescue StandardError => e nil end
order(wrapper, hash)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 52 def order(wrapper, hash) ::BingAdsRubySdk::Preprocessors::Order.new(wrapper, hash).call end
postprocess(message)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 46 def postprocess(message) cast_long_arrays( snakize(message) ) end
preprocess(message, operation_name)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 39 def preprocess(message, operation_name) order( soap_client.wsdl_wrapper(operation_name), camelize(message) ) end
snakize(hash)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 60 def snakize(hash) ::BingAdsRubySdk::Postprocessors::Snakize.new(hash).call end
wrap_array(arg)
click to toggle source
# File lib/bing_ads_ruby_sdk/services/base.rb, line 74 def wrap_array(arg) case arg when Array then arg when nil, "" then [] else [arg] end end