Class: HelloSign::Resource::ResourceArray
- Inherits:
-
Array
- Object
- Array
- HelloSign::Resource::ResourceArray
- Defined in:
- lib/hello_sign/resource/resource_array.rb
Overview
Stores an array of HelloSign BaseResource with paging information
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#list_info ⇒ Object
readonly
Returns the value of attribute list_info.
-
#num_pages ⇒ Object
readonly
Returns the value of attribute num_pages.
-
#num_results ⇒ Object
readonly
Returns the value of attribute num_results.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
-
#page_size ⇒ Object
readonly
Returns the value of attribute page_size.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
-
#initialize(hash, key, resource_class) ⇒ type
constructor
create a new ResourceArray from a hash.
Constructor Details
#initialize(hash, key, resource_class) ⇒ type
create a new ResourceArray from a hash
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/hello_sign/resource/resource_array.rb', line 42 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 |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
33 34 35 |
# File 'lib/hello_sign/resource/resource_array.rb', line 33 def data @data end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
33 34 35 |
# File 'lib/hello_sign/resource/resource_array.rb', line 33 def headers @headers end |
#list_info ⇒ Object (readonly)
Returns the value of attribute list_info.
33 34 35 |
# File 'lib/hello_sign/resource/resource_array.rb', line 33 def list_info @list_info end |
#num_pages ⇒ Object (readonly)
Returns the value of attribute num_pages.
33 34 35 |
# File 'lib/hello_sign/resource/resource_array.rb', line 33 def num_pages @num_pages end |
#num_results ⇒ Object (readonly)
Returns the value of attribute num_results.
33 34 35 |
# File 'lib/hello_sign/resource/resource_array.rb', line 33 def num_results @num_results end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
33 34 35 |
# File 'lib/hello_sign/resource/resource_array.rb', line 33 def page @page end |
#page_size ⇒ Object (readonly)
Returns the value of attribute page_size.
33 34 35 |
# File 'lib/hello_sign/resource/resource_array.rb', line 33 def page_size @page_size end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
33 34 35 |
# File 'lib/hello_sign/resource/resource_array.rb', line 33 def warnings @warnings end |