Class: Symgate::Client
- Inherits:
-
Object
- Object
- Symgate::Client
- Defined in:
- lib/symgate/client.rb
Overview
A generic client for the Symgate API. See the WSDL for full documentation
Direct Known Subclasses
Instance Attribute Summary collapse
-
#account ⇒ Object
Returns the value of attribute account.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#key ⇒ Object
Returns the value of attribute key.
-
#password ⇒ Object
Returns the value of attribute password.
-
#savon_client ⇒ Object
readonly
Returns the value of attribute savon_client.
-
#savon_opts ⇒ Object
Returns the value of attribute savon_opts.
-
#token ⇒ Object
Returns the value of attribute token.
-
#user ⇒ Object
Returns the value of attribute user.
-
#wsdl ⇒ Object
Returns the value of attribute wsdl.
Class Method Summary collapse
-
.savon_array(hash, key, classname = nil) ⇒ Object
returns an array from 0 or more items when an array is expected.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Client
constructor
Constructs a new client with the provided options.
Constructor Details
#initialize(opts = {}) ⇒ Client
Constructs a new client with the provided options
13 14 15 16 17 18 19 20 21 |
# File 'lib/symgate/client.rb', line 13 def initialize(opts = {}) @wsdl = 'https://ws.widgitonline.com/schema/symboliser.wsdl' @endpoint = 'https://ws.widgitonline.com/' @savon_opts = {} opts.each { |k, v| instance_variable_set("@#{k}", v) } create_savon_client end |
Instance Attribute Details
#account ⇒ Object
Returns the value of attribute account.
9 10 11 |
# File 'lib/symgate/client.rb', line 9 def account @account end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
9 10 11 |
# File 'lib/symgate/client.rb', line 9 def endpoint @endpoint end |
#key ⇒ Object
Returns the value of attribute key.
9 10 11 |
# File 'lib/symgate/client.rb', line 9 def key @key end |
#password ⇒ Object
Returns the value of attribute password.
9 10 11 |
# File 'lib/symgate/client.rb', line 9 def password @password end |
#savon_client ⇒ Object (readonly)
Returns the value of attribute savon_client.
10 11 12 |
# File 'lib/symgate/client.rb', line 10 def savon_client @savon_client end |
#savon_opts ⇒ Object
Returns the value of attribute savon_opts.
9 10 11 |
# File 'lib/symgate/client.rb', line 9 def savon_opts @savon_opts end |
#token ⇒ Object
Returns the value of attribute token.
9 10 11 |
# File 'lib/symgate/client.rb', line 9 def token @token end |
#user ⇒ Object
Returns the value of attribute user.
9 10 11 |
# File 'lib/symgate/client.rb', line 9 def user @user end |
#wsdl ⇒ Object
Returns the value of attribute wsdl.
9 10 11 |
# File 'lib/symgate/client.rb', line 9 def wsdl @wsdl end |
Class Method Details
.savon_array(hash, key, classname = nil) ⇒ Object
returns an array from 0 or more items when an array is expected. (savon returns a single value for things that can be a sequence of multiple objects) expects a hash, and a key for the array within that hash. if classname is specified, the method will return an array of objects initialised by the hash contents
28 29 30 31 32 33 34 |
# File 'lib/symgate/client.rb', line 28 def self.savon_array(hash, key, classname = nil) if hash && hash.include?(key) [hash[key]].flatten else [] end.map { |v| classname ? classname.from_soap(v) : v } end |