Class: Slackdo::Card

Inherits:
Object
  • Object
show all
Defined in:
lib/slackdo.rb

Instance Method Summary collapse

Instance Method Details

#add_card(card_name, card_desc) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/slackdo.rb', line 63

def add_card(card_name, card_desc)
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
     hash = JSON.parse(file)
  configure_trello
  card = Trello::Card.create(
       name: card_name,
       desc: card_desc,
  list_id: hash['trello_list_id'],
       pos: 'top',
     )
  card.save
  puts 'Card was created on Trello...'
end

#configure_trelloObject



55
56
57
58
59
60
61
62
# File 'lib/slackdo.rb', line 55

def configure_trello
  file = File.read("#{ENV['HOME']}/.slackdo/config.json")
     hash = JSON.parse(file)
  Trello.configure do |config|
       config.developer_public_key = hash['trello_public_key']
       config.member_token = hash['trello_member_token']
     end
end