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.



29
30
31
32
33
34
35
36
37
38
# File 'lib/trellist/client.rb', line 29

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.



27
28
29
# File 'lib/trellist/client.rb', line 27

def board
  @board
end

#cardsObject

Returns the value of attribute cards.



27
28
29
# File 'lib/trellist/client.rb', line 27

def cards
  @cards
end

#listsObject

Returns the value of attribute lists.



27
28
29
# File 'lib/trellist/client.rb', line 27

def lists
  @lists
end

Instance Method Details



48
49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/trellist/client.rb', line 48

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

#get_board_listsObject



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

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

#list_cards(list_id) ⇒ Object



44
45
46
# File 'lib/trellist/client.rb', line 44

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