permissions.rb
def value2uri(label, value)
    elements_url  = label['links']['elements']
    uri  = "#{elements_url}?filter=#{URI::encode value}"
    resp = GoodData.get uri
    elements = resp['attributeElements']['elements']
    if elements && !elements.empty?
      matching = resp['attributeElements']['elements'].find { |e| e['title'] == value }
      return matching['uri'] if matching
    end
    raise "Value '#{value}' not found for label '#{label}'"
  end
# Returns a GoodData URI representing the value of given label
Returns a GoodData URI representing the value of given label
Returns a GoodData URI representing the value of given label
def value2uri(label, value)
    elements_url  = label['links']['elements']
    uri  = "#{elements_url}?filter=#{URI::encode value}"
    resp = GoodData.get uri
    elements = resp['attributeElements']['elements']
    if elements && !elements.empty?
      matching = resp['attributeElements']['elements'].find { |e| e['title'] == value }
      return matching['uri'] if matching
    end
    raise "Value '#{value}' not found for label '#{label}'"
  end
def value2uri ( label , value ) elements_url = label [ 'links' ] [ 'elements' ] uri = "#{elements_url}?filter=#{URI::encode value}" resp = GoodData . get uri elements = resp [ 'attributeElements' ] [ 'elements' ] if elements && ! elements . empty? matching = resp [ 'attributeElements' ] [ 'elements' ] . find { | e | e [ 'title' ] == value } return matching [ 'uri' ] if matching end raise "Value '#{value}' not found for label '#{label}'" end
Returns a GoodData URI representing the value of given label
Returns a GoodData URI representing the value of given label
label
value