Class: Client

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(board_id:, key:, token:) ⇒ Client

Returns a new instance of Client.



26
27
28
29
30
31
32
33
34
35
# File 'lib/trellist/client.rb', line 26

def initialize(board_id:, key:, token:)
  @board = board_id
  @key = key
  @token = token

  Trello.configure do |config|
    config.developer_public_key = key
    config.member_token = token
  end
end

Instance Attribute Details

#boardObject

Returns the value of attribute board.



24
25
26
# File 'lib/trellist/client.rb', line 24

def board
  @board
end

#cardsObject

Returns the value of attribute cards.



24
25
26
# File 'lib/trellist/client.rb', line 24

def cards
  @cards
end

#listsObject

Returns the value of attribute lists.



24
25
26
# File 'lib/trellist/client.rb', line 24

def lists
  @lists
end

Instance Method Details



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/trellist/client.rb', line 45

def generate_links(format: 'markdown', prefix: '', suffix: '')
  @cards.each do |card|
    case format
    when 'markdown'
      puts card.as_markdown(prefix: prefix, suffix: suffix)
    when 'plain'
      puts card.short_url
    when 'html'
      puts card.as_html(prefix: prefix, suffix: suffix)
    else
      puts card.inspect
    end
  end
end

#get_board_listsObject



37
38
39
# File 'lib/trellist/client.rb', line 37

def get_board_lists
  @lists = Trello::Board.find(@board).lists
end

#list_cards(list_id) ⇒ Object



41
42
43
# File 'lib/trellist/client.rb', line 41

def list_cards(list_id)
  @cards = Trello::List.find(list_id).cards
end