wsdsl 0.4.3 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.3
1
+ 0.5.0
data/lib/params.rb CHANGED
@@ -50,6 +50,13 @@ class WSDSL
50
50
  @options[:space_name]
51
51
  end
52
52
 
53
+ # Converts the rule into a hash with its name and options.
54
+ #
55
+ # @return [Hash]
56
+ def to_hash
57
+ {:name => name, :options => options}
58
+ end
59
+
53
60
  end # of Rule
54
61
 
55
62
  # The namespace used if any
data/lib/response.rb CHANGED
@@ -1,3 +1,5 @@
1
+ require 'json'
2
+
1
3
  class WSDSL
2
4
  # Response DSL class
3
5
  # @api public
@@ -77,6 +79,26 @@ class WSDSL
77
79
  @elements.find{|e| e.name.to_s == name.to_s}
78
80
  end
79
81
 
82
+
83
+ # Converts the object into a JSON representation
84
+ # @return [String] JSON representation of the response
85
+ def to_json(*args)
86
+ if nodes.size > 1
87
+ nodes.to_json(*args)
88
+ else
89
+ nodes.first.to_json(*args)
90
+ end
91
+ end
92
+
93
+
94
+ class Params
95
+ class Rule
96
+ def to_hash
97
+ {:name => name, :options => options}
98
+ end
99
+ end
100
+ end
101
+
80
102
  # The Response element class describing each element of a service response.
81
103
  # Instances are usually not instiated directly but via the Response#element accessor.
82
104
  #
@@ -312,6 +334,44 @@ class WSDSL
312
334
  attribute({name => :datetime}.merge(opts))
313
335
  end
314
336
 
337
+ # Converts an element into a hash representation
338
+ #
339
+ # @return [Hash] the element attributes formated in a hash
340
+ def to_hash
341
+ attrs = {}
342
+ attributes.each{ |attr| attrs[attr.name] = attr.type }
343
+ elements.each{ |el| attrs[el.name] = el.to_hash } if elements
344
+ if self.class == Vector
345
+ name ? {name => [attrs]} : [attrs]
346
+ else
347
+ name ? {name => attrs} : attrs
348
+ end
349
+ end
350
+
351
+ def to_html
352
+ output = ""
353
+ if name
354
+ output << "<li>"
355
+ output << "<span class='label notice'>#{name}</span> of type <span class='label success'>#{self.is_a?(Vector) ? 'Array' : 'Object'}</span>"
356
+ end
357
+ if self.is_a? Vector
358
+ output << "<h6>Properties of each array item:</h6>"
359
+ else
360
+ output << "<h6>Properties:</h6>"
361
+ end
362
+ output << "<ul>"
363
+ properties.each do |prop|
364
+ output << "<li><span class='label notice'>#{prop.name}</span> of type <span class='label success'>#{prop.type}</span> "
365
+ output << prop.doc unless prop.doc.blank?
366
+ output << "</li>"
367
+ end
368
+ arrays.each{ |arr| output << arr.html }
369
+ elements.each {|el| output << el.to_html } if elements
370
+ output << "</ul>"
371
+ output << "</li>" if name
372
+ output
373
+ end
374
+
315
375
  private
316
376
 
317
377
  # Create a meta element attribute
data/lib/wsdsl.rb CHANGED
@@ -8,14 +8,14 @@ require File.expand_path('ws_list', File.dirname(__FILE__))
8
8
  # their params, http verbs, formats expected as well as the documentation
9
9
  # for all these aspects of a web service.
10
10
  #
11
- # This DSL is only meant to describe a web service and isn't meant to cover any type
11
+ # This DSL is only meant to describe a web service and isn't meant to cover any type
12
12
  # of implementation details. It is meant to be framework/tool agnostic.
13
13
  #
14
14
  # However, tools can be built around the Web Service DSL data structure to extract documentation,
15
15
  # generate routing information, verify that an incoming request is valid, generate automated tests...
16
16
  #
17
- #
18
- #
17
+ #
18
+ #
19
19
  # WSDSL
20
20
  # |
21
21
  # |__ service options (name, url, SSL, auth required formats, verbs, controller name, action, version, extra)
