Module: CanTango::Api::Masquerade::Account

Defined in:
lib/cantango/masquerade/api/masquerade/account.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#active_accountObject (readonly)

Returns the value of attribute active_account.



5
6
7
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 5

def 
  @active_account
end

#masqueradingObject (readonly)

Returns the value of attribute masquerading.



5
6
7
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 5

def masquerading
  @masquerading
end

Instance Method Details

#masquerade_as(account) ⇒ Object



7
8
9
10
11
12
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 7

def masquerade_as 
  raise "Must be a registered type of account, was: #{}" unless valid_account? 
  @masquerading = true
  @active_account = 
  self
end

#masquerading?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 19

def masquerading?
  !@masquerading.nil?
end

#stop_masqueradeObject



14
15
16
17
# File 'lib/cantango/masquerade/api/masquerade/account.rb', line 14

def stop_masquerade
  @active_account, @masquerading = nil, nil
  self
end