Class: Kangaroo::Util::Database
- Inherits:
-
Object
- Object
- Kangaroo::Util::Database
- Defined in:
- lib/kangaroo/util/database.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#db_name ⇒ Object
Returns the value of attribute db_name.
-
#password ⇒ Object
Returns the value of attribute password.
-
#user ⇒ Object
Returns the value of attribute user.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
Instance Method Summary collapse
-
#common ⇒ Object
Access to the Common Proxy.
-
#db ⇒ Object
Access to the Database Proxy.
-
#initialize(client, name, user, password) ⇒ Database
constructor
Initialize a new OpenERP database configuration.
-
#logged_in? ⇒ Boolean
Test of the current user is logged in.
-
#login ⇒ Object
Login the current user, unless logged in.
-
#login! ⇒ Object
Login the current user.
-
#object(model_name) ⇒ Object
Access to the Object Proxy.
-
#report ⇒ Object
Access to the Report Proxy.
-
#superadmin(super_password) ⇒ Object
Access to the Superadmin Proxy.
-
#wizard ⇒ Object
Access to the Wizard Proxy.
-
#workflow ⇒ Object
Access to the Workflow Proxy.
Constructor Details
#initialize(client, name, user, password) ⇒ Database
Initialize a new OpenERP database configuration
12 13 14 |
# File 'lib/kangaroo/util/database.rb', line 12 def initialize client, name, user, password @client, @db_name, @user, @password = client, name, user, password end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
4 5 6 |
# File 'lib/kangaroo/util/database.rb', line 4 def client @client end |
#db_name ⇒ Object
Returns the value of attribute db_name.
4 5 6 |
# File 'lib/kangaroo/util/database.rb', line 4 def db_name @db_name end |
#password ⇒ Object
Returns the value of attribute password.
4 5 6 |
# File 'lib/kangaroo/util/database.rb', line 4 def password @password end |
#user ⇒ Object
Returns the value of attribute user.
4 5 6 |
# File 'lib/kangaroo/util/database.rb', line 4 def user @user end |
#user_id ⇒ Object
Returns the value of attribute user_id.
4 5 6 |
# File 'lib/kangaroo/util/database.rb', line 4 def user_id @user_id end |
Instance Method Details
#common ⇒ Object
Access to the Common Proxy
34 35 36 |
# File 'lib/kangaroo/util/database.rb', line 34 def common client.common end |
#db ⇒ Object
Access to the Database Proxy
27 28 29 |
# File 'lib/kangaroo/util/database.rb', line 27 def db client.db end |
#logged_in? ⇒ Boolean
Test of the current user is logged in
69 70 71 |
# File 'lib/kangaroo/util/database.rb', line 69 def logged_in? !!user_id end |
#login ⇒ Object
Login the current user, unless logged in.
85 86 87 88 89 |
# File 'lib/kangaroo/util/database.rb', line 85 def login logged_in? || login! rescue false end |
#login! ⇒ Object
Login the current user
76 77 78 79 80 |
# File 'lib/kangaroo/util/database.rb', line 76 def login! @user_id = common.login db_name, user, password logged_in? end |
#object(model_name) ⇒ Object
Access to the Object Proxy
48 49 50 |
# File 'lib/kangaroo/util/database.rb', line 48 def object model_name Proxy::Object.new client.object_service, db_name, user_id, password, model_name end |
#report ⇒ Object
Access to the Report Proxy
62 63 64 |
# File 'lib/kangaroo/util/database.rb', line 62 def report @report_proxy ||= Proxy::Report.new client.report_service, db_name, user_id, password end |
#superadmin(super_password) ⇒ Object
Access to the Superadmin Proxy
20 21 22 |
# File 'lib/kangaroo/util/database.rb', line 20 def superadmin super_password client.superadmin super_password end |
#wizard ⇒ Object
Access to the Wizard Proxy
55 56 57 |
# File 'lib/kangaroo/util/database.rb', line 55 def wizard @wizard_proxy ||= Proxy::Wizard.new client.wizard_service, db_name, user_id, password end |
#workflow ⇒ Object
Access to the Workflow Proxy
41 42 43 |
# File 'lib/kangaroo/util/database.rb', line 41 def workflow @workflow_proxy ||= Proxy::Workflow.new client.object_service, db_name, user_id, password end |