Class: CollegiateLink::Response::XML
- Inherits:
-
Object
- Object
- CollegiateLink::Response::XML
- Includes:
- Common
- Defined in:
- lib/collegiatelink/response.rb
Overview
Container for the XML gunk returned from CollegiateLink
Instance Method Summary collapse
-
#initialize(document) ⇒ XML
constructor
Create the response.
-
#items ⇒ Object
Extract the items from the response.
Methods included from Common
Constructor Details
#initialize(document) ⇒ XML
Create the response.
Parameters:
-
document
- The Nokogiri document of the returned XML
20 21 22 23 24 25 26 27 28 |
# File 'lib/collegiatelink/response.rb', line 20 def initialize(document) raise UnknownException unless document.xpath('//results/page') @document = document @page_size = document.xpath('//results/page/pageSize').inner_html.to_i @page_number = document.xpath('//results/page/pageNumber').inner_html.to_i @total_items = document.xpath('//results/page/totalItems').inner_html.to_i @total_pages = document.xpath('//results/page/totalPages').inner_html.to_i end |
Instance Method Details
#items ⇒ Object
Extract the items from the response. Returns a Nokogiri NodeSet.
31 32 33 |
# File 'lib/collegiatelink/response.rb', line 31 def items @document.xpath('//results/page/items/*') end |