Sha256: 79c59c25619c70510e8477daeca4b224ff9db6bc0fb2331c914339ad28d44d0f

Contents?: true

Size: 1.46 KB

Versions: 9

Compression:

Stored size: 1.46 KB

Contents

# frozen_string_literal: true

module RatingChgkV2
  module Rest
    include RatingChgkV2::Rest::AuthenticationToken
    include RatingChgkV2::Rest::Countries
    include RatingChgkV2::Rest::Players
    include RatingChgkV2::Rest::Regions
    include RatingChgkV2::Rest::Releases
    include RatingChgkV2::Rest::Seasons
    include RatingChgkV2::Rest::Teams
    include RatingChgkV2::Rest::TournamentFlags
    include RatingChgkV2::Rest::TournamentSynchAppeals
    include RatingChgkV2::Rest::TournamentSynchControversials
    include RatingChgkV2::Rest::TournamentSynchRequests
    include RatingChgkV2::Rest::TournamentTypes
    include RatingChgkV2::Rest::Tournaments
    include RatingChgkV2::Rest::Towns
    include RatingChgkV2::Rest::VenueTypes
    include RatingChgkV2::Rest::Venues

    private

    def endpoint(name, query, params = {})
      klass = RatingChgkV2.const_get "Endpoints::#{name}Endpoint"
      klass.new self, query, params
    end

    def collection_load(name:, ep_params:, ep_name: nil, method: :do_get)
      collection(name).load method, endpoint(ep_name || name, *ep_params)
    end

    def model_load(name:, ep_params:, ep_name: nil, method: :do_get)
      model(name).load method, endpoint(ep_name || name, *ep_params)
    end

    def collection(name)
      RatingChgkV2.const_get("Collections::#{name}Collection")
    end

    def model(name)
      RatingChgkV2.const_get("Models::#{name}Model")
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rating-chgk-v2-1.6.0 lib/rating_chgk_v2/rest.rb
rating-chgk-v2-1.5.0 lib/rating_chgk_v2/rest.rb
rating-chgk-v2-1.4.0 lib/rating_chgk_v2/rest.rb
rating-chgk-v2-1.3.0 lib/rating_chgk_v2/rest.rb
rating-chgk-v2-1.2.0 lib/rating_chgk_v2/rest.rb
rating-chgk-v2-1.1.0 lib/rating_chgk_v2/rest.rb
rating-chgk-v2-1.0.1 lib/rating_chgk_v2/rest.rb
rating-chgk-v2-1.0.0 lib/rating_chgk_v2/rest.rb
rating-chgk-v2-1.0.0.rc1 lib/rating_chgk_v2/rest.rb