Class: FellowshipOne::SubFundList
- Inherits:
-
Object
- Object
- FellowshipOne::SubFundList
- Includes:
- Enumerable
- Defined in:
- lib/api/sub_fund_list.rb
Instance Attribute Summary collapse
-
#additional_pages ⇒ Object
readonly
Returns the value of attribute additional_pages.
-
#count ⇒ Object
(also: #size)
readonly
Returns the value of attribute count.
-
#page_number ⇒ Object
readonly
Returns the value of attribute page_number.
-
#total_records ⇒ Object
readonly
Returns the value of attribute total_records.
Instance Method Summary collapse
-
#[](index) ⇒ Object
Get the specified fund.
-
#each(&block) ⇒ Object
This method is needed for Enumerable.
-
#empty? ⇒ Boolean
Checks if the list is empty.
-
#initialize(fund_id, options = {}) ⇒ SubFundList
constructor
Constructor.
Constructor Details
#initialize(fund_id, options = {}) ⇒ SubFundList
Constructor.
Get the list of sub-funds for a given fund.
Options: :reader - (optional) The Reader to use to load the data.
18 19 20 21 22 23 24 25 26 |
# File 'lib/api/sub_fund_list.rb', line 18 def initialize(fund_id, = {}) reader = [:reader] || FellowshipOne::SubFundListReader.new(fund_id, ) @json_data = reader.load_feed @json_data['subFunds'] = {'subFund' => []} if reader.load_feed["subFunds"].nil? @count = @json_data['subFunds']['subFund'].size.to_i @page_number = 1 @total_records = @count @additional_pages = 0 end |
Instance Attribute Details
#additional_pages ⇒ Object (readonly)
Returns the value of attribute additional_pages.
7 8 9 |
# File 'lib/api/sub_fund_list.rb', line 7 def additional_pages @additional_pages end |
#count ⇒ Object (readonly) Also known as: size
Returns the value of attribute count.
7 8 9 |
# File 'lib/api/sub_fund_list.rb', line 7 def count @count end |
#page_number ⇒ Object (readonly)
Returns the value of attribute page_number.
7 8 9 |
# File 'lib/api/sub_fund_list.rb', line 7 def page_number @page_number end |
#total_records ⇒ Object (readonly)
Returns the value of attribute total_records.
7 8 9 |
# File 'lib/api/sub_fund_list.rb', line 7 def total_records @total_records end |
Instance Method Details
#[](index) ⇒ Object
Get the specified fund.
33 34 35 |
# File 'lib/api/sub_fund_list.rb', line 33 def [](index) Fund.new( @json_data['subFunds']['subFund'][index] ) if @json_data['subFunds']['subFund'][index] end |
#each(&block) ⇒ Object
This method is needed for Enumerable.
39 40 41 |
# File 'lib/api/sub_fund_list.rb', line 39 def each &block @json_data['subFunds']['subFund'].each{ |cont_recpt| yield( Fund.new(cont_recpt) )} end |
#empty? ⇒ Boolean
Checks if the list is empty.
50 51 52 |
# File 'lib/api/sub_fund_list.rb', line 50 def empty? self.count == 0 ? true : false end |