Class: Client
- Inherits:
-
Object
- Object
- Client
- Defined in:
- lib/trellist/client.rb
Instance Attribute Summary collapse
-
#board ⇒ Object
Returns the value of attribute board.
-
#cards ⇒ Object
Returns the value of attribute cards.
-
#lists ⇒ Object
Returns the value of attribute lists.
Instance Method Summary collapse
- #generate_links(format: 'markdown', prefix: '', suffix: '') ⇒ Object
- #get_board_lists ⇒ Object
-
#initialize(board_id:, key:, token:) ⇒ Client
constructor
A new instance of Client.
- #list_cards(list_id) ⇒ Object
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
#board ⇒ Object
Returns the value of attribute board.
24 25 26 |
# File 'lib/trellist/client.rb', line 24 def board @board end |
#cards ⇒ Object
Returns the value of attribute cards.
24 25 26 |
# File 'lib/trellist/client.rb', line 24 def cards @cards end |
#lists ⇒ Object
Returns the value of attribute lists.
24 25 26 |
# File 'lib/trellist/client.rb', line 24 def lists @lists end |
Instance Method Details
#generate_links(format: 'markdown', prefix: '', suffix: '') ⇒ Object
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_lists ⇒ Object
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 |