Sha256: e1af0d57ab6b98cd2c1691347b5820ce5bee876b535c5c697743bbcd0584822e

Contents?: true

Size: 595 Bytes

Versions: 4

Compression:

Stored size: 595 Bytes

Contents

require 'concerns/dataset_initialization'

class RemoteLabelsController < ApplicationController
  include DatasetInitialization

  def show
    @datasets = init_datasets

    concept_url = params[:concept_url]

    # ensure known dataset
    @dataset = @datasets.detect {|d| concept_url.to_s.start_with?(d.url.to_s) }
    unless @dataset
      head 422
      return
    end

    label = @dataset.find_label(concept_url)
    unless label
      head 404
      return
    end

    respond_to do |format|
      format.json do
        render :json => { :label => label }
      end
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iqvoc-4.3.3 app/controllers/remote_labels_controller.rb
iqvoc-4.3.2 app/controllers/remote_labels_controller.rb
iqvoc-4.3.1 app/controllers/remote_labels_controller.rb
iqvoc-4.3.0 app/controllers/remote_labels_controller.rb