Class: JasperClient::RepositoryService::Response::ListResponse

Inherits:
JasperClient::RepositoryService::Response show all
Defined in:
lib/jasper-client/jasper_client.rb

Overview

Response from a list request.

Instance Attribute Summary

Attributes inherited from JasperClient::RepositoryService::Response

#resources, #xml_doc

Instance Method Summary collapse

Methods inherited from JasperClient::RepositoryService::Response

#collect_resources, #message, #return_code, #search, #success?

Constructor Details

#initialize(savon_response) ⇒ ListResponse

Initialize the list response from a Savon response. The listReturn element is pulled from the response, and each resourceDescriptor child of that element is collected into a list as each item in the list.



169
170
171
172
173
# File 'lib/jasper-client/jasper_client.rb', line 169

def initialize(savon_response)
  soap_doc = Nokogiri::XML savon_response.to_xml
  @xml_doc = Nokogiri::XML soap_doc.search('//listReturn/node()').inner_text
  collect_resources
end

Instance Method Details

#itemsObject

Get a list of items from the list response. Each of the items in the list returned is a JasperClient::Resource.



177
178
179
# File 'lib/jasper-client/jasper_client.rb', line 177

def items
  resources
end