Skip to content

Instantly share code, notes, and snippets.

@yevgenko
Created February 10, 2014 13:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save yevgenko/8915506 to your computer and use it in GitHub Desktop.
Save yevgenko/8915506 to your computer and use it in GitHub Desktop.
require 'savon'
module Foobarservice
class Client
attr_accessor :wsdl, :user_id, :token
def initialize(attrs = {})
attrs.each do |k,v| send("#{k}=", v) end
@client = Savon.client(wsdl: @wsdl) do
convert_request_keys_to :none
end
end
def call(operation, msg = {})
response = @client.call(
operation,
soap_header: {
verifyingToken: {
UserID: @user_id,
Token: @token
}
},
message: msg
)
response.body["#{operation}_response".to_sym][:return]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment