class GoodData::Links
Attributes
data[R]
Public Class Methods
new(items)
click to toggle source
# File lib/gooddata/models/links.rb, line 13 def initialize(items) @data = {} items.values[0]['links'].each do |item| category = item['category'] if @data[category] if @data[category]['category'] == category @data[category] = { @data[category]['identifier'] => @data[category] } end @data[category][item['identifier']] = item else @data[category] = item end end end
Public Instance Methods
[](category)
click to toggle source
# File lib/gooddata/models/links.rb, line 33 def [](category) return @data[category]['link'] if @data[category] && @data[category]['link'] @data[category] end
ambiguous?(category)
click to toggle source
# File lib/gooddata/models/links.rb, line 42 def ambiguous?(category) !unique?(category) end
get(category, identifier)
click to toggle source
# File lib/gooddata/models/links.rb, line 46 def get(category, identifier) self[category][identifier] end
links(category, identifier = nil)
click to toggle source
# File lib/gooddata/models/links.rb, line 28 def links(category, identifier = nil) return Links.new(client.get(self[category])) unless identifier Links.new client.get(get(category, identifier)) end
unique?(category)
click to toggle source
# File lib/gooddata/models/links.rb, line 38 def unique?(category) @data[category]['link'].is_a? String end