vistarpc4r 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -7,20 +7,21 @@ The VistA server requires each connection to have a username/password authentica
7
7
 
8
8
  This gem has been tested with Medsphere's OpenVista server distribution.
9
9
 
10
- Future topics for this document
11
- * More detail on how to use
12
- * Detailed examples
13
- * links to more information
14
-
15
- == Contributing to vistarpc4r
16
-
17
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
18
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
19
- * Fork the project
20
- * Start a feature/bugfix branch
21
- * Commit and push until you are happy with your contribution
22
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
23
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
10
+ == Future features
11
+ * Ruby classes for primary VistA data object
12
+ * Some sort of connection pooling
13
+ * ActiveRecord interface to VistA (nasty one, but cool)
14
+ *
15
+
16
+ == Usage
17
+
18
+ === Installation
19
+ You may get the latest stable version from Rubyforge.
20
+
21
+ $ gem install vistarpc4r
22
+
23
+ === An Example
24
+ Check out the examples in the examples directory, until I get the time to write more extensive documentation
24
25
 
25
26
  == Copyright
26
27
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.2.1
data/examples/test.rb CHANGED
@@ -2,7 +2,10 @@ require './../lib/vistarpc4r/rpc_response'
2
2
  require './../lib/vistarpc4r/vista_rpc'
3
3
  require './../lib/vistarpc4r/rpc_broker_connection'
4
4
 
5
- #broker = RPCBrokerConnection.new('192.168.1.20', 9270, 'sys.admin', 'vista!123')
5
+ # Medsphere maintains a public demo OpenVistA server. It resets all of its content every night.
6
+ # Info here ---> https://medsphere.org/docs/DOC-1003
7
+
8
+
6
9
  broker = VistaRPC4r::RPCBrokerConnection.new('openvista.medsphere.org', 9201, 'PU1234', 'PU1234!!')
7
10
 
8
11
  broker.connect
@@ -48,7 +48,7 @@ module VistaRPC4r
48
48
  def connect
49
49
  retVal = true
50
50
  if isConnected()
51
- puts " already connected, closing first"
51
+ warn " already connected, closing first"
52
52
  close
53
53
  end
54
54
  @socket = TCPSocket.open(@host, @port) # Connect
@@ -59,10 +59,10 @@ module VistaRPC4r
59
59
  tcpConnect.params[2]= "OVID"
60
60
  connectResponse = execute(tcpConnect)
61
61
  if (connectResponse == nil || connectResponse.value == nil || connectResponse.value == "reject")
62
- puts "Handshake error"
62
+ raise "Handshake error"
63
63
  end
64
64
  if (connectResponse.error_message != nil)
65
- puts "RPC Error: " + connectResponse.error_message
65
+ raise "RPC Error: " + connectResponse.error_message
66
66
  end
67
67
  @sentConnect = true
68
68
 
@@ -106,7 +106,7 @@ module VistaRPC4r
106
106
  end
107
107
  end
108
108
  if (retVal == nil)
109
- puts "Lost connection to server"
109
+ raise "Lost connection to server"
110
110
  end
111
111
  return retVal
112
112
  end
@@ -154,11 +154,11 @@ module VistaRPC4r
154
154
 
155
155
  def setContext(context)
156
156
  if (context == @currentContext)
157
- puts "context is already set to " + context + "..."
157
+ warn "context is already set to " + context + "..."
158
158
  return
159
159
  end
160
160
  if (@currentContext != nil)
161
- puts "changing context from " + currentContext + " to " + context
161
+ warn "changing context from " + currentContext + " to " + context
162
162
  end
163
163
 
164
164
  puts "Setting context to: " + context
@@ -167,7 +167,7 @@ module VistaRPC4r
167
167
  xwbCreateContext.params[0] = encryptedContext
168
168
  response = execute(xwbCreateContext)
169
169
  if (response == nil || response.error_message != nil)
170
- puts "XWB CREATE CONTEXT failed: " + response.error_message
170
+ raise "XWB CREATE CONTEXT failed: " + response.error_message
171
171
  end
172
172
  @currentContext = context
173
173
  end
@@ -184,7 +184,7 @@ module VistaRPC4r
184
184
  def signOn()
185
185
  signonResponse = execute(VistaRPC.new("XUS SIGNON SETUP", RPCResponse::ARRAY))
186
186
  if (signonResponse == nil || signonResponse.error_message != nil)
187
- puts "XUS SIGNON SETUP failed"
187
+ raise "XUS SIGNON SETUP failed"
188
188
  end
189
189
  @signedOn = true
190
190
  end
@@ -217,7 +217,8 @@ module VistaRPC4r
217
217
  end
218
218
  if (hasErrors)
219
219
  brokerInfo = extractBrokerErrorInfo(response)
220
- puts("Access denied: " + brokerInfo)
220
+ warn("Access denied: " + brokerInfo)
221
+ return false
221
222
  else
222
223
  @duz = answer[0]
223
224
  end
data/vistarpc4r.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vistarpc4r}
8
- s.version = "0.2.0"
8
+ s.version = "0.2.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mike Cham"]
12
- s.date = %q{2011-05-27}
12
+ s.date = %q{2011-06-22}
13
13
  s.description = %q{more}
14
14
  s.email = %q{mike@blenderhouse.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vistarpc4r
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Mike Cham
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-27 00:00:00 -04:00
18
+ date: 2011-06-22 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency