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
19 20 21 22 |
# File 'lib/lastpass-api/groups.rb', line 19 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 |
# File 'lib/lastpass-api/groups.rb', line 4 def find( search_text, with_password: false ) search_text << '/' unless search_text.to_s.end_with? '/' params = super if params.is_a?( Hash ) && params[:name]&.end_with?( '/' ) Group.new( params ) end end |
#find_all(search_text = '.*', with_passwords: false) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/lastpass-api/groups.rb', line 12 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
25 26 27 28 |
# File 'lib/lastpass-api/groups.rb', line 25 def inspect original_inspect = super original_inspect.split( ' ' ).first << '>' end |