Class: Pairzone::Commands::Join

Inherits:
Object
  • Object
show all
Defined in:
lib/pairzone/commands/join.rb

Instance Method Summary collapse

Constructor Details

#initialize(pairzone_name, identity) ⇒ Join

Returns a new instance of Join.



6
7
8
9
# File 'lib/pairzone/commands/join.rb', line 6

def initialize(pairzone_name, identity)
  @pairzone_name = pairzone_name
  @identity = File.expand_path(identity)
end

Instance Method Details

#executeObject



11
12
13
14
15
16
17
18
# File 'lib/pairzone/commands/join.rb', line 11

def execute
  pairzone = Pairzone::Api::Pairzone.find_by_project_name(@pairzone_name)
  if (pairzone.nil?)
    Logger.error("No pairzone exists with the name '#{@pairzone_name}'.")
  else
    pairzone.connect(@identity)
  end
end