Class: RatingChgkV2::Collections::BaseCollection
- Inherits:
-
Object
- Object
- RatingChgkV2::Collections::BaseCollection
- Extended by:
- Forwardable
- Includes:
- Enumerable
- Defined in:
- lib/rating_chgk_v2/collections/base_collection.rb
Overview
Base class for all collections. A collection contains an array of models, for example a collection of players, tournaments, or regions. Some collections are paginated but not all.
Direct Known Subclasses
CountriesCollection, PlayerSeasonsCollection, PlayerTournamentsCollection, PlayersCollection, RegionsCollection, ReleasesCollection, SeasonsCollection, TeamTournamentsCollection, TeamsCollection, TournamentAppealsCollection, TournamentFlagsCollection, TournamentRequestsCollection, TournamentResultsCollection, TournamentTypesCollection, TournamentsCollection, TownsCollection, VenueTypesCollection, VenuesCollection
Constant Summary collapse
- MODEL =
''
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
readonly
Returns the value of attribute endpoint.
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw_data, endpoint = nil) ⇒ BaseCollection
constructor
A new instance of BaseCollection.
Constructor Details
#initialize(raw_data, endpoint = nil) ⇒ BaseCollection
Returns a new instance of BaseCollection.
26 27 28 |
# File 'lib/rating_chgk_v2/collections/base_collection.rb', line 26 def initialize(raw_data, endpoint = nil) setup raw_data, endpoint end |
Instance Attribute Details
#endpoint ⇒ Object (readonly)
Returns the value of attribute endpoint.
12 13 14 |
# File 'lib/rating_chgk_v2/collections/base_collection.rb', line 12 def endpoint @endpoint end |
#items ⇒ Object (readonly)
Returns the value of attribute items.
12 13 14 |
# File 'lib/rating_chgk_v2/collections/base_collection.rb', line 12 def items @items end |
Class Method Details
.load(method, endpoint) ⇒ Object
17 18 19 |
# File 'lib/rating_chgk_v2/collections/base_collection.rb', line 17 def load(method, endpoint) new endpoint.send(method), endpoint end |
.paginated ⇒ Object
21 22 23 |
# File 'lib/rating_chgk_v2/collections/base_collection.rb', line 21 def paginated include RatingChgkV2::Concerns::Paginated end |