Sha256: 265cee985c9a2c3f5a20df0668480f81474db4720a0431f225b233fe8a496151

Contents?: true

Size: 597 Bytes

Versions: 9

Compression:

Stored size: 597 Bytes

Contents

module Economic
  class DepartmentalDistributionRepo < Economic::BaseRepo
    class << self
      def all(distribution: nil)
        return super(url: endpoint_url(distribution)) unless distribution.nil?

        super(url: endpoint_url(distribution))
      end

      def find(id, distribution:)
        super(id, url: endpoint_url(distribution))
      end

      private

      def endpoint_url(distribution)
        return super() if distribution.nil?
        return super() + "/departments" if distribution == :single_department

        super() + "/distributions"
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
economic-rest-0.6.4 lib/economic/departmental_distribution_repo.rb
economic-rest-0.6.3 lib/economic/departmental_distribution_repo.rb
economic-rest-0.6.2 lib/economic/departmental_distribution_repo.rb
economic-rest-0.6.1 lib/economic/departmental_distribution_repo.rb
economic-rest-0.6.0 lib/economic/departmental_distribution_repo.rb
economic-rest-0.5.14 lib/economic/departmental_distribution_repo.rb
economic-rest-0.5.13 lib/economic/departmental_distribution_repo.rb
economic-rest-0.5.12 lib/economic/departmental_distribution_repo.rb
economic-rest-0.5.11 lib/economic/departmental_distribution_repo.rb