Class: ShelbyArena::ContributionList
- Inherits:
-
Object
- Object
- ShelbyArena::ContributionList
- Includes:
- Enumerable
- Defined in:
- lib/api/contribution_list.rb
Instance Method Summary collapse
-
#[](index) ⇒ Object
Get the specified contribution.
-
#each(&block) ⇒ Object
This method is needed for Enumerable.
-
#empty? ⇒ Boolean
Checks if the list is empty.
-
#initialize(options = {}) ⇒ ContributionList
constructor
Constructor.
Constructor Details
#initialize(options = {}) ⇒ ContributionList
Constructor.
Options: :reader - (optional) The Reader to use to load the data.
16 17 18 19 |
# File 'lib/api/contribution_list.rb', line 16 def initialize( = {}) reader = [:reader] || ShelbyArena::ContributionListReader.new() @json_data = reader.load_data['ContributionListResult']['Contributions']['Contribution'] end |
Instance Method Details
#[](index) ⇒ Object
Get the specified contribution.
26 27 28 |
# File 'lib/api/contribution_list.rb', line 26 def [](index) Contribution.new( @json_data[index] ) unless @json_data[index].nil? end |
#each(&block) ⇒ Object
This method is needed for Enumerable.
32 33 34 |
# File 'lib/api/contribution_list.rb', line 32 def each &block @json_data.each{ |contribution| yield( Contribution.new(contribution) )} end |
#empty? ⇒ Boolean
Checks if the list is empty.
43 44 45 |
# File 'lib/api/contribution_list.rb', line 43 def empty? self.count == 0 ? true : false end |