Class: RepsClient::Client
- Inherits:
-
Object
- Object
- RepsClient::Client
- Includes:
- CommunityMethods, LeadMethods, PickListMethods
- Defined in:
- lib/reps_client/client.rb
Overview
RepsClient::Client is the main object for connecting to the remote REPS service.
Instance Method Summary collapse
- #debug=(val) ⇒ Object
- #debug? ⇒ Boolean
-
#initialize(options = {}) ⇒ Client
constructor
Initializes the client.
- #logger=(val) ⇒ Object
-
#soap_client ⇒ Savon::Client
The raw SOAP client to directly execute requests against the REPS service.
Methods included from LeadMethods
Methods included from PickListMethods
Methods included from CommunityMethods
Constructor Details
#initialize(options = {}) ⇒ Client
Initializes the client.
By default, the new client instance will take all of its configuration values from the module-level configuration, but these can be overridden at the client-level.
91 92 93 94 95 |
# File 'lib/reps_client/client.rb', line 91 def initialize(={}) self.debug = nil self.logger = nil .each { |k,v| self.send("#{k}=", v) if self.respond_to?("#{k}=") } end |
Instance Method Details
#debug=(val) ⇒ Object
32 33 34 35 |
# File 'lib/reps_client/client.rb', line 32 def debug=(val) @debug = val Savon.log = self.debug? end |
#debug? ⇒ Boolean
37 38 39 |
# File 'lib/reps_client/client.rb', line 37 def debug? self.debug.to_s == 'true' end |
#logger=(val) ⇒ Object
41 42 43 44 |
# File 'lib/reps_client/client.rb', line 41 def logger=(val) @logger = val Savon.logger = self.logger end |
#soap_client ⇒ Savon::Client
The raw SOAP client to directly execute requests against the REPS service. Preconfigures all service-wide endpoints, namespace URLs, credentials, etc. This method is provided as a convenience to developers; it should rarely be used directly.
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/reps_client/client.rb', line 103 def soap_client Savon::Client.new do wsdl.endpoint = self.endpoint.to_s wsdl.namespace = self.namespace.to_s wsse.credentials self.username, self.password, false wsse. = true # We have to override some of the timestamps to force UTC # (the reps service cacks on any other timezone) wsse.created_at = Time.now.utc class << wsse define_method(:timestamp, lambda { @timestamp ||= Time.now.utc.xs_datetime }) end end end |