Class: Cp8Cli::Trello::Card

Inherits:
Base
  • Object
show all
Defined in:
lib/cp8_cli/trello/card.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

configure, #position

Class Method Details

.fieldsObject



6
7
8
# File 'lib/cp8_cli/trello/card.rb', line 6

def self.fields
  [:title]
end

.find_by_url(url) ⇒ Object



10
11
12
13
# File 'lib/cp8_cli/trello/card.rb', line 10

def self.find_by_url(url)
  card = Card.new(url: url)
  find(card.short_link)
end

Instance Method Details

#acceptObject



35
36
37
# File 'lib/cp8_cli/trello/card.rb', line 35

def accept
  move_to board.lists.accepted
end

#add_label(label) ⇒ Object



44
45
46
# File 'lib/cp8_cli/trello/card.rb', line 44

def add_label(label)
  self.class.request(:post, "cards/#{id}/idLabels", value: label.id)
end

#assign(user) ⇒ Object



39
40
41
42
# File 'lib/cp8_cli/trello/card.rb', line 39

def assign(user)
  return if member_ids.include?(user.trello_id)
  self.class.request(:post, "cards/#{id}/members", value: user.trello_id)
end

#attach(url:) ⇒ Object



48
49
50
# File 'lib/cp8_cli/trello/card.rb', line 48

def attach(url:)
  self.class.request(:post, "cards/#{id}/attachments", url: url)
end

#finishObject



31
32
33
# File 'lib/cp8_cli/trello/card.rb', line 31

def finish
  move_to board.lists.finished
end

#pr_titleObject



19
20
21
# File 'lib/cp8_cli/trello/card.rb', line 19

def pr_title
  "#{title} [Delivers ##{short_link}]"
end


52
53
54
# File 'lib/cp8_cli/trello/card.rb', line 52

def short_link
  url.scan(/\/c\/(.+)\//).flatten.first
end

#short_urlObject



56
57
58
# File 'lib/cp8_cli/trello/card.rb', line 56

def short_url
  attributes[:shortUrl]
end

#startObject



27
28
29
# File 'lib/cp8_cli/trello/card.rb', line 27

def start
  move_to board.lists.started
end

#summaryObject



23
24
25
# File 'lib/cp8_cli/trello/card.rb', line 23

def summary
  "Trello: #{short_url}"
end

#titleObject



15
16
17
# File 'lib/cp8_cli/trello/card.rb', line 15

def title
  name
end