Class: DwcaHunter::ResourceMammalSpecies
- Defined in:
- lib/dwca_hunter/resources/mammal_species.rb
Overview
ResourceMammalSpecies converts “Mammal Species of the World” data to DarwinCore Archive file
Instance Attribute Summary
Attributes inherited from Resource
#abbr, #command, #download_path, #title, #url, #uuid
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(opts = {}) ⇒ ResourceMammalSpecies
constructor
A new instance of ResourceMammalSpecies.
- #make_dwca ⇒ Object
- #needs_unpack? ⇒ Boolean
Methods inherited from Resource
gunzip, #needs_download?, unzip
Constructor Details
#initialize(opts = {}) ⇒ ResourceMammalSpecies
Returns a new instance of ResourceMammalSpecies.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/dwca_hunter/resources/mammal_species.rb', line 7 def initialize(opts = {}) @parser = ScientificNameParser.new @black_sp = black_species @command = "mammal-species" @title = "The Mammal Species of The World" @uuid = "464dafec-1037-432d-8449-c0b309e0a030" @data = [] @extensions = [] @count = 1 @clades = { "Mammalia" => { rank: "class", id: @count } } @url = "http://www.departments.bucknell.edu"\ "/biology/resources/msw3/export.asp" @download_path = File.join(Dir.tmpdir, "dwca_hunter", "mammalsp", "msw3-all.csv") super end |
Instance Method Details
#download ⇒ Object
35 36 37 38 39 40 |
# File 'lib/dwca_hunter/resources/mammal_species.rb', line 35 def download DwcaHunter.logger_write(object_id, "Downloading file -- "\ "it will take some time...") dlr = DwcaHunter::Downloader.new(url, @download_path) dlr.download end |
#make_dwca ⇒ Object
28 29 30 31 32 33 |
# File 'lib/dwca_hunter/resources/mammal_species.rb', line 28 def make_dwca DwcaHunter.logger_write(object_id, "Extracting data") encode collect_data generate_dwca end |
#needs_unpack? ⇒ Boolean
24 25 26 |
# File 'lib/dwca_hunter/resources/mammal_species.rb', line 24 def needs_unpack? false end |