Class: TrelloFlow::Api::Card
- Defined in:
- lib/trello_flow/api/card.rb
Class Method Summary collapse
Instance Method Summary collapse
- #accept ⇒ Object
- #add_label(label) ⇒ Object
- #add_member(user) ⇒ Object
- #attach(url:) ⇒ Object
- #finish ⇒ Object
- #short_link ⇒ Object
- #short_url ⇒ Object
- #start ⇒ Object
- #to_param ⇒ Object
Methods inherited from Base
Class Method Details
.fields ⇒ Object
6 7 8 |
# File 'lib/trello_flow/api/card.rb', line 6 def self.fields [:name] end |
.find_by_url(url) ⇒ Object
10 11 12 13 |
# File 'lib/trello_flow/api/card.rb', line 10 def self.find_by_url(url) card = Card.new(url: url) find(card.short_link) end |
Instance Method Details
#accept ⇒ Object
23 24 25 |
# File 'lib/trello_flow/api/card.rb', line 23 def accept move_to board.lists.accepted end |
#add_label(label) ⇒ Object
32 33 34 |
# File 'lib/trello_flow/api/card.rb', line 32 def add_label(label) self.class.request(:post, "cards/#{id}/idLabels", value: label.id) end |
#add_member(user) ⇒ Object
27 28 29 30 |
# File 'lib/trello_flow/api/card.rb', line 27 def add_member(user) return if member_ids.include?(user.id) self.class.request(:post, "cards/#{id}/members", value: user.id) end |
#attach(url:) ⇒ Object
36 37 38 |
# File 'lib/trello_flow/api/card.rb', line 36 def attach(url:) self.class.request(:post, "cards/#{id}/attachments", url: url) end |
#finish ⇒ Object
19 20 21 |
# File 'lib/trello_flow/api/card.rb', line 19 def finish move_to board.lists.finished end |
#short_link ⇒ Object
40 41 42 |
# File 'lib/trello_flow/api/card.rb', line 40 def short_link url.scan(/\/c\/(.+)\//).flatten.first end |
#short_url ⇒ Object
44 45 46 |
# File 'lib/trello_flow/api/card.rb', line 44 def short_url attributes[:shortUrl] end |
#start ⇒ Object
15 16 17 |
# File 'lib/trello_flow/api/card.rb', line 15 def start move_to board.lists.started end |
#to_param ⇒ Object
48 49 50 |
# File 'lib/trello_flow/api/card.rb', line 48 def to_param name.parameterize[0..50] end |