Class: Veye::Package::SearchCSV

Inherits:
BaseCSV
  • Object
show all
Defined in:
lib/veye/views/package/search_csv.rb

Instance Method Summary collapse

Methods inherited from BaseCSV

#after, #before

Constructor Details

#initializeSearchCSV

Returns a new instance of SearchCSV.



6
7
8
9
# File 'lib/veye/views/package/search_csv.rb', line 6

def initialize
  headers = "nr,name,version,prod_key,language,group_id"
  super(headers)
end

Instance Method Details

#format(results) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/veye/views/package/search_csv.rb', line 11

def format(results)
  items = results['results']
  return if items.nil?

  items.each_with_index do |result, index|
    printf("%d,%s,%s,%s,%s,%s\n",
            index + 1,
            result["name"],
            result["version"],
            result["prod_key"],
            result["language"],
            result["group_id"])
  end
end