Sha256: a6b0494d4878ee7b57034cf4d0da0b7c9ddbd8c563df4b15880ce8fc5d5ea216

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

class Muddyit::Collections::Collection::Entities::Entity < Muddyit::Generic

#  def classification
#    unless @attributes[:type]
#      # We merge here as we don't want to overwrite a entity specific confidence score
#      @attributes.merge!(self.fetch)
#    end
#    @attributes[:type]
#  end

  # retrieve entities related to the specified entity within the collection entities collection
  #
  # Params
  # * options (Optional)
  #
  def related(options = {})
    api_url = "/collections/#{self.collection.attributes[:token]}/entities/#{Digest::MD5.hexdigest(@attributes[:uri])}/related"
    response = @muddyit.send_request(api_url, :get, options)

    results = []
    response.each { |result|
      # The return format needs sorting out here .......
      results.push Muddyit::Collections::Collection::Entities::Entity.new(@muddyit, result)
    }
    return results
  end

  protected
  def fetch
    api_url = "/collections/#{@attributes[:collection].token}/entities/#{Digest::MD5.hexdigest(@attributes[:uri])}"
    response = @muddyit.send_request(api_url, :get)
    response.nested_symbolize_keys!
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
muddyit_fu-0.2.14 lib/muddyit/collections/entities/entity.rb
muddyit_fu-0.2.13 lib/muddyit/collections/entities/entity.rb
muddyit_fu-0.2.12 lib/muddyit/collections/entities/entity.rb
muddyit_fu-0.2.11 lib/muddyit/collections/entities/entity.rb
muddyit_fu-0.2.10 lib/muddyit/collections/entities/entity.rb
muddyit_fu-0.2.9 lib/muddyit/collections/entities/entity.rb