class VertexClient::Connection
Constants
- ERROR_MESSAGE
- VERTEX_NAMESPACE
Public Class Methods
new(endpoint, resource_key=nil)
click to toggle source
# File lib/vertex_client/connection.rb, line 7 def initialize(endpoint, resource_key=nil) @endpoint = endpoint @resource_key = resource_key end
Public Instance Methods
client()
click to toggle source
# File lib/vertex_client/connection.rb, line 21 def client @client ||= Savon.client do |globals| globals.endpoint clean_endpoint globals.namespace VERTEX_NAMESPACE globals.convert_request_keys_to :camelcase globals.env_namespace :soapenv globals.namespace_identifier :urn globals.open_timeout open_timeout if open_timeout.present? globals.read_timeout read_timeout if read_timeout.present? end end
request(payload)
click to toggle source
# File lib/vertex_client/connection.rb, line 12 def request(payload) call_with_circuit_if_available do client.call( :vertex_envelope, message: shell_with_auth.merge(payload) ) end end
Private Instance Methods
call_with_circuit_if_available() { || ... }
click to toggle source
# File lib/vertex_client/connection.rb, line 43 def call_with_circuit_if_available if VertexClient.circuit VertexClient.circuit.run { yield } else begin yield rescue => _e nil end end end
clean_endpoint()
click to toggle source
# File lib/vertex_client/connection.rb, line 61 def clean_endpoint URI.join(config.soap_api, @endpoint).to_s end
config()
click to toggle source
# File lib/vertex_client/connection.rb, line 35 def config @config ||= VertexClient.configuration end
open_timeout()
click to toggle source
# File lib/vertex_client/connection.rb, line 69 def open_timeout resource_config[:open_timeout] || config.open_timeout end
read_timeout()
click to toggle source
# File lib/vertex_client/connection.rb, line 65 def read_timeout resource_config[:read_timeout] || config.read_timeout end
resource_config()
click to toggle source
# File lib/vertex_client/connection.rb, line 39 def resource_config config.resource_config[@resource_key] || {} end
shell_with_auth()
click to toggle source
# File lib/vertex_client/connection.rb, line 55 def shell_with_auth { login: { trusted_id: @config.trusted_id } } end