Class: Commander::TrelloConnection
- Inherits:
-
Object
- Object
- Commander::TrelloConnection
- Defined in:
- lib/commander/trello.rb
Overview
Trello Module
Instance Attribute Summary collapse
-
#board ⇒ Object
Returns the value of attribute board.
Instance Method Summary collapse
-
#add_commander_to_card(commander, card) ⇒ Object
Adds a member to a certain card.
-
#comment_on_card(commander, card) ⇒ Object
Comments on a certain card.
-
#configure_trello ⇒ Object
Configures Trello.
-
#find_card_by_id(id) ⇒ Object
Finds a card by its id.
-
#find_member_by_id(id) ⇒ Object
Finds a member by its id.
-
#find_member_by_username(username) ⇒ Object
Finds a member by its username.
-
#initialize ⇒ TrelloConnection
constructor
Loads the Configuration for Trello Auth.
-
#list_of_assigned_members(card) ⇒ Object
Lists all members who are assigned on a certain card.
Constructor Details
#initialize ⇒ TrelloConnection
Loads the Configuration for Trello Auth
20 21 22 |
# File 'lib/commander/trello.rb', line 20 def initialize configure_trello end |
Instance Attribute Details
#board ⇒ Object
Returns the value of attribute board.
17 18 19 |
# File 'lib/commander/trello.rb', line 17 def board @board end |
Instance Method Details
#add_commander_to_card(commander, card) ⇒ Object
Adds a member to a certain card
25 26 27 |
# File 'lib/commander/trello.rb', line 25 def add_commander_to_card(commander, card) card.add_member(commander) if commander end |
#comment_on_card(commander, card) ⇒ Object
Comments on a certain card
30 31 32 |
# File 'lib/commander/trello.rb', line 30 def comment_on_card(commander, card) card.add_comment(commander) if commander end |
#configure_trello ⇒ Object
Configures Trello
55 56 57 58 59 60 61 |
# File 'lib/commander/trello.rb', line 55 def configure_trello Trello.configure do |config| config.developer_public_key = Commander::CONFIG['consumerkey'] config.member_token = Commander::CONFIG['oauthtoken'] end @board = Trello::Board.find(Commander::CONFIG['board_id']) end |
#find_card_by_id(id) ⇒ Object
Finds a card by its id
50 51 52 |
# File 'lib/commander/trello.rb', line 50 def find_card_by_id(id) @board.cards.find{|c| c.short_id == id.to_i} end |
#find_member_by_id(id) ⇒ Object
Finds a member by its id
45 46 47 |
# File 'lib/commander/trello.rb', line 45 def find_member_by_id(id) @board.members.find { |m| m.id == id } end |
#find_member_by_username(username) ⇒ Object
Finds a member by its username
35 36 37 |
# File 'lib/commander/trello.rb', line 35 def find_member_by_username(username) @board.members.find { |m| m.username == username } end |
#list_of_assigned_members(card) ⇒ Object
Lists all members who are assigned on a certain card
40 41 42 |
# File 'lib/commander/trello.rb', line 40 def list_of_assigned_members(card) card.assignees.map(&:username) end |