Hi,
because on Friday I finally merge in webclient yast model I create short 
summary of both models, its features and why you should use it.

webservice model:
Inspired by ActiveModel. It adds methods for easy validation, serialization, 
mass loading and callbacks.
for example usage see Ntp and time plugins.
For documentation see - class BaseModel::Base (I cannot connect to hudson for 
direct link)

why use it?
smart to_xml and to_json so you don't need to define own method unless you have 
hash with problematic keys (see time model for example how to solve it)
validations which checks attributes before save
same behavior as ActiveRecord and ActiveResource


webclient model:
Adaptation of ActiveResource to our case of changing site and credentials to 
target machine. It adds method model_interface which sets interface for model 
and fix finding single resource. Also helper methods for HttpMock which tests 
ActiveResource is added.
for example usage see Time plugin or network plugin.
For documentation see module YastModel::Base
example of usage:
class Stime < ActiveResource::Base
   extend YastModel::Base
   model_interface :'org.opensuse.yast.modules.yapi.time'
end

why use it?
you can add functionality to model, so no more controllers which have more then 
one page
same usage as any ActiveResource model, so new programmer is not confused what 
we using
easier testing (there is still place to improve it), but I found that many 
plugins doesn't have test or test is really simple and don't cover enough code.
for testing see how looks tests in network or time module.


Thanks for attention and I welcome any comments, suggestion or bugs ( ..bugs 
are not so much welcome, but I fix it)
Josef

-- 
Josef Reidinger
YaST team
maintainer of perl-Bootloader, YaST2-Repair, webyast 
(language,time,basesystem,ntp)
-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to