@@ -37,71 +37,71 @@ require File.expand_path('ws_list', File.dirname(__FILE__))
37
37
  # |_ response (instance of Documentation.new)
38
38
  # |_ elements (array of instances of WSDSL::Documentation::ElementDoc, each element has a name and a list of attributes)
39
39
  # |_ attributes (Hash with the key being the attribute name and the value being the attribute's documentation)
40
- #
40
+ #
41
41
  # @since 0.0.3
42
42
  # @api public
43
43
  class WSDSL
44
-
44
+
45
45
  # Returns the service url
46
46
  #
47
47
  # @return [String] The service url
48
48
  # @api public
49
49
  attr_reader :url
50
-
50
+
51
51
  # List of all the service params
52
52
  #
53
53
  # @return [Array<WSDSL::Params>]
54
54
  # @api public
55
55
  attr_reader :defined_params
56
-
56
+
57
57
  # Documentation instance containing all the service doc
58
58
  #
59
59
  # @return [WSDSL::Documentation]
60
60
  # @api public
61
61
  attr_reader :doc
62
-
62
+
63
63
  # The HTTP verb supported
64
64
  #
65
65
  # @return [Symbol]
66
66
  # @api public
67
67
  attr_reader :verb
68
-
68
+
69
69
  # Service's version
70
70
  #
71
71
  # @return [String]
72
72
  # @api public
73
73
  attr_reader :version
74
-
74
+
75
75
  # Controller instance associated with the service
76
76
  #
77
77
  # @return [WSController]
78
78
  # @api public
79
79
  attr_reader :controller
80
-
81
- # Name of the controller action associated with the service
80
+
81
+ # Name of the controller action associated with the service
82
82
  #
83
83
  # @return [String]
84
84
  # @api public
85
85
  attr_accessor :action
86
-
86
+
87
87
  # Name of the controller associated with the service
88
88
  #
89
89
  # @return [String]
90
90
  # @api public
91
91
  attr_accessor :controller_name
92
-
92
+
93
93
  # Name of the service
94
94
  #
95
95
  # @return [String]
96
96
  # @api public
97
97
  attr_reader :name
98
-
98
+
99
99
  # Is SSL required?
100
100
  #
101
101
  # @return [Boolean]
102
102
  # @api public
103
103
  attr_reader :ssl
104
-
104
+
105
105
  # Is authentication required?
106
106
  #
107
107
  # @return [Boolean]
@@ -109,12 +109,12 @@ class WSDSL
109
109
  attr_reader :auth_required
110
110
 
111
111
  # Extra placeholder to store data in based on developer's discretion.
112
- #
112
+ #
113
113
  # @return [Hash] A hash storing extra data based.
114
114
  # @api public
115
115
  # @since 0.1
116
116
  attr_reader :extra
117
-
117
+
118
118
  # Service constructor which is usually used via {Kernel#describe_service}
119
119
  #
120
120
  # @param [String] url Service's url
@@ -142,7 +142,7 @@ class WSDSL
142
142
  @auth_required = true
143
143
  @extra = {}
144
144
  end
145
-
145
+
146
146
  # Checks the WSDSL flag to see if the controller names are pluralized.
147
147
  #
148
148
  # @return [Boolean] The updated value, default to false
@@ -155,7 +155,7 @@ class WSDSL
155
155
  # Sets a WSDSL global flag so all controller names will be automatically pluralized.
156
156
  #
157
157
  # @param [Boolean] True if the controllers are pluralized, False otherwise.
158
- #
158
+ #
159
159
  # @return [Boolean] The updated value
160
160
  # @api public
161
161
  # @since 0.1.1
@@ -176,7 +176,7 @@ class WSDSL
176
176
  # Sets a WSDSL global flag so the controller settings can be generated
177
177
  # Setting this flag will automatically set the controller/action names.
178
178
  # @param [Boolean] True if the controllers are pluralized, False otherwise.
179
- #
179
+ #
180
180
  # @return [Boolean] The updated value
181
181
  # @api public
182
182
  # @since 0.1.1
@@ -194,9 +194,10 @@ class WSDSL
194
194
  # @api private
195
195
  def controller_dispatch(app)
196
196
  unless @controller
