Sha256: 45285f28b0233907836cf743c01806aae69de717e03b897c7ab8fef280052493

Contents?: true

Size: 568 Bytes

Versions: 66

Compression:

Stored size: 568 Bytes

Contents

module ForestLiana
  class StatGetter < BaseGetter
    attr_accessor :record

    def initialize(resource, params, forest_user)
      @resource = resource
      @params = params
      @user = forest_user

      validate_params
      compute_includes
    end

    def validate_params
      if @params.key?(:aggregator) && !%w[count sum avg max min].include?(@params[:aggregator].downcase)
        raise ForestLiana::Errors::HTTP422Error.new('Invalid aggregate function')
      end
    end

    def get_resource
      super
      @resource.reorder('')
    end
  end
end

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
forest_liana-9.11.1 app/services/forest_liana/stat_getter.rb
forest_liana-9.11.0 app/services/forest_liana/stat_getter.rb
forest_liana-9.10.6 app/services/forest_liana/stat_getter.rb
forest_liana-9.10.5 app/services/forest_liana/stat_getter.rb
forest_liana-9.10.4 app/services/forest_liana/stat_getter.rb
forest_liana-9.10.3 app/services/forest_liana/stat_getter.rb
forest_liana-9.10.2 app/services/forest_liana/stat_getter.rb
forest_liana-9.10.1 app/services/forest_liana/stat_getter.rb
forest_liana-9.10.0 app/services/forest_liana/stat_getter.rb
forest_liana-9.9.1 app/services/forest_liana/stat_getter.rb
forest_liana-9.9.0 app/services/forest_liana/stat_getter.rb
forest_liana-9.8.0 app/services/forest_liana/stat_getter.rb
forest_liana-9.7.0 app/services/forest_liana/stat_getter.rb
forest_liana-9.6.4 app/services/forest_liana/stat_getter.rb
forest_liana-9.6.3 app/services/forest_liana/stat_getter.rb
forest_liana-9.6.0 app/services/forest_liana/stat_getter.rb
forest_liana-9.5.7 app/services/forest_liana/stat_getter.rb
forest_liana-9.5.6 app/services/forest_liana/stat_getter.rb
forest_liana-9.5.5 app/services/forest_liana/stat_getter.rb
forest_liana-9.5.4 app/services/forest_liana/stat_getter.rb