Class: Gbif::Response
- Inherits:
-
Object
- Object
- Gbif::Response
- Defined in:
- lib/gbifrb/response.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#ids ⇒ Object
readonly
Returns the value of attribute ids.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(ids, res) ⇒ Response
constructor
A new instance of Response.
- #links ⇒ Object
- #parsed ⇒ Object
- #pdf ⇒ Object
- #raw_body ⇒ Object
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
#ids ⇒ Object (readonly)
Returns the value of attribute ids.
7 8 9 |
# File 'lib/gbifrb/response.rb', line 7 def ids @ids end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/gbifrb/response.rb', line 7 def response @response end |
Instance Method Details
#links ⇒ Object
24 25 26 27 |
# File 'lib/gbifrb/response.rb', line 24 def links # @res['message']['link'] @res.collect { |x| x['message']['link'] } end |
#parsed ⇒ Object
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 |
#pdf ⇒ Object
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_body ⇒ Object
14 15 16 17 |
# File 'lib/gbifrb/response.rb', line 14 def raw_body # @res @res.collect { |x| x.body } end |