Sha256: dc1c12a3613de674345ed00bde69a6cfeb2dc14359ed821b5eb98fc02cde4d45

Contents?: true

Size: 1.88 KB

Versions: 7

Compression:

Stored size: 1.88 KB

Contents

module PublishMyData
  module DataCube
    class DimensionsController < PublishMyData::ApplicationController

      include PublishMyData::DataCubeController

      before_filter :get_dimension, :only => [:values, :size]
      before_filter :get_dimensions, :only => [:row_labels]
      before_filter :get_pagination_params, :only => [:row_labels]

      # list the dimensions for the cube
      # GET /data/:dataset_slug/cube/dimensions(.:format)
      def index
        respond_with @cube.dimensions
      end

      # the measure property for the cube
      # GET /data/:dataset_slug/cube/measure(.:format)
      def measure
        respond_with @cube.measure_property
      end

      # all values for a single dimension in the cube.
      # Useful for getting axes data for cube grids.
      # GET /data/:dataset_slug/cube/dimension_values(.:format)
      # Note: supply dimension parameter on query string
      # e.g. /data/additional-affordable-dwellings/cube/dimension_values.json?dimension=http%3A%2F%2Fopendatacommunities.org%2Fdef%2Fhousing%2FaffordableHousingType
      def values
        respond_with @dimension.values
      end

      # size of a dimension - JSON only.
      # GET /data/:dataset_slug/cube/dimension_size(.:format)
      # Note: supply dimension parameter on query string
      # e.g. /data/additional-affordable-dwellings/cube/dimension_values.ttl?dimension=http%3A%2F%2Fopendatacommunities.org%2Fdef%2Fhousing%2FaffordableHousingType
      def size
        respond_to do |format|
          format.json { render :json => {:size => @dimension.size } }
        end
      end


      # recommended starting columns
      def recommended
        respond_to do |format|
          format.json { render :json => @cube.recommended_dimensions}
        end
      end

      private

      def get_dimension
        @dimension = Dimension.new(params[:dimension], @cube)
      end

    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
publish_my_data-1.2.1 app/controllers/publish_my_data/data_cube/dimensions_controller.rb
publish_my_data-1.2.0 app/controllers/publish_my_data/data_cube/dimensions_controller.rb
publish_my_data-1.0.4 app/controllers/publish_my_data/data_cube/dimensions_controller.rb
publish_my_data-1.0.3 app/controllers/publish_my_data/data_cube/dimensions_controller.rb
publish_my_data-1.0.2 app/controllers/publish_my_data/data_cube/dimensions_controller.rb
publish_my_data-1.0.1 app/controllers/publish_my_data/data_cube/dimensions_controller.rb
publish_my_data-1.0.0 app/controllers/publish_my_data/data_cube/dimensions_controller.rb