Class: Trackinator::Importer
- Inherits:
-
Object
- Object
- Trackinator::Importer
- Defined in:
- lib/trackinator/importer.rb
Instance Attribute Summary collapse
-
#dry_run ⇒ Object
Returns the value of attribute dry_run.
Instance Method Summary collapse
- #import(file_name) ⇒ Object
-
#initialize(you_track, google) ⇒ Importer
constructor
A new instance of Importer.
Constructor Details
#initialize(you_track, google) ⇒ Importer
Returns a new instance of Importer.
13 14 15 16 |
# File 'lib/trackinator/importer.rb', line 13 def initialize you_track, google @you_track = you_track @google = google end |
Instance Attribute Details
#dry_run ⇒ Object
Returns the value of attribute dry_run.
11 12 13 |
# File 'lib/trackinator/importer.rb', line 11 def dry_run @dry_run end |
Instance Method Details
#import(file_name) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/trackinator/importer.rb', line 18 def import file_name ticket_data = @google.get_tickets file_name issues = [] issues.concat validate_headings(ticket_data[0]) issues.concat validate_tickets(ticket_data) if issues.length == 0 && !@dry_run puts "importing..." ticket_data.each do |entry| issue_id = @you_track.is_issue_exists? entry false unless !issue_id.nil? ? @you_track.update_ticket(issue_id, entry) : @you_track.create_ticket(entry) end end issues end |