Module: TrelloCli::CLI::Commands::Shared

Included in:
Board, Card, List
Defined in:
lib/trello_cli/cli/commands/shared.rb

Instance Method Summary collapse

Instance Method Details

#actions(obj = self) ⇒ Object



6
7
8
# File 'lib/trello_cli/cli/commands/shared.rb', line 6

def actions(obj = self)
  (obj.methods - obj.class.superclass.instance_methods).sort - shared_methods
end

#ensure_credential_envs_setObject



18
19
20
21
22
23
24
25
# File 'lib/trello_cli/cli/commands/shared.rb', line 18

def ensure_credential_envs_set
  %w{TRELLO_MEMBER_TOKEN TRELLO_DEVELOPER_PUBLIC_KEY}.each do |e|
    unless ENV[e]
      puts "#{e} environment variable not set"
      exit 1
    end
  end
end

#helpObject



27
28
29
30
# File 'lib/trello_cli/cli/commands/shared.rb', line 27

def help
  puts "Valid commands for #{target_name}: #{actions.join(', ')}"
  puts "For further help, append -h to sub command."
end

#shared_methodsObject



10
11
12
# File 'lib/trello_cli/cli/commands/shared.rb', line 10

def shared_methods
  TrelloCli::CLI::Commands::Shared.instance_methods
end

#target_nameObject



14
15
16
# File 'lib/trello_cli/cli/commands/shared.rb', line 14

def target_name
  self.class.name.downcase.split('::').last
end