Class: Piwik::UsersManager
- Defined in:
- lib/piwik/users_manager.rb
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.add(params) ⇒ Object
monkeypatching, as the Piwik API is inconsistent.
- .delete(params) ⇒ Object
- .get(params) ⇒ Object
- .save(params) ⇒ Object
-
.user_exists(params) ⇒ Object
TODO: this one is not working.
Methods inherited from ApiModule
api_call_to_const, available_methods, defaults, method_missing, scoped_methods
Methods included from DataMethods
Methods inherited from Base
call, #call, collection, #collection, #config, #created_at, #delete, #id, #id_attr, #initialize, load, load_config_from_file, #method_missing, #new?, parse_xml, #parse_xml, #save
Methods included from ApiScope
Methods included from Typecast
Constructor Details
This class inherits a constructor from Piwik::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Piwik::Base
Class Method Details
.add(params) ⇒ Object
monkeypatching, as the Piwik API is inconsistent. not all add methods return the same response type. Boo.
31 32 33 34 35 |
# File 'lib/piwik/users_manager.rb', line 31 def self.add params obj = Piwik::User.new(params) resp = self.api_call('addUser',params) obj end |
.delete(params) ⇒ Object
41 42 43 |
# File 'lib/piwik/users_manager.rb', line 41 def self.delete params self.api_call('deleteDelete',params) end |
.get(params) ⇒ Object
23 24 25 26 27 |
# File 'lib/piwik/users_manager.rb', line 23 def self.get params resp = self.get_user(params) raise Piwik::UnknownUser if resp.blank? Piwik::User.new resp end |
.save(params) ⇒ Object
37 38 39 |
# File 'lib/piwik/users_manager.rb', line 37 def self.save params self.api_call('updateUser',params) end |
.user_exists(params) ⇒ Object
TODO: this one is not working. I assume there are other metacoded methods that might throw errors, so a bit or hunting down is in ortder sometime
48 49 50 |
# File 'lib/piwik/users_manager.rb', line 48 def self.user_exists(params) Piwik::UsersManager::UserExists.new(:value => self.api_call('userExists',params)) end |