class SoapyBing::ServiceOperation

Attributes

name[R]
service[R]

Public Class Methods

new(service, name) click to toggle source
# File lib/soapy_bing/service_operation.rb, line 12
def initialize(service, name)
  @service = service
  @name = name
end

Public Instance Methods

call(message = {}) { |namespace_identifier| ... } click to toggle source
# File lib/soapy_bing/service_operation.rb, line 17
def call(message = {})
  response = savon_client.call(
    name,
    message: block_given? ? yield(namespace_identifier) : message,
    soap_header: soap_header
  )
  response.body[output]
end

Private Instance Methods

convert_key(key) click to toggle source
# File lib/soapy_bing/service_operation.rb, line 40
def convert_key(key)
  Gyoku::XMLKey.create(key, key_converter: savon_client.globals[:convert_request_keys_to])
end
namespace_identifier() click to toggle source
# File lib/soapy_bing/service_operation.rb, line 44
def namespace_identifier
  wsdl_operation.fetch(:namespace_identifier)
end
output() click to toggle source
# File lib/soapy_bing/service_operation.rb, line 48
def output
  original_output = wsdl_operation.fetch(:output)
  convert_tag = savon_client.globals[:convert_response_tags_to]
  convert_tag.respond_to?(:call) ? convert_tag.call(original_output) : original_output
end
soap_header() click to toggle source
# File lib/soapy_bing/service_operation.rb, line 28
def soap_header
  header = {
    action: convert_key(name),
    authentication_token: oauth_credentials.access_token,
    developer_token: customer.developer_token
  }
  header[:customer_account_id] = account.account_id if account
  header.transform_keys do |key|
    "#{namespace_identifier}:#{convert_key(key)}"
  end
end
wsdl() click to toggle source
# File lib/soapy_bing/service_operation.rb, line 58
def wsdl
  savon_client.instance_variable_get(:@wsdl)
end
wsdl_operation() click to toggle source
# File lib/soapy_bing/service_operation.rb, line 54
def wsdl_operation
  wsdl.operations.fetch(name)
end