Class: Lastpass::Accounts

Inherits:
Collection show all
Defined in:
lib/lastpass-api/accounts.rb

Instance Method Summary collapse

Instance Method Details

#create(params) ⇒ Object



18
19
20
21
# File 'lib/lastpass-api/accounts.rb', line 18

def create( params )
  params.delete( :id ) # Prevent overwriting ID
  .new( params ).save
end

#find(search_text, with_password: false) ⇒ Object



4
5
6
7
8
9
# File 'lib/lastpass-api/accounts.rb', line 4

def find( search_text, with_password: false )
  params = super
  if params.is_a?( Hash ) && !params[:name]&.end_with?( '/' )
    .new( params )
  end
end

#find_all(search_text = '.*', with_passwords: false) ⇒ Object



11
12
13
14
15
16
# File 'lib/lastpass-api/accounts.rb', line 11

def find_all( search_text = '.*', with_passwords: false )
  accounts = super.select { |params| !params[:name]&.end_with? '/' }
  accounts.map do |params|
    .new( params )
  end
end

#inspectObject

Hide instance variables and values



24
25
26
27
# File 'lib/lastpass-api/accounts.rb', line 24

def inspect
  original_inspect = super
  original_inspect.split( ' ' ).first << '>'
end