class Slackdo::Card

Public Class Methods

configure_trello() click to toggle source
# File lib/slackdo.rb, line 130
  def self.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

Public Instance Methods

add_card(card_category, card_name, card_desc) click to toggle source
# File lib/slackdo.rb, line 138
  def add_card(card_category, card_name, card_desc)
    file = File.read("#{ENV['HOME']}/.slackdo/config.json")
hash = JSON.parse(file)
    Card.configure_trello
    card_name_full = ''
    card_name_full << "[#{card_category}]"
    card_name_full << " #{card_name}"
    label_id = ''
    hash['trello_label_ids'].each do |id|
          label = Trello::Label.find(id)
          label_id = id if label.name == card_category
    end
    card = Trello::Card.create(
  name: card_name_full,
  desc: card_desc,
         list_id: hash['trello_list_id'],
  pos: 'top',
         card_labels: label_id
)
    card.save
    puts 'Card was created on Trello...'
  end