wingedmonkey/wingedmonkey — pull request #36 by jtomasek (2012-11-26 09:26:53+00:00)
Title: Models provider extensions

This patchset implements provider specific extension models for launchable and provider_application models. The models structure resembles to what is discussed here: https://github.com/wingedmonkey/wingedmonkey/issues/15#issuecomment-10511418
with the exception that the models are not extended using Concerns pattern but using ordinary inheritance.
The reason for this is that when using Concerns to _dynamically_ extend model, it is not possible to define class methods.

In addition, I moved ProviderCollection methods into Provider model class, changed the settings.yml into providers.yml and reworked it into structure that simplifies its usage within Provider model.

current_provider method is now application_controller's method and returns the Provider object found by current_provider_id which is stored in session.

current_provider_model_class method returns correct provider specific model class based on the parameter which is the basic extended model name (eg. :launchable). This method is called in the controller.

example:

We have "Mock" provider selected. session[:current_provider_id] is then "mock".
to list all launchables in launchables_controller#index, we do
```
@launchables = current_provider_model_class(:launchable).all
```
which equals to
```
@launchables = Providers::Mock::MockLaunchable.all
```

With this patchset in, we can start to implement provider specific models and their methods that communicate with their API.

note: Presenters are not currently working as I didn't update it yet. That is next on my list.