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

Inherits:
JasperClient::RepositoryService::Response show all
Includes:
Enumerable
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.



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

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

#each(&blk) ⇒ Object



182
# File 'lib/jasper-client/jasper_client.rb', line 182

def each(&blk); @resources.each(&blk); end

#itemsObject

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



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

def items
  resources
end