Class: DwcaHunter::ResourceClements

Inherits:
Resource
  • Object
show all
Defined in:
lib/dwca_hunter/resources/clements.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 = {}) ⇒ ResourceClements

Returns a new instance of ResourceClements.



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

def initialize(opts = {})
  @command = "clements-ebird"
  @title = "The eBird/Clements Checklist of Birds of the World"
  @url = "https://uofi.box.com/shared/static/b4n8zqa99hq9rdga27skkh3870yhujgo.csv"
  @UUID = "577c0b56-4a3c-4314-8724-14b304f601de"
  @download_path = File.join(Dir.tmpdir,
                             "dwca_hunter",
                             "clements",
                             "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/clements.rb', line 23

def download
  puts "Downloading cached and modified version of the file."
  puts "Go to https://www.birds.cornell.edu/clementschecklist/download/ " \
    "for updates."
  `curl -s -L #{@url} -o #{@download_path}`
end

#make_dwcaObject



33
34
35
36
37
# File 'lib/dwca_hunter/resources/clements.rb', line 33

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

#unpackObject



30
31
# File 'lib/dwca_hunter/resources/clements.rb', line 30

def unpack
end