Commit eae3c6c
committed
Allow switching on instance or class for provider
Prior to this commit, instance methods of the Provider class were
passing the instance's class to the associated response classes. This
was a surprise; Why would an instance method send as a parameter
it's class instead of the instance method's instance?
This made it difficult to add context to the Provider on a request by
request basis; In our implementation, we wanted to pass the controller
to the instantiated provider instance.
Further, the following line of code was dangerous, in that it would
override the URL for the entire class and all future uses. (Perhaps
that's the OAI specification, but it's a dangerous class mutation)
```ruby
self.class.url = params['url'] ? params.delete('url') : self.class.url
```
All told, this commit seeks to:
* preserve backwards compatibility by adding instance methods that
mirror the expected class methods used by the Response module's
classes.
* provide extensibility for downstream implementers when they
instantiate an OAI::Provider1 parent 45d8051 commit eae3c6c
File tree
3 files changed
+91
-8
lines changed- lib/oai
- test/provider
3 files changed
+91
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
240 | 240 | | |
241 | 241 | | |
242 | 242 | | |
| 243 | + | |
243 | 244 | | |
244 | 245 | | |
245 | | - | |
| 246 | + | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| |||
292 | 293 | | |
293 | 294 | | |
294 | 295 | | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
295 | 329 | | |
296 | 330 | | |
297 | | - | |
| 331 | + | |
298 | 332 | | |
299 | 333 | | |
300 | 334 | | |
301 | 335 | | |
302 | 336 | | |
303 | | - | |
| 337 | + | |
304 | 338 | | |
305 | 339 | | |
306 | 340 | | |
307 | 341 | | |
308 | 342 | | |
309 | | - | |
| 343 | + | |
310 | 344 | | |
311 | 345 | | |
312 | 346 | | |
313 | 347 | | |
314 | 348 | | |
315 | | - | |
| 349 | + | |
316 | 350 | | |
317 | 351 | | |
318 | 352 | | |
319 | 353 | | |
320 | 354 | | |
321 | | - | |
| 355 | + | |
322 | 356 | | |
323 | 357 | | |
324 | 358 | | |
325 | 359 | | |
326 | 360 | | |
327 | | - | |
| 361 | + | |
328 | 362 | | |
329 | 363 | | |
330 | 364 | | |
| |||
336 | 370 | | |
337 | 371 | | |
338 | 372 | | |
339 | | - | |
| 373 | + | |
340 | 374 | | |
341 | 375 | | |
342 | 376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
0 commit comments