Sha256: bb1d44f1ea49e2aa09664e72e42162858825c0be03bc6fa59fa7e060f044fe7e

Contents?: true

Size: 1009 Bytes

Versions: 7

Compression:

Stored size: 1009 Bytes

Contents

module HelloSign
  module Resource

    #
    # Stores an array of HelloSign BaseResource with paging information
    #
    # @author [hellosign]
    #
    class ResourceArray < Array
      attr_reader :page, :num_pages, :num_results, :page_size

      #
      # 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']
        hash[key] && hash[key].each do |resouce|
          self << resource_class.new(resouce, nil)
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
hellosign-ruby-sdk-3.0.11 lib/hello_sign/resource/resource_array.rb
hellosign-ruby-sdk-3.0.10 lib/hello_sign/resource/resource_array.rb
hellosign-ruby-sdk-3.0.9 lib/hello_sign/resource/resource_array.rb
hellosign-ruby-sdk-3.0.7 lib/hello_sign/resource/resource_array.rb
hellosign-ruby-sdk-3.0.6 lib/hello_sign/resource/resource_array.rb
hellosign-ruby-sdk-3.0.5 lib/hello_sign/resource/resource_array.rb
hellosign-ruby-sdk-3.0.4 lib/hello_sign/resource/resource_array.rb