Module: Zotero::Fulltext

Included in:
Library
Defined in:
lib/zotero/fulltext.rb

Overview

Fulltext search and content methods

Instance Method Summary collapse

Instance Method Details

#fulltext_since(since:) ⇒ Hash

Get fulltext content that has been modified since a given version.

Parameters:

  • since (Integer)

    Version number to get changes since

Returns:

  • (Hash)

    Object mapping item keys to version numbers



10
11
12
13
# File 'lib/zotero/fulltext.rb', line 10

def fulltext_since(since:)
  params = { since: since }
  @client.make_get_request("#{@base_path}/fulltext", params: params)
end

#item_fulltext(item_key) ⇒ Hash

Get the fulltext content for a specific item.

Parameters:

  • item_key (String)

    The item key to get fulltext for

Returns:

  • (Hash)

    Fulltext content data including content, indexedChars, and totalChars



19
20
21
# File 'lib/zotero/fulltext.rb', line 19

def item_fulltext(item_key)
  @client.make_get_request("#{@base_path}/items/#{item_key}/fulltext")
end

#set_item_fulltext(item_key, content_data, version: nil) ⇒ Boolean

Set the fulltext content for a specific item.

Parameters:

  • item_key (String)

    The item key to set fulltext for

  • content_data (Hash)

    Fulltext content data with content, indexedChars, totalChars

  • version (Integer) (defaults to: nil)

    Optional version for optimistic concurrency control

Returns:

  • (Boolean)

    Success status



29
30
31
32
# File 'lib/zotero/fulltext.rb', line 29

def set_item_fulltext(item_key, content_data, version: nil)
  @client.make_write_request(:put, "#{@base_path}/items/#{item_key}/fulltext", data: content_data,
                                                                               options: { version: version })
end