Class: Textminer::Fetch

Inherits:
Object
  • Object
show all
Defined in:
lib/textminer/fetch.rb

Overview

:nodoc:

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Fetch) initialize(doi, type)

Returns a new instance of Fetch



5
6
7
8
# File 'lib/textminer/fetch.rb', line 5

def initialize(doi, type)
  self.doi = doi
  self.type = type
end

Instance Attribute Details

- (Object) doi

Returns the value of attribute doi



3
4
5
# File 'lib/textminer/fetch.rb', line 3

def doi
  @doi
end

- (Object) type

Returns the value of attribute type



3
4
5
# File 'lib/textminer/fetch.rb', line 3

def type
  @type
end

Instance Method Details

- (Object) fetchtext



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/textminer/fetch.rb', line 10

def fetchtext
  lks = Textminer.links(self.doi)
  lk = pick_link(lks)
  case self.type
  when "xml"
    # HTTParty.get(lk)
    coll = []
    Array(lk).each do |x|
      coll << HTTParty.get(x)
    end
    return coll
  when "pdf"
    serialize_pdf(lk, self.doi)
  end
end