Class: DwcaHunter::ResourceArctos

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

Returns a new instance of ResourceArctos.



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

def initialize(opts = {})
  @command = 'arctos'
  @title = 'Arctos'
  @url = 'https://www.dropbox.com/s/3rmny5d8cfm9mmp/arctos.tar.gz?dl=1'
  @UUID =  'eea8315d-a244-4625-859a-226675622312'
  @download_path = File.join(Dir.tmpdir,
                             'dwca_hunter',
                             'arctos',
                             'data.zip')
  @synonyms = []
  @names = []
  @vernaculars = []
  @extensions = []
  @synonyms_hash = {}
  @vernaculars_hash = {}
  super(opts)
end

Instance Method Details

#downloadObject



23
24
25
26
# File 'lib/dwca_hunter/resources/arctos.rb', line 23

def download
  puts "Downloading cached verion of the file. Ask Arctos to generate new."
    `curl -s -L #{@url} -o #{@download_path}`
end

#make_dwcaObject



32
33
34
35
36
# File 'lib/dwca_hunter/resources/arctos.rb', line 32

def make_dwca
  DwcaHunter::logger_write(self.object_id, 'Extracting data')
  get_names
  generate_dwca
end

#unpackObject



28
29
30
# File 'lib/dwca_hunter/resources/arctos.rb', line 28

def unpack
  unpack_tar
end