Class: Looks::Command::Set
- Inherits:
-
AccountManagement
- Object
- Base
- AccountManagement
- Looks::Command::Set
- Defined in:
- lib/looks/command/set.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from AccountManagement
Methods inherited from Base
#initialize, #run, #to_s, #usage
Constructor Details
This class inherits a constructor from Looks::Command::Base
Instance Method Details
#arguments ⇒ Object
9 10 11 |
# File 'lib/looks/command/set.rb', line 9 def arguments [ '<address>', '<id>' ] end |
#execute(args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/looks/command/set.rb', line 13 def execute(args) super address, id = args account = Gravatar::Account.new(config) begin account.set(address, id) rescue Gravatar::IncorrectMethodParameterError addresses = account.addresses.map { |address| address.email } if addresses.include? address raise Error, "#{id}: Unknown identifier" else raise Error, "#{address}: Unknown email address" end end end |