wsdsl 0.1.0 → 0.1.1

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/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -124,7 +124,11 @@ class WSDSL
124
124
  @doc = WSDSL::Documentation.new
125
125
  @response = WSDSL::Response.new
126
126
  @name = extract_service_root_name(url)
127
- @controller_name = "#{ExtlibCopy.classify(name)}Controller"
127
+ if WSDSL.use_pluralized_controllers
128
+ @controller_name = "#{ExtlibCopy.classify(ExtlibCopy::Inflection.pluralize(name))}Controller"
129
+ else
130
+ @controller_name = "#{ExtlibCopy.classify(name)}Controller"
131
+ end
128
132
  @action = extract_service_action(url)
129
133
  @verb = :get
130
134
  @formats = []
@@ -134,6 +138,26 @@ class WSDSL
134
138
  @extra = {}
135
139
  end
136
140
 
141
+ # Checks the WSDSL flag to see if the controller names are pluralized.
142
+ #
143
+ # @return [Boolean] The updated value, default to false
144
+ # @api public
145
+ # @since 0.1.1
146
+ def self.use_pluralized_controllers
147
+ @pluralized_controllers ||= false
148
+ end
149
+
150
+ # Sets a WSDSL global flag so all controller names will be automatically pluralized.
151
+ #
152
+ # @param [Boolean] True if the controllers are pluralized, False otherwise.
153
+ #
154
+ # @return [Boolean] The updated value
155
+ # @api public
156
+ # @since 0.1.1
157
+ def self.use_pluralized_controllers=(val)
158
+ @pluralized_controllers = val
159
+ end
160
+
137
161
  # Offers a way to dispatch the service at runtime
138
162
  # Basically, it dispatches the request to the defined controller/action
139
163
  # The full request cycle looks like that:
@@ -75,6 +75,15 @@ describe WSDSL do
75
75
  service.extra[:custom_name].should == 'fooBar'
76
76
  end
77
77
 
78
+ it "should respect the global controller pluralization flag" do
79
+ WSDSL.use_pluralized_controllers = true
80
+ service = WSDSL.new("player/:id.xml")
81
+ service.controller_name.should == "PlayersController"
82
+ WSDSL.use_pluralized_controllers = false
83
+ service = WSDSL.new("player/:id.xml")
84
+ service.controller_name.should == "PlayerController"
85
+ end
86
+
78
87
  describe WSDSL::Params do
79
88
 
80
89
  before(:all) do
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{wsdsl}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Matt Aimonetti"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 1
9
+ version: 0.1.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Matt Aimonetti