lib/hello_sign/resource/resource_array.rb in hellosign-ruby-sdk-3.6.4 vs lib/hello_sign/resource/resource_array.rb in hellosign-ruby-sdk-3.7.0
- old
+ new
@@ -29,32 +29,32 @@
# Stores an array of HelloSign BaseResource with paging information
#
# @author [hellosign]
#
class ResourceArray < Array
- attr_reader :page, :num_pages, :num_results, :page_size, :warnings
+ attr_reader :page, :num_pages, :num_results, :page_size, :warnings, :headers, :list_info
#
# create a new ResourceArray from a hash
#
# @param hash [Hash] data of the array
# @param key [String] key of the hash, point to where resource array data is
# @param resource_class [Class] a Resource Class object inherited from BaseResource. Use the created array item from hash[key]
#
# @return [type] [description]
def initialize(hash, key, resource_class)
- @page = hash['list_info']['page']
- @num_pages = hash['list_info']['num_pages']
- @num_results = hash['list_info']['num_results']
- @page_size = hash['list_info']['page_size']
- @warnings = hash['warnings'] ? hash['warnings'] : nil
+ @headers = hash[:headers]
+ @list_info = hash[:body]['list_info']
+ @page = @list_info['page']
+ @num_pages = @list_info['num_pages']
+ @num_results = @list_info['num_results']
+ @page_size = @list_info['page_size']
+ @warnings = hash[:body]['warnings'] ? hash[:body]['warnings'] : nil
+ self << resource_class.new(hash[:body], nil)
- self << resource_class.new(hash, nil)
-
hash[key] && hash[key].each do |resource|
self << resource_class.new(resource, nil)
end
-
end
end
end
end