Class: Wmls
- Inherits:
-
Object
- Object
- Wmls
- Defined in:
- lib/wmls.rb
Overview
A WITSML client library. Construct an instance with the URL of the WITSML service, and credentials. Then call the WMLS methods, passing a WITSML query template to each method.
Instance Attribute Summary collapse
-
#timeout ⇒ Object
The HTTP timeout in seconds (default 60).
Instance Method Summary collapse
-
#add_to_store(template, optionsIn = nil, headers = {}) ⇒ Object
call WMLS_AddToStore with the given template.
-
#delete_from_store(template, optionsIn = nil, headers = {}) ⇒ Object
call WMLS_DeleteStore with the given template.
-
#get_cap(optionsIn = nil, headers = {}) ⇒ Object
call WMLS_GetCap with the specified optionsIn.
-
#get_from_store(template, optionsIn = nil, headers = {}) ⇒ Object
call WMLS_GetFromStore with the given template.
-
#initialize(url, user_name, password) ⇒ Wmls
constructor
Construct a new Wmls instance.
-
#update_in_store(template, optionsIn = nil, headers = {}) ⇒ Object
call WMLS_UpdateInStore with the given template.
Constructor Details
#initialize(url, user_name, password) ⇒ Wmls
Construct a new Wmls instance. url The URL of the remote WMLS service user_name, password Credentials for the remote service
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/wmls.rb', line 42 def initialize (url, user_name, password) @url = url @user_name = user_name @password = password = '' @capabilitiesIn = '' @timeout = 60 @envelope_begin = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n xmlns:ns0=\"http://www.witsml.org/message/120\">\n <SOAP-ENV:Header/>\n <SOAP-ENV:Body>\n" @envelope_end = " </SOAP-ENV:Body>\n</SOAP-ENV:Envelope>\n" end |
Instance Attribute Details
#timeout ⇒ Object
The HTTP timeout in seconds (default 60)
36 37 38 |
# File 'lib/wmls.rb', line 36 def timeout @timeout end |
Instance Method Details
#add_to_store(template, optionsIn = nil, headers = {}) ⇒ Object
call WMLS_AddToStore with the given template
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/wmls.rb', line 65 def add_to_store(template, =nil, headers={}) wmlTypeIn = extract_type(template) queryIn = escape_xml(template) soap_action = 'http://www.witsml.org/action/120/Store.WMLS_AddToStore' headers['SOAPAction'] = soap_action envelope_middle = " <ns0:WMLS_AddToStore SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <WMLtypeIn>\#{wmlTypeIn}</WMLtypeIn>\n <XMLin>\#{queryIn}</XMLin>\n <OptionsIn>\#{optionsIn || @optionsIn}</OptionsIn>\n <CapabilitiesIn>\#{@capabilitiesIn}</CapabilitiesIn>\n </ns0:WMLS_AddToStore>\n" return send envelope_middle, headers end |
#delete_from_store(template, optionsIn = nil, headers = {}) ⇒ Object
call WMLS_DeleteStore with the given template
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/wmls.rb', line 82 def delete_from_store(template, = nil, headers={}) wmlTypeIn = extract_type(template) queryIn = escape_xml(template) soap_action = 'http://www.witsml.org/action/120/Store.WMLS_DeleteFromStore' headers['SOAPAction'] = soap_action envelope_middle = " <ns0:WMLS_DeleteFromStore SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <WMLtypeIn>\#{wmlTypeIn}</WMLtypeIn>\n <QueryIn>\#{queryIn}</QueryIn>\n <OptionsIn>\#{optionsIn || @optionsIn}</OptionsIn>\n <CapabilitiesIn>\#{@capabilitiesIn}</CapabilitiesIn>\n </ns0:WMLS_DeleteFromStore>\n" return send envelope_middle, headers end |
#get_cap(optionsIn = nil, headers = {}) ⇒ Object
call WMLS_GetCap with the specified optionsIn.
133 134 135 136 137 138 139 140 141 142 |
# File 'lib/wmls.rb', line 133 def get_cap(=nil, headers={}) soap_action = 'http://www.witsml.org/action/120/Store.WMLS_GetCap' headers['SOAPAction'] = soap_action envelope_middle = " <ns0:WMLS_GetCap SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <OptionsIn>\#{optionsIn || @optionsIn}</OptionsIn>\n </ns0:WMLS_GetCap>\n" return send envelope_middle, headers end |
#get_from_store(template, optionsIn = nil, headers = {}) ⇒ Object
call WMLS_GetFromStore with the given template
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/wmls.rb', line 116 def get_from_store(template, =nil, headers={}) wmlTypeIn = extract_type(template) queryIn = escape_xml(template) soap_action = 'http://www.witsml.org/action/120/Store.WMLS_GetFromStore' headers['SOAPAction'] = soap_action envelope_middle = " <ns0:WMLS_GetFromStore SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <WMLtypeIn>\#{wmlTypeIn}</WMLtypeIn>\n <QueryIn>\#{queryIn}</QueryIn>\n <OptionsIn>\#{optionsIn || @optionsIn}</OptionsIn>\n <CapabilitiesIn>\#{@capabilitiesIn}</CapabilitiesIn>\n </ns0:WMLS_GetFromStore>\n" return send envelope_middle, headers end |
#update_in_store(template, optionsIn = nil, headers = {}) ⇒ Object
call WMLS_UpdateInStore with the given template
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/wmls.rb', line 99 def update_in_store(template, =nil, headers={}) wmlTypeIn = extract_type(template) queryIn = escape_xml(template) soap_action = 'http://www.witsml.org/action/120/Store.WMLS_UpdateInStore' headers['SOAPAction'] = soap_action envelope_middle = " <ns0:WMLS_UpdateInStore SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\n <WMLtypeIn>\#{wmlTypeIn}</WMLtypeIn>\n <XMLin>\#{queryIn}</XMLin>\n <OptionsIn>\#{optionsIn || @optionsIn}</OptionsIn>\n <CapabilitiesIn>\#{@capabilitiesIn}</CapabilitiesIn>\n </ns0:WMLS_UpdateInStore>\n" return send envelope_middle, headers end |