Class: Lastpass::Accounts
- Inherits:
-
Collection
- Object
- Collection
- Lastpass::Accounts
- Defined in:
- lib/lastpass-api/accounts.rb
Instance Method Summary collapse
- #create(params) ⇒ Object
- #find(search_text, with_password: false) ⇒ Object
- #find_all(search_text = '.*', with_passwords: false) ⇒ Object
-
#inspect ⇒ Object
Hide instance variables and values.
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 Account.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?( '/' ) Account.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| Account.new( params ) end end |
#inspect ⇒ Object
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 |