Class: Lastpass::Groups
- Inherits:
-
Collection
- Object
- Collection
- Lastpass::Groups
- Defined in:
- lib/lastpass-api/groups.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
20 21 22 23 |
# File 'lib/lastpass-api/groups.rb', line 20 def create( params ) params.delete( :id ) # Prevent overwriting ID Group.new( params ).save end |
#find(search_text, with_password: false) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/lastpass-api/groups.rb', line 4 def find( search_text, with_password: false ) search_text.to_s.gsub!( '/', '' ) search_text << '/' unless is_number?( search_text ) params = super if params.is_a?( Hash ) && params[:name]&.end_with?( '/' ) Group.new( params ) end end |
#find_all(search_text = '.*', with_passwords: false) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/lastpass-api/groups.rb', line 13 def find_all( search_text = '.*', with_passwords: false ) groups = super.select { |params| params[:name]&.end_with? '/' } groups.map do |params| Group.new( params ) end end |
#inspect ⇒ Object
Hide instance variables and values
26 27 28 29 |
# File 'lib/lastpass-api/groups.rb', line 26 def inspect original_inspect = super original_inspect.split( ' ' ).first << '>' end |