wmls 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/{main.rb → bin/wmls} +1 -1
- data/lib/wmls.rb +79 -59
- metadata +4 -4
data/{main.rb → bin/wmls}
RENAMED
data/lib/wmls.rb
CHANGED
@@ -20,10 +20,25 @@ require 'uri'
|
|
20
20
|
require 'stringio'
|
21
21
|
require 'rexml/document'
|
22
22
|
|
23
|
+
# A WITSML client library.
|
24
|
+
#
|
25
|
+
# Author:: Hugh Winkler
|
26
|
+
# Copyright:: 2011 Wellstorm Development
|
27
|
+
# License:: Apache 2.0
|
28
|
+
|
29
|
+
# A WITSML client library. Construct an instance with the URL of the WITSML service,
|
30
|
+
# and credentials. Then call the WMLS methods, passing a WITSML query
|
31
|
+
# template to each method.
|
32
|
+
|
23
33
|
class Wmls
|
24
34
|
|
35
|
+
# The HTTP timeout in seconds (default 60)
|
25
36
|
attr_accessor :timeout
|
26
37
|
|
38
|
+
# Construct a new Wmls instance.
|
39
|
+
# url The URL of the remote WMLS service
|
40
|
+
# user_name, password Credentials for the remote service
|
41
|
+
|
27
42
|
def initialize (url, user_name, password)
|
28
43
|
@url = url
|
29
44
|
@user_name = user_name
|
@@ -46,7 +61,71 @@ END
|
|
46
61
|
END
|
47
62
|
end
|
48
63
|
|
64
|
+
# call WMLS_AddToStore with the given template
|
65
|
+
def add_to_store(template)
|
66
|
+
wmlTypeIn = extract_type(template)
|
67
|
+
queryIn = escape_xml(template)
|
68
|
+
soap_action = 'http://www.witsml.org/action/120/Store.WMLS_AddToStore'
|
69
|
+
envelope_middle = <<END
|
70
|
+
<ns0:WMLS_AddToStore SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
71
|
+
<WMLtypeIn>#{wmlTypeIn}</WMLtypeIn>
|
72
|
+
<XMLin>#{queryIn}</XMLin>
|
73
|
+
<OptionsIn>#{@optionsIn}</OptionsIn>
|
74
|
+
<CapabilitiesIn>#{@capabilitiesIn}</CapabilitiesIn>
|
75
|
+
</ns0:WMLS_AddToStore>
|
76
|
+
END
|
77
|
+
return send envelope_middle, soap_action
|
78
|
+
end
|
79
|
+
|
80
|
+
# call WMLS_DeleteStore with the given template
|
81
|
+
def delete_from_store(template)
|
82
|
+
wmlTypeIn = extract_type(template)
|
83
|
+
queryIn = escape_xml(template)
|
84
|
+
soap_action = 'http://www.witsml.org/action/120/Store.WMLS_DeleteFromStore'
|
85
|
+
envelope_middle = <<END
|
86
|
+
<ns0:WMLS_DeleteFromStore SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
87
|
+
<WMLtypeIn>#{wmlTypeIn}</WMLtypeIn>
|
88
|
+
<QueryIn>#{queryIn}</QueryIn>
|
89
|
+
<OptionsIn>#{@optionsIn}</OptionsIn>
|
90
|
+
<CapabilitiesIn>#{@capabilitiesIn}</CapabilitiesIn>
|
91
|
+
</ns0:WMLS_DeleteFromStore>
|
92
|
+
END
|
93
|
+
return send envelope_middle, soap_action
|
94
|
+
end
|
95
|
+
|
96
|
+
# call WMLS_UpdateInStore with the given template
|
97
|
+
def update_in_store(template)
|
98
|
+
wmlTypeIn = extract_type(template)
|
99
|
+
queryIn = escape_xml(template)
|
100
|
+
soap_action = 'http://www.witsml.org/action/120/Store.WMLS_UpdateInStore'
|
101
|
+
envelope_middle = <<END
|
102
|
+
<ns0:WMLS_UpdateInStore SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
103
|
+
<WMLtypeIn>#{wmlTypeIn}</WMLtypeIn>
|
104
|
+
<XMLin>#{queryIn}</XMLin>
|
105
|
+
<OptionsIn>#{@optionsIn}</OptionsIn>
|
106
|
+
<CapabilitiesIn>#{@capabilitiesIn}</CapabilitiesIn>
|
107
|
+
</ns0:WMLS_UpdateInStore>
|
108
|
+
END
|
109
|
+
return send envelope_middle, soap_action
|
110
|
+
end
|
111
|
+
|
112
|
+
# call WMLS_GetFromStore with the given template
|
113
|
+
def get_from_store(template)
|
114
|
+
wmlTypeIn = extract_type(template)
|
115
|
+
queryIn = escape_xml(template)
|
116
|
+
soap_action = 'http://www.witsml.org/action/120/Store.WMLS_GetFromStore'
|
117
|
+
envelope_middle = <<END
|
118
|
+
<ns0:WMLS_GetFromStore SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
119
|
+
<WMLtypeIn>#{wmlTypeIn}</WMLtypeIn>
|
120
|
+
<QueryIn>#{queryIn}</QueryIn>
|
121
|
+
<OptionsIn>#{@optionsIn}</OptionsIn>
|
122
|
+
<CapabilitiesIn>#{@capabilitiesIn}</CapabilitiesIn>
|
123
|
+
</ns0:WMLS_GetFromStore>
|
124
|
+
END
|
125
|
+
return send envelope_middle, soap_action
|
126
|
+
end
|
49
127
|
|
128
|
+
private
|
50
129
|
|
51
130
|
# Replace special xml chartacters '&' and '<'
|
52
131
|
def escape_xml(xml_in)
|
@@ -113,64 +192,5 @@ END
|
|
113
192
|
status, supp_msg, witsml = extract_response(response.body)
|
114
193
|
end
|
115
194
|
|
116
|
-
def add_to_store(template)
|
117
|
-
wmlTypeIn = extract_type(template)
|
118
|
-
queryIn = escape_xml(template)
|
119
|
-
soap_action = 'http://www.witsml.org/action/120/Store.WMLS_AddToStore'
|
120
|
-
envelope_middle = <<END
|
121
|
-
<ns0:WMLS_AddToStore SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
122
|
-
<WMLtypeIn>#{wmlTypeIn}</WMLtypeIn>
|
123
|
-
<XMLin>#{queryIn}</XMLin>
|
124
|
-
<OptionsIn>#{@optionsIn}</OptionsIn>
|
125
|
-
<CapabilitiesIn>#{@capabilitiesIn}</CapabilitiesIn>
|
126
|
-
</ns0:WMLS_AddToStore>
|
127
|
-
END
|
128
|
-
return send envelope_middle, soap_action
|
129
|
-
end
|
130
|
-
|
131
|
-
def delete_from_store(template)
|
132
|
-
wmlTypeIn = extract_type(template)
|
133
|
-
queryIn = escape_xml(template)
|
134
|
-
soap_action = 'http://www.witsml.org/action/120/Store.WMLS_DeleteFromStore'
|
135
|
-
envelope_middle = <<END
|
136
|
-
<ns0:WMLS_DeleteFromStore SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
137
|
-
<WMLtypeIn>#{wmlTypeIn}</WMLtypeIn>
|
138
|
-
<QueryIn>#{queryIn}</QueryIn>
|
139
|
-
<OptionsIn>#{@optionsIn}</OptionsIn>
|
140
|
-
<CapabilitiesIn>#{@capabilitiesIn}</CapabilitiesIn>
|
141
|
-
</ns0:WMLS_DeleteFromStore>
|
142
|
-
END
|
143
|
-
return send envelope_middle, soap_action
|
144
|
-
end
|
145
|
-
def update_in_store(template)
|
146
|
-
wmlTypeIn = extract_type(template)
|
147
|
-
queryIn = escape_xml(template)
|
148
|
-
soap_action = 'http://www.witsml.org/action/120/Store.WMLS_UpdateInStore'
|
149
|
-
envelope_middle = <<END
|
150
|
-
<ns0:WMLS_UpdateInStore SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
151
|
-
<WMLtypeIn>#{wmlTypeIn}</WMLtypeIn>
|
152
|
-
<XMLin>#{queryIn}</XMLin>
|
153
|
-
<OptionsIn>#{@optionsIn}</OptionsIn>
|
154
|
-
<CapabilitiesIn>#{@capabilitiesIn}</CapabilitiesIn>
|
155
|
-
</ns0:WMLS_UpdateInStore>
|
156
|
-
END
|
157
|
-
return send envelope_middle, soap_action
|
158
|
-
end
|
159
|
-
|
160
|
-
def get_from_store(template)
|
161
|
-
wmlTypeIn = extract_type(template)
|
162
|
-
queryIn = escape_xml(template)
|
163
|
-
soap_action = 'http://www.witsml.org/action/120/Store.WMLS_GetFromStore'
|
164
|
-
envelope_middle = <<END
|
165
|
-
<ns0:WMLS_GetFromStore SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
|
166
|
-
<WMLtypeIn>#{wmlTypeIn}</WMLtypeIn>
|
167
|
-
<QueryIn>#{queryIn}</QueryIn>
|
168
|
-
<OptionsIn>#{@optionsIn}</OptionsIn>
|
169
|
-
<CapabilitiesIn>#{@capabilitiesIn}</CapabilitiesIn>
|
170
|
-
</ns0:WMLS_GetFromStore>
|
171
|
-
END
|
172
|
-
return send envelope_middle, soap_action
|
173
|
-
end
|
174
|
-
|
175
195
|
|
176
196
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: wmls
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.2
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Hugh Winkler
|
@@ -16,8 +16,8 @@ dependencies: []
|
|
16
16
|
|
17
17
|
description: Wmls calls GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore on a WITSML server.
|
18
18
|
email: hugh.winkler@wellstorm.com
|
19
|
-
executables:
|
20
|
-
|
19
|
+
executables:
|
20
|
+
- wmls
|
21
21
|
extensions: []
|
22
22
|
|
23
23
|
extra_rdoc_files: []
|
@@ -25,8 +25,8 @@ extra_rdoc_files: []
|
|
25
25
|
files:
|
26
26
|
- README
|
27
27
|
- LICENSE
|
28
|
-
- main.rb
|
29
28
|
- lib/wmls.rb
|
29
|
+
- bin/wmls
|
30
30
|
has_rdoc: true
|
31
31
|
homepage: https://github.com/wellstorm/wmls.rb/
|
32
32
|
licenses: []
|