Class: DwcaHunter::ResourceHowardMoore

Inherits:
Resource
  • Object
show all
Defined in:
lib/dwca_hunter/resources/how-moore-birds.rb

Instance Attribute Summary

Attributes inherited from Resource

#abbr, #command, #download_path, #title, #url, #uuid

Instance Method Summary collapse

Methods inherited from Resource

gunzip, #needs_download?, #needs_unpack?, unzip

Constructor Details

#initialize(opts = {}) ⇒ ResourceHowardMoore

Returns a new instance of ResourceHowardMoore.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dwca_hunter/resources/how-moore-birds.rb', line 5

def initialize(opts = {})
  @command = "how-moore-birds"
  @title = "Howard and Moore Complete Checklist of the Birds of the World"
  @url = "https://uofi.box.com/shared/static/m71m541dr5unc41xzg4y51d92b7wiy2k.csv"
  @UUID = "85023fe5-bf2a-486b-bdae-3e61cefd41fd"
  @download_path = File.join(Dir.tmpdir,
                             "dwca_hunter",
                             "how-moore-birds",
                             "data.csv")
  @synonyms = []
  @names = []
  @vernaculars = []
  @extensions = []
  @synonyms_hash = {}
  @vernaculars_hash = {}
  super(opts)
end

Instance Method Details

#downloadObject



23
24
25
26
27
28
# File 'lib/dwca_hunter/resources/how-moore-birds.rb', line 23

def download
  puts "Downloading cached verion of the file."
  puts "Check https://www.howardandmoore.org/howard-and-moore-database/"
  puts "If there is a more recent edition"
  `curl -s -L #{@url} -o #{@download_path}`
end

#make_dwcaObject



32
33
34
35
36
# File 'lib/dwca_hunter/resources/how-moore-birds.rb', line 32

def make_dwca
  DwcaHunter.logger_write(object_id, "Extracting data")
  get_names
  generate_dwca
end

#unpackObject



30
# File 'lib/dwca_hunter/resources/how-moore-birds.rb', line 30

def unpack; end