Class: Gbif::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/gbifrb/response.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ids, res) ⇒ Response

Returns a new instance of Response.



9
10
11
12
# File 'lib/gbifrb/response.rb', line 9

def initialize(ids, res)
  @ids = ids
  @res = res
end

Instance Attribute Details

#idsObject (readonly)

Returns the value of attribute ids.



7
8
9
# File 'lib/gbifrb/response.rb', line 7

def ids
  @ids
end

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/gbifrb/response.rb', line 7

def response
  @response
end

Instance Method Details



24
25
26
27
# File 'lib/gbifrb/response.rb', line 24

def links
  # @res['message']['link']
  @res.collect { |x| x['message']['link'] }
end

#parsedObject



19
20
21
22
# File 'lib/gbifrb/response.rb', line 19

def parsed
  # JSON.parse(@res.body)
  @res.collect { |x| JSON.parse(x.body) }
end

#pdfObject



29
30
31
32
33
34
35
36
# File 'lib/gbifrb/response.rb', line 29

def pdf
  tmp = links
  if !tmp.nil?
    tmp.collect { |z|
      z.select{ |x| x['content-type'] == "application/pdf" }[0]['URL']
    }
  end
end

#raw_bodyObject



14
15
16
17
# File 'lib/gbifrb/response.rb', line 14

def raw_body
  # @res
  @res.collect { |x| x.body }
end