Class: PivotalToTrello::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/pivotal_to_trello/core.rb

Overview

The core entry point of the gem, which handles the import process.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = OpenStruct.new) ⇒ Core

Constructor



10
11
12
# File 'lib/pivotal_to_trello/core.rb', line 10

def initialize(options = OpenStruct.new)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the options struct.



30
31
32
# File 'lib/pivotal_to_trello/core.rb', line 30

def options
  @options
end

Instance Method Details

#import!Object

Imports a Pivotal project into Trello.



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/pivotal_to_trello/core.rb', line 15

def import!
  prompt_for_details

  puts "\nBeginning import..."
  pivotal.stories(options.pivotal_project_id).each do |story|
    list_id = get_list_id(story, options)
    next unless list_id

    card        = trello.create_card(list_id, story)
    label_color = get_label_color(story, options)
    trello.add_label(card, story.story_type, label_color) unless label_color.nil?
  end
end