class HelloSign::Resource::ResourceArray
Stores an array of HelloSign
BaseResource
with paging information
@author [hellosign]
Attributes
data[R]
headers[R]
list_info[R]
num_pages[R]
num_results[R]
page[R]
page_size[R]
warnings[R]
Public Class Methods
new(hash, key, resource_class)
click to toggle source
Creates 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 ResourceClass object inherited from BaseResource
. Uses the created array item from hash.
@return [HelloSign::Resource::ResourceArray] a ResourceArray
# File lib/hello_sign/resource/resource_array.rb, line 39 def initialize(hash, key, resource_class) @headers = hash[:headers] @data = hash[:body] @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) hash[key] && hash[key].each do |resource| self << resource_class.new(resource, nil) end end