class LastpassCLI::Item
Public Class Methods
attributes()
click to toggle source
# File lib/lastpass-cli/item.rb, line 3 def self.attributes %w[id name folder username modified_at password notes number url] end
new(attrs)
click to toggle source
# File lib/lastpass-cli/item.rb, line 9 def initialize(attrs) attrs.each do |k, v| set(k.to_s, v) end end
Public Instance Methods
set(attribute, value)
click to toggle source
# File lib/lastpass-cli/item.rb, line 15 def set(attribute, value) if self.class.attributes.include?(attribute) send("#{attribute}=", value) end end
to_h()
click to toggle source
# File lib/lastpass-cli/item.rb, line 21 def to_h self.class.attributes.each_with_object({}) do |attr, hsh| hsh[attr] = send(attr) end end