Class: DwcaHunter::ResourceIPNI
- Defined in:
- lib/dwca_hunter/resources/ipni.rb
Overview
Resource for FishBase
Instance Attribute Summary collapse
-
#abbr ⇒ Object
readonly
Returns the value of attribute abbr.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Attributes inherited from Resource
#command, #download_path, #url, #uuid
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(opts = {}) ⇒ ResourceIPNI
constructor
download: false, unpack: false}).
- #make_dwca ⇒ Object
- #unpack ⇒ Object
Methods inherited from Resource
gunzip, #needs_download?, #needs_unpack?, unzip
Constructor Details
#initialize(opts = {}) ⇒ ResourceIPNI
download: false, unpack: false})
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/dwca_hunter/resources/ipni.rb', line 7 def initialize(opts = {}) #download: false, unpack: false}) @command = "ipni" @title = "The International Plant Names Index" @abbr = "IPNI" @url = "https://uofi.box.com/shared/static/s0x4xjonxt54pi89n543gdmttrdqd6iv.xz" @uuid = "6b3905ce-5025-49f3-9697-ddd5bdfb4ff0" @download_path = File.join(Dir.tmpdir, "dwca_hunter", "ipni", "ipni.csv.xz") @extensions = [] super end |
Instance Attribute Details
#abbr ⇒ Object (readonly)
Returns the value of attribute abbr.
6 7 8 |
# File 'lib/dwca_hunter/resources/ipni.rb', line 6 def abbr @abbr end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
6 7 8 |
# File 'lib/dwca_hunter/resources/ipni.rb', line 6 def title @title end |
Instance Method Details
#download ⇒ Object
24 25 26 27 28 29 |
# File 'lib/dwca_hunter/resources/ipni.rb', line 24 def download puts "Download by hand from" puts "https://storage.cloud.google.com/ipni-data/ipniWebName.csv.xz" puts "and copy to given url" `curl -s -L #{@url} -o #{@download_path}` end |
#make_dwca ⇒ Object
31 32 33 34 |
# File 'lib/dwca_hunter/resources/ipni.rb', line 31 def make_dwca organize_data generate_dwca end |
#unpack ⇒ Object
19 20 21 22 |
# File 'lib/dwca_hunter/resources/ipni.rb', line 19 def unpack puts "Unpacking #{@download_path}" XZ.decompress_file(@download_path, @download_path[0...-3] ) end |