simplews 1.3.4 → 1.4.0

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.
Files changed (3) hide show
  1. data/README.rdoc +3 -1
  2. data/lib/simplews.rb +12 -0
  3. metadata +2 -2
data/README.rdoc CHANGED
@@ -1,6 +1,8 @@
1
1
  = simplews
2
2
 
3
- Description goes here.
3
+ This library simplifies the creation of SOAP web services. It is based on
4
+ soap4r, and adds a DSL for serving methods that create automatically the WSDL.
5
+ Additionally, it offers support for asynchronous jobs.
4
6
 
5
7
  == Note on Patches/Pull Requests
6
8
 
data/lib/simplews.rb CHANGED
@@ -46,6 +46,8 @@ require 'builder'
46
46
  class SimpleWS < SOAP::RPC::StandaloneServer
47
47
  VERSION = "1.3.6"
48
48
 
49
+ # Saves method defined in the class to be served by the instances
50
+ METHODS = {}
49
51
 
50
52
  # This is a helper function for clients. Given the +url+ where the
51
53
  # server is listening, as well as the name of the server, it can
@@ -92,6 +94,9 @@ class SimpleWS < SOAP::RPC::StandaloneServer
92
94
  @bindings = []
93
95
 
94
96
  serve :wsdl, %w(), :return => :string
97
+ METHODS.each{|name, info|
98
+ serve name, info[:args], info[:types], &info[:block]
99
+ }
95
100
  end
96
101
 
97
102
 
@@ -123,6 +128,13 @@ class SimpleWS < SOAP::RPC::StandaloneServer
123
128
  nil
124
129
  end
125
130
 
131
+ # Saves the method to be served by the instances. The initialization of an
132
+ # instance check if there where any methods declared to be served in the class
133
+ # and add them.
134
+ def self.serve(name, args=[], types={}, &block)
135
+ METHODS[name] = {:args => args, :types => types, :block => block}
136
+ end
137
+
126
138
  # If +filename+ is specified it saves the +WSDL+ file in that file. If
127
139
  # no +filename+ is specified it returns a string containing the
128
140
  # +WSDL+. The no parameter version is served by default, so that
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplews
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.4
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Vazquez
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-10-29 00:00:00 +01:00
12
+ date: 2009-11-25 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency