Class: PadmaUser
- Inherits:
-
LogicalModel
- Object
- LogicalModel
- PadmaUser
- Includes:
- Gravtastic
- Defined in:
- app/models/padma_user.rb
Constant Summary collapse
- TIMEOUT =
milisecons
5500
- PER_PAGE =
9999
Instance Attribute Summary collapse
-
#cached_current_account ⇒ Object
Returns the value of attribute cached_current_account.
Instance Method Summary collapse
- #current_account ⇒ PadmaAccount
-
#enabled_accounts ⇒ Array <PadmaAccount>
Returns me enabled accounts as Padma::Account objects.
-
#id ⇒ Object
LogicalModel expects an id to create resource_uri.
-
#padma_accounts ⇒ Array <PadmaAccount>
Returns my accounts as Padma::Account objects.
- #verbose_help? ⇒ Boolean
Instance Attribute Details
#cached_current_account ⇒ Object
Returns the value of attribute cached_current_account.
42 43 44 |
# File 'app/models/padma_user.rb', line 42 def cached_current_account @cached_current_account end |
Instance Method Details
#current_account ⇒ PadmaAccount
34 35 36 37 38 39 40 41 |
# File 'app/models/padma_user.rb', line 34 def current_account unless cached_current_account if self.current_account_name self.cached_current_account= PadmaAccount.find(self.current_account_name) end end cached_current_account end |
#enabled_accounts ⇒ Array <PadmaAccount>
Returns me enabled accounts as Padma::Account objects
53 54 55 56 |
# File 'app/models/padma_user.rb', line 53 def enabled_accounts return [] if self.accounts.nil? self.accounts.reject{|a|!a['enabled']}.map{|a|PadmaAccount.new(a)} end |
#id ⇒ Object
LogicalModel expects an id to create resource_uri
29 30 31 |
# File 'app/models/padma_user.rb', line 29 def id self.username end |
#padma_accounts ⇒ Array <PadmaAccount>
Returns my accounts as Padma::Account objects
47 48 49 |
# File 'app/models/padma_user.rb', line 47 def padma_accounts self.accounts.map{|a|PadmaAccount.new(a)} end |
#verbose_help? ⇒ Boolean
58 59 60 |
# File 'app/models/padma_user.rb', line 58 def verbose_help? !!self.verbose_help end |