wmls 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/README +12 -7
  2. data/bin/wmls +4 -2
  3. data/lib/wmls.rb +11 -0
  4. metadata +23 -29
data/README CHANGED
@@ -1,21 +1,24 @@
1
- wmls.rb -- WITSML command line tool in Ruby.
1
+ wmls -- WITSML command line tool in Ruby.
2
2
 
3
- Use this script to call GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore on
3
+ wmls is a script in the bin folder. It uses lib/wmls.rb, a library you can use to
4
+ write your own WiTSML programs.
5
+
6
+ Use this script to call GetCap, GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore on
4
7
  a WITSML server.
5
8
 
6
- Usage: wmls.rb [options]
7
- -Dvariable=value Replace occurrences of %variable% with value, in the query template
9
+ Usage: wmls [options]
10
+ -Dvariable=value Replace occurrences of %variable% with value, in the query template
8
11
  -v, --verbose Run verbosely
9
12
  -r, --url url URL of the WITSML service
10
13
  -u, --username USER HTTP user name
11
14
  -p, --password PASS HTTP password
12
15
  -q, --query QUERYFILE Path to file containing query, delete, add or update template
13
- -a get|add|update|delete WITSML action; default is 'get'
16
+ -a cap|get|add|update|delete WITSML action; default is 'get'
14
17
  --action
15
18
  -h, --help Show this message
16
19
 
17
20
  Example:
18
- ruby wmls.rb -q query_v1311/get_all_wells.xml -r https://witsml.wellstorm.com/witsml/services/store -u username -p mypassword -a get
21
+ wmls -q query_v1311/get_all_wells.xml -r https://witsml.wellstorm.com/witsml/services/store -u username -p mypassword -a get
19
22
 
20
23
  I've included a bunch of sample query templates originally created by Gary Masters of Energistics.
21
24
 
@@ -23,4 +26,6 @@ License: Apache 2.0
23
26
 
24
27
  History:
25
28
 
26
- 10 Mar 2011 -- initial commit.
29
+ 10 Mar 2011 -- initial commit.
30
+ 16 Oct 2011 -- added -D option to wmls command line tool (0.1.7)
31
+ 01 May 2012 -- added GetCap support
data/bin/wmls CHANGED
@@ -40,7 +40,7 @@ opts =OptionParser.new do |o|
40
40
  o.on("-q", "--query QUERYFILE", "Path to file containing query, delete, add or update template. (optional, default stdin)") do |v|
41
41
  options[:query] = v
42
42
  end
43
- o.on("-a", "--action ACTION", [:add,:get,:update,:delete], "WITSML action: add, get, update, or delete (optional, default 'get')") do |v|
43
+ o.on("-a", "--action ACTION", [:cap,:add,:get,:update,:delete], "WITSML action: cap, add, get, update, or delete (optional, default 'get')") do |v|
44
44
  options[:action] = v || :get
45
45
  end
46
46
  o.on_tail("-h", "--help", "Show this message") do
@@ -76,7 +76,7 @@ if ( !options[:url] )
76
76
  end
77
77
 
78
78
 
79
- template= get_file_as_string(options[:query], options[:defs] )
79
+ template= get_file_as_string(options[:query], options[:defs] ) unless options[:action] == :cap
80
80
 
81
81
  wmls = Wmls.new options[:url], options[:user_name], options[:password]
82
82
 
@@ -87,6 +87,8 @@ case options[:action]
87
87
  result = wmls.delete_from_store(template)
88
88
  when :update
89
89
  result = wmls.update_in_store(template)
90
+ when :cap
91
+ result = wmls.get_cap
90
92
  when :get,nil
91
93
  result = wmls.get_from_store(template)
92
94
  else
@@ -125,6 +125,16 @@ END
125
125
  return send envelope_middle, soap_action
126
126
  end
127
127
 
128
+ def get_cap()
129
+ soap_action = 'http://www.witsml.org/action/120/Store.WMLS_GetCap'
130
+ envelope_middle = <<END
131
+ <ns0:WMLS_GetCap SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
132
+ <OptionsIn>#{@optionsIn}</OptionsIn>
133
+ </ns0:WMLS_GetCap>
134
+ END
135
+ return send envelope_middle, soap_action
136
+ end
137
+
128
138
  private
129
139
 
130
140
  # Replace special xml chartacters '&' and '<'
@@ -154,6 +164,7 @@ END
154
164
  s = ''
155
165
  doc.root.each_element('//Result') { |elt| r = elt.text}
156
166
  doc.root.each_element('//XMLout') { |elt| x = pretty_xml(elt.text)}
167
+ doc.root.each_element('//CapabilitiesOut') { |elt| x = pretty_xml(elt.text)}
157
168
  doc.root.each_element('//SuppMsgOut') { |elt| s = elt.text }
158
169
  return [r.to_i,s,x];
159
170
  end
metadata CHANGED
@@ -1,57 +1,51 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: wmls
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.8
4
5
  prerelease:
5
- version: 0.1.7
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Hugh Winkler
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-10-16 00:00:00 Z
12
+ date: 2012-05-01 00:00:00.000000000 Z
14
13
  dependencies: []
15
-
16
- description: Wmls calls GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore on a WITSML server.
14
+ description: Wmls calls getCap, GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore
15
+ on a WITSML server.
17
16
  email: hugh.winkler@wellstorm.com
18
- executables:
17
+ executables:
19
18
  - wmls
20
19
  extensions: []
21
-
22
20
  extra_rdoc_files: []
23
-
24
- files:
21
+ files:
25
22
  - README
26
23
  - LICENSE
27
24
  - lib/wmls.rb
28
25
  - bin/wmls
29
26
  homepage: https://github.com/wellstorm/wmls/
30
27
  licenses: []
31
-
32
28
  post_install_message:
33
29
  rdoc_options: []
34
-
35
- require_paths:
30
+ require_paths:
36
31
  - lib
37
- required_ruby_version: !ruby/object:Gem::Requirement
32
+ required_ruby_version: !ruby/object:Gem::Requirement
38
33
  none: false
39
- requirements:
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: "0"
43
- required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
39
  none: false
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: "0"
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
49
44
  requirements: []
50
-
51
45
  rubyforge_project:
52
- rubygems_version: 1.8.11
46
+ rubygems_version: 1.8.10
53
47
  signing_key:
54
48
  specification_version: 3
55
- summary: Calls GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore on a WITSML server.
49
+ summary: Calls GetCap, GetFromStore, AddToStore, UpdateInStore, or DeleteFromStore
50
+ on a WITSML server.
56
51
  test_files: []
57
-