Class: CertificateFactory::CSVFactory

Inherits:
Factory
  • Object
show all
Defined in:
lib/certificate-factory/factory.rb

Instance Attribute Summary

Attributes inherited from Factory

#count, #response

Instance Method Summary collapse

Methods inherited from Factory

#build, #ckan_url, #feed_items, #fetch_next_page, #next_page, #over_limit?

Constructor Details

#initialize(options) ⇒ CSVFactory

Returns a new instance of CSVFactory.



69
70
71
72
73
74
75
# File 'lib/certificate-factory/factory.rb', line 69

def initialize(options)
  @file = options[:file]
  @limit = options[:limit]
  @campaign = options[:campaign]
  @count = 0
  @logger = options[:logger]
end

Instance Method Details

#eachObject



81
82
83
84
85
86
87
# File 'lib/certificate-factory/factory.rb', line 81

def each
  CSV::foreach(@file, headers: :first_row) do |row|
    yield row['documentation_url']
    @count += 1
    break if over_limit?
  end
end


77
78
79
# File 'lib/certificate-factory/factory.rb', line 77

def get_link(url)
  return url
end