197
- if Object.const_defined?(@controller_name)
198
- @controller = Object.const_get(@controller_name)
199
- else
197
+ klass = @controller_name.split("::")
198
+ begin
199
+ @controller = klass.inject(Object) { |const,k| const.const_get(k) }
200
+ rescue NameError => e
200
201
  raise "The #{@controller_name} class was not found"
201
202
  end
202
203
  end
@@ -204,8 +205,8 @@ class WSDSL
204
205
  # param verification could be done when the controller gets initialized.
205
206
  @controller.new(app, self).send(@action)
206
207
  end
207
-
208
- # Returns the defined params
208
+
209
+ # Returns the defined params
209
210
  # for DSL use only!
210
211
  # To keep the distinction between the request params and the service params
211
212
  # using the +defined_params+ accessor is recommended.
@@ -221,7 +222,7 @@ class WSDSL
221
222
  end
222
223
  end
223
224
  alias :param :params
224
-
225
+
225
226
  # Returns true if the DSL defined any params
226
227
  #
227
228
  # @return [Boolean]
@@ -236,7 +237,7 @@ class WSDSL
236
237
  def required_rules
237
238
  @defined_params.list_required
238
239
  end
239
-
240
+
240
241
  # Returns an array of optional param rules
241
242
  #
242
243
  # @return [Array<WSDSL::Params::Rule>]Only the optional param rules
@@ -244,7 +245,7 @@ class WSDSL
244
245
  def optional_rules
245
246
  @defined_params.list_optional
246
247
  end
247
-
248
+
248
249
  # Returns an array of namespaced params
249
250
  # @see WSDSL::Params#namespaced_params
250
251
  #
@@ -253,7 +254,7 @@ class WSDSL
253
254
  def nested_params
254
255
  @defined_params.namespaced_params
255
256
  end
256
-
257
+
257
258
  # Mark that the service doesn't require authentication.
258
259
  # Note: Authentication is turned on by default
259
260
  #
@@ -262,7 +263,7 @@ class WSDSL
262
263
  def disable_auth
263
264
  @auth_required = false
264
265
  end
265
-
266
+
266
267
  # Mark that the service requires a SSL connection
267
268
  #
268
269
  # @return [Boolean]
@@ -270,19 +271,19 @@ class WSDSL
270
271
  def enable_ssl
271
272
  @ssl = true
272
273
  end
273
-
274
+
274
275
  # Mark the current service as not accepting any params.
275
- # This is purely for expressing the developer's objective since
276
+ # This is purely for expressing the developer's objective since
276
277
  # by default an error is raise if no params are defined and some
277
278
  # params are sent.
278
- #
279
+ #
279
280
  # @return [Nil]
280
281
  # @api public
281
282
  def accept_no_params!
282
283
  # no op operation since this is the default behavior
283
284
  # unless params get defined. Makes sense for documentation tho.
284
285
  end
285
-
286
+
286
287
  # Returns the service response
287
288
  # @yield The service response object
288
289
  #
@@ -295,7 +296,7 @@ class WSDSL
295
296
  @response
296
297
  end
297
298
  end
298
-
299
+
299
300
  # Sets or returns the supported formats
300
301
  # @param [String, Symbol] f_types Format type supported, such as :xml
301
302
  #
@@ -305,7 +306,7 @@ class WSDSL
305
306
  f_types.each{|f| @formats << f unless @formats.include?(f) }
306
307
  @formats
307
308
  end
308
-
309
+
309
310
  # Sets the accepted HTTP verbs or return it if nothing is passed.
310
311
  #
311
312
  # @return [String, Symbol]
@@ -318,7 +319,7 @@ class WSDSL
318
319
  update_restful_action(@verb)
319
320
  @verb
320
321
  end
321
-
322
+
322
323
  # Yields and returns the documentation object
323
324
  # @yield [WSDSL::Documentation]
324
325
  #
@@ -328,17 +329,39 @@ class WSDSL
328
329
  yield(doc)
329
330
  end
330
331
 
