Class: Cp8Cli::Trello::Card

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

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Storyable

#branch

Methods inherited from Base

configure, #position

Class Method Details

.fieldsObject



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

def self.fields
  [:title]
end

.find_by_url(url) ⇒ Object



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

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

Instance Method Details

#attach(url:) ⇒ Object

Used by CP-8 bot



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

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

#pr_titleObject



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

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


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

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

#startObject



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

def start
  move_to board.lists.started
  assign CurrentUser.new
end

#summaryObject



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

def summary
  "Trello: #{short_url}"
end

#titleObject



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

def title
  name
end