Module: Zotero::ItemTypes
- Included in:
- Client
- Defined in:
- lib/zotero/item_types.rb
Overview
Item type discovery and template methods
Instance Method Summary collapse
- #build_locale_params(locale) ⇒ Object private
-
#item_type_creator_types(item_type) ⇒ Array<Hash>
Get all creator types available for a specific item type.
-
#item_type_fields(item_type, locale: nil) ⇒ Array<Hash>
Get all fields available for a specific item type.
-
#item_types(locale: nil) ⇒ Array<Hash>
Get all available item types.
-
#new_item_template(item_type) ⇒ Hash
Get a new item template for a specific item type.
Instance Method Details
#build_locale_params(locale) ⇒ Object (private)
46 47 48 |
# File 'lib/zotero/item_types.rb', line 46 def build_locale_params(locale) locale ? { locale: locale } : {} end |
#item_type_creator_types(item_type) ⇒ Array<Hash>
Get all creator types available for a specific item type.
30 31 32 33 |
# File 'lib/zotero/item_types.rb', line 30 def item_type_creator_types(item_type) params = { itemType: item_type } make_get_request("/itemTypeCreatorTypes", params: params) end |
#item_type_fields(item_type, locale: nil) ⇒ Array<Hash>
Get all fields available for a specific item type.
20 21 22 23 24 |
# File 'lib/zotero/item_types.rb', line 20 def item_type_fields(item_type, locale: nil) params = { itemType: item_type } params.merge!(build_locale_params(locale)) make_get_request("/itemTypeFields", params: params) end |
#item_types(locale: nil) ⇒ Array<Hash>
Get all available item types.
10 11 12 13 |
# File 'lib/zotero/item_types.rb', line 10 def item_types(locale: nil) params = build_locale_params(locale) make_get_request("/itemTypes", params: params) end |
#new_item_template(item_type) ⇒ Hash
Get a new item template for a specific item type.
39 40 41 42 |
# File 'lib/zotero/item_types.rb', line 39 def new_item_template(item_type) params = { itemType: item_type } make_get_request("/items/new", params: params) end |