Sha256: a5d4ef21ff6b3bdd1f280863b834652f22d41b4bc0a52d0dfbe6e6e7d5a25d30
Contents?: true
Size: 1.26 KB
Versions: 1
Compression:
Stored size: 1.26 KB
Contents
module FellowshipOne class SubFundList include Enumerable attr_reader :count, :page_number, :total_records, :additional_pages # Constructor. # # @param options A hash of options for loading the list. # # Get the list of sub-funds for a given fund. # # Options: # :reader - (optional) The Reader to use to load the data. def initialize(fund_id, options = {}) reader = options[:reader] || FellowshipOne::SubFundListReader.new(fund_id, options) @json_data = reader.load_feed @count = @json_data['subFunds']['subFund'].size.to_i @page_number = 1 @total_records = @count @additional_pages = 0 end # Get the specified fund. # # @param index The index of the fund to get. # # @return Fund def [](index) Fund.new( @json_data['funds']['fund'][index] ) if @json_data['funds']['fund'][index] end # This method is needed for Enumerable. def each &block @json_data['subFunds']['subFund'].each{ |cont_recpt| yield( Fund.new(cont_recpt) )} end # Alias the count method alias :size :count # Checks if the list is empty. # # @return True on empty, false otherwise. def empty? self.count == 0 ? true : false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fellowshipone-api-0.6.2 | lib/api/sub_fund_list.rb |