331
- SERVICE_ROOT_REGEXP = /(.*?)[\/\(\.]/
332
+ # Assign a route loading point to compare two routes.
333
+ # Using this point value, one can load routes with the more globbing
334
+ # routes later than short routes.
335
+ #
336
+ # @return [Integer] point value
337
+ def route_loading_point
338
+ url =~ /(.*?):(.*?)[\/\.](.*)/
339
+ return url.size if $1.nil?
340
+ # The shortest the prepend, the further the service should be loaded
341
+ prepend = $1.size
342
+ # The shortest the placeholder, the further it should be in the queue
343
+ place_holder = $2.size
344
+ # The shortest the trail, the further it should be in the queue
345
+ trail = $3.size
346
+ prepend + place_holder + trail
347
+ end
348
+
349
+ # Compare two services using the route loading point
350
+ def <=> (other)
351
+ route_loading_point <=> other.route_loading_point
352
+ end
353
+
354
+ SERVICE_ROOT_REGEXP = /(.*?)[\/\(\.]/
332
355
  SERVICE_ACTION_REGEXP = /[\/\(\.]([a-z0-9_]+)[\/\(\.\?]/i
333
356
  SERVICE_RESTFUL_SHOW_REGEXP = /\/:[a-z0-9_]+\.\w{3}$/
334
-
357
+
335
358
  private
336
-
359
+
337
360
  # extracts the service root name out of the url using a regexp
338
361
  def extract_service_root_name(url)
339
362
  url[SERVICE_ROOT_REGEXP, 1] || url
340
363
  end
341
-
364
+
342
365
  # extracts the action name out of the url using a regexp
343
366
  # Defaults to the list action
344
367
  def extract_service_action(url)
@@ -348,7 +371,7 @@ class WSDSL
348
371
  url[SERVICE_ACTION_REGEXP, 1] || 'list'
349
372
  end
350
373
  end
351
-
374
+
352
375
  # Check if we need to use a restful route in which case we need
353
376
  # to update the service action
354
377
  def update_restful_action(verb)
@@ -388,5 +411,5 @@ module Kernel
388
411
  WSList.add(service)
389
412
  service
390
413
  end
391
-
414
+
392
415
  end
@@ -3,35 +3,35 @@ WSDSLSpecOptions = ['RSpec', 'Bacon'] # usually pulled from a model
3
3
  describe_service "services/test.xml" do |service|
4
4
  service.formats :xml, :json
5
5
  service.http_verb :get
6
-
6
+
7
7
  service.params do |p|
8
8
  p.string :framework, :in => WSDSLSpecOptions, :null => false, :required => true
9
-
9
+
10
10
  p.datetime :timestamp, :default => Time.now
11
11
  p.string :alpha, :in => ['a', 'b', 'c']
12
12
  p.string :version, :null => false
13
13
  p.integer :num, :minvalue => 42
14
14
 
15
15
  end
16
-
16
+
17
17
  # service.param :delta, :optional => true, :type => 'float'
18
- # # if the optional flag isn't passed, the param is considered required.
18
+ # # if the optional flag isn't passed, the param is considered required.
19
19
  # service.param :epsilon, :type => 'string'
20
-
20
+
21
21
  service.params.namespace :user do |user|
22
22
  user.integer :id, :required => :true
23
23
  user.string :sex, :in => %Q{female, male}
24
24
  user.boolean :mailing_list, :default => true
25
25
  end
26
-
27
- # the response contains a list of player creation ratings each object in the list
28
-
26
+
27
+ # the response contains a list of player creation ratings each object in the list
28
+
29
29
  service.response do |response|
30
30
  response.element(:name => "player_creation_ratings") do |e|
31
31
  e.attribute :id => :integer, :doc => "id doc"
32
32
  e.attribute :is_accepted => :boolean, :doc => "is accepted doc"
33
33
  e.attribute :name => :string, :doc => "name doc"
34
-
34
+
35
35
  e.array :player_creation_rating, 'PlayerCreationRating' do |a|
36
36
  a.attribute :comments => :string, :doc => "comments doc"
37
37
  a.attribute :player_id => :integer, :doc => "player_id doc"
@@ -40,17 +40,17 @@ describe_service "services/test.xml" do |service|
40
40
  end
41
41
  end
42
42
  end
43
-
43
+
44
44
  service.documentation do |doc|
45
45
  # doc.overall <markdown description text>
46
46
  doc.overall <<-DOC
47
47
  This is a test service used to test the framework.
48
48
  DOC
49
-
49
+
50
50
  # doc.params <name>, <definition>
51
51
  doc.param :framework, "The test framework used, could be one of the two following: #{WSDSLSpecOptions.join(", ")}."
52
52
  doc.param :version, "The version of the framework to use."
53
-
53
+
54
54
  # doc.example <markdown text>
55
55
  doc.example <<-DOC
56
56
  The most common way to use this service looks like that:
@@ -69,7 +69,7 @@ end
69
69
  describe_service "services.xml" do |service|
70
70
  service.formats :xml
71
71
  service.http_verb :put
72
-
72
+
73
73
  end
74
74
 
75
75
  describe_service "services/array_param.xml" do |s|
data/spec/wsdsl_spec.rb CHANGED
@@ -1,25 +1,25 @@
1
1
  require File.expand_path("spec_helper", File.dirname(__FILE__))
2
2
 
3
3
  describe WSDSL do
4
-
4
+
5
5
  before :all do
6
6
  @service = WSList.all.find{|s| s.url == 'services/test.xml'}
7
7
  @service.should_not be_nil
8
8
  end
9
-
9
+
10
10
  it "should have an url" do
11
11
  # dummy test since that's how we found the service, but oh well
12
12
  @service.url.should == 'services/test.xml'
13
13
  end
14
-
14
+
15
15
  it "should have some http verbs defined" do
16
16
  @service.verb.should == :get
17
17
  end
18
-
18
+
19
19
  it "should have supported formats defined" do
20
20
  @service.formats.should == [:xml, :json]
21
21
  end
22
-
22
+
23
23
  it "should have params info" do
24
24
  @service.params.should be_an_instance_of(WSDSL::Params)
25
25
  end
@@ -27,15 +27,89 @@ describe WSDSL do
27
27
  it "should have direct access to the required params" do
28
28
  @service.required_rules.should == @service.params.list_required
29
29
  end
30
-
30
+
31
31
  it "should have direct access to the optional params" do
32
32
  @service.optional_rules.should == @service.params.list_optional
33
33
  end
34
-
34
+
35
35
  it "should have direct access to the nested params" do
36
36
  @service.nested_params.should == @service.params.namespaced_params
37
37
  end
38
-
38
+
39
+ describe "#controller_dispatch" do
40
+
41
+ class ProjectsController
42
+ def initialize(app, service)
43
+ @app = app
44
+ @service = service.name
45
+ end
46
+
47
+ def send(action)
48
+ [@app, @service, action]
49
+ end
50
+ end
51
+
52
+ module Projects
53
+ class TasksController < ProjectsController
54
+ end
55
+ end
56
+
57
+ module Projects
58
+ module Tasks
59
+ class ItemsController < ProjectsController
60
+ end
61
+ end
62
+ end
63
+
64
+ before :all do
65
+ @original_use_controller_dispatch = WSDSL.use_controller_dispatch
66
+ WSDSL.use_controller_dispatch = true
67
+ @original_services = WSList.all.dup
68
+ WSList.all.clear
69
+ end
70
+
71
+ after :all do
72
+ WSDSL.use_controller_dispatch = @original_use_controller_dispatch
73
+ WSList.all.replace @original_services
74
+ end
75
+
76
+ it "should be able to dispatch controller" do
77
+ describe_service("projects.xml") { |s| }
78
+ service = WSList["projects.xml"]
79
+ service.controller_dispatch("application").
80
+ should == ["application", "projects", "list"]
81
+ end
82
+
83
+ it "should be able to dispatch namespaced controller" do
84
+ describe_service("project/:project_id/tasks.xml") do |service|
85
+ service.controller_name = "Projects::TasksController"
86
+ service.action = "list"
87
+ end
88
+
89
+ describe_service("project/:project_id/task/:task_id/items.xml") do |service|
90
+ service.controller_name = "Projects::Tasks::ItemsController"
91
+ service.action = "list"
92
+ end
93
+
94
+ service = WSList["project/:project_id/tasks.xml"]
95
+ service.controller_dispatch("application").should == ["application", "project", "list"]
96
+
97
+ service = WSList["project/:project_id/task/:task_id/items.xml"]
98
+ service.controller_dispatch("application").should == ["application", "project", "list"]
99
+ end
100
+
101
+ it "should raise exception when controller class is not found" do
102
+ describe_service("unknown.xml") do |service|
103
+ service.controller_name = "UnknownController"
104
+ service.action = "list"
105
+ end
106
+ service = WSList["unknown.xml"]
107
+ lambda { service.controller_dispatch("application") }.
108
+ should raise_error("The UnknownController class was not found")
109
+ end
110
+
111
+ end
112
+
39
113
  describe "With controller dispatch on" do
40
114
  before :all do
41
115
  @original_services = WSList.all.dup
@@ -58,12 +132,12 @@ describe WSDSL do
58
132
  ExtlibCopy.classify('preferences').should == 'Preferences'
59
133
  service.controller_name.should == 'PreferencesController'
60
134
  end
61
-
135
+
62
136
  it "should set the action accordingly" do
63
137
  @c_service.action.should_not be_nil
64
- @c_service.action.should == 'test'
138
+ @c_service.action.should == 'test'
65
139
  end
66
-
140
+
67
141
  it "should support restful routes based on the HTTP verb" do
68
142
  service = WSList.all.find{|s| s.url == "services.xml"}
69
143
  service.should_not be_nil
@@ -110,21 +184,22 @@ describe WSDSL do
110
184
  service.controller_name.should == "CustomController"
111
185
  service.action.should == "foo"
112
186
  end
187
+
113
188
  end
114
189
 
115
190
 
116
191
  describe WSDSL::Params do
117
-
192
+
118
193
  before(:all) do
119
194
  @sparams = @service.params
120
195
  end
121
-
196
+
122
197
  it "should have the possibility to have a space name" do
123
198
  @sparams.should respond_to(:space_name)
124
199
  service_params = WSDSL::Params.new(:space_name => 'spec_test')
125
200
  service_params.space_name.should == 'spec_test'
126
201
  end
127
-
202
+
128
203
  it "should have a list of required param rules" do
129
204
  @sparams.list_required.should be_an_instance_of(Array)
130
205
  @sparams.list_required.length.should == 1
@@ -134,52 +209,52 @@ describe WSDSL do
134
209
  @sparams.list_optional.should be_an_instance_of(Array)
135
210
  @sparams.list_optional.length.should == 4
136
211
  end
137
-
212
+
138
213
  it "should have a list of namespaced param rules" do
139
214
  @sparams.namespaced_params.should be_an_instance_of(Array)
140
215
  @sparams.namespaced_params.length.should == 1
141
216
  @sparams.namespaced_params.first.space_name.should == :user
142
217
  end
143
-
218
+
144
219
  describe WSDSL::Params::Rule do
145
220
  before :all do
146
221
  @rule = @sparams.list_required.first
147
222
  @rule.should_not be_nil
148
223
  end
149
-
224
+
150
225
  it "should have a name" do
151
226
  @rule.name.should == :framework
152
227
  end
153
-
228
+
154
229
  it "should have options" do
155
230
  @rule.options[:type].should == :string
156
231
  @rule.options[:in].should == WSDSLSpecOptions
157
232
  @rule.options[:null].should be_false
158
233
  end
159
234
  end
160
-
235
+
161
236
  end
162
-
237
+
163
238
  it "should have some documentation" do
164
239
  @service.doc.should be_an_instance_of(WSDSL::Documentation)
165
240
  end
166
-
241
+
167
242
  describe WSDSL::Documentation do
168
243
  before(:all) do
169
244
  @doc = @service.doc
170
245
  @doc.should_not be_nil
171
246
  end
172
-
247
+
173
248
  it "should have an overall description" do
174
249
  @doc.desc.strip.should == "This is a test service used to test the framework."
175
250
  end
176
-
251
+
177
252
  it "should have a list of params doc" do
178
253
  @doc.params_doc.should be_an_instance_of(Hash)
179
254
  @doc.params_doc.keys.sort.should == [:framework, :version]
180
255
  @doc.params_doc[:framework].should == "The test framework used, could be one of the two following: #{WSDSLSpecOptions.join(", ")}."
181
256
  end
182
-
257
+
183
258
  it "should allow to define namespaced params doc" do
184
259
  service = WSList.all.find{|s| s.url == "services.xml"}
185
260
  service.documentation do |doc|
@@ -192,7 +267,7 @@ describe WSDSL do
192
267
  ns.should_not be_nil
193
268
  ns.params[:id].should == "Ze id."
194
269
  end
195
-
270
+
196
271
  it "should have an optional list of examples" do
197
272
  @doc.examples.should be_an_instance_of(Array)
198
273
  @doc.examples.first.should == <<-DOC
@@ -200,11 +275,11 @@ The most common way to use this service looks like that:
200
275
  http://example.com/services/test.xml?framework=rspec&version=2.0.0
201
276
  DOC
202
277
  end
203
-
278
+
204
279
  it "should have the service response documented" do
205
280
  @doc.response.should_not be_nil
206
281
  end
207
-
282
+
208
283
  it "should have documentation for the response elements via the response itself" do
209
284
  @service.response.elements.first.should_not be_nil
210
285
  @service.response.elements.first.doc.should_not be_nil
@@ -215,7 +290,7 @@ The most common way to use this service looks like that:
215
290
  @service.response.elements.first.doc.attributes.should_not be_empty
216
291
  @service.response.elements.first.doc.attributes[:id].should == "id doc"
217
292
  end
218
-
293
+
219
294
  it "should have documentation for a response element array" do
220
295
  element = @service.response.elements.first
221
296
  element.arrays.should_not be_empty
@@ -223,7 +298,7 @@ The most common way to use this service looks like that:
223
298
  element.arrays.first.type.should == "PlayerCreationRating"
224
299
  element.arrays.first.attributes.should_not be_empty
225
300
  end
226
-
301
+
227
302
  it "should have documentation for the attributes of an response element array" do
228
303
  element = @service.response.elements.first
229
304
  array = element.arrays.first
data/wsdsl.gemspec CHANGED
@@ -4,14 +4,14 @@
4
4
  # -*- encoding: utf-8 -*-
5
5
 
6
6
  Gem::Specification.new do |s|
7
- s.name = %q{wsdsl}
8
- s.version = "0.4.3"
7
+ s.name = "wsdsl"
8
+ s.version = "0.5.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
- s.authors = [%q{Matt Aimonetti}]
12
- s.date = %q{2011-09-23}
13
- s.description = %q{A Ruby DSL describing Web Services without implementation details.}
14
- s.email = %q{mattaimonetti@gmail.com}
11
+ s.authors = ["Matt Aimonetti"]
12
+ s.date = "2012-01-10"
13
+ s.description = "A Ruby DSL describing Web Services without implementation details."
14
+ s.email = "mattaimonetti@gmail.com"
15
15
  s.extra_rdoc_files = [
16
16
  "LICENSE",
17
17
  "README.md"
@@ -43,11 +43,11 @@ Gem::Specification.new do |s|
43
43
  "spec/wsdsl_spec.rb",
44
44
  "wsdsl.gemspec"
45
45
  ]
46
- s.homepage = %q{http://github.com/mattetti/wsdsl}
47
- s.licenses = [%q{MIT}]
48
- s.require_paths = [%q{lib}]
49
- s.rubygems_version = %q{1.8.6}
50
- s.summary = %q{Web Service DSL}
46
+ s.homepage = "http://github.com/mattetti/wsdsl"
47
+ s.licenses = ["MIT"]
48
+ s.require_paths = ["lib"]
49
+ s.rubygems_version = "1.8.10"
50
+ s.summary = "Web Service DSL"
51
51
 
52
52
  if s.respond_to? :specification_version then
53
53
  s.specification_version = 3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wsdsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.5.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-09-23 00:00:00.000000000Z
12
+ date: 2012-01-10 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Ruby DSL describing Web Services without implementation details.
15
15
  email: mattaimonetti@gmail.com
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  version: '0'
66
66
  requirements: []
67
67
  rubyforge_project:
68
- rubygems_version: 1.8.6
68
+ rubygems_version: 1.8.10
69
69
  signing_key:
70
70
  specification_version: 3
71
71
  summary: Web Service DSL