Content units
List content units
Section titled “List content units”Use content_units to retrieve content units belonging to a specific project item:
units = client.content_units('project-id', 'item-id')
units.each do |unit| puts "#{unit.id}: #{unit.key}"endReturns a LokaliseApiNext::Collections::Vantage::ContentUnits collection containing LokaliseApiNext::Models::Vantage::ContentUnit objects.
You can access individual content unit attributes:
unit = units.first
puts unit.idputs unit.project_idputs unit.typeputs unit.keyputs unit.positionputs unit.source_segments_countPagination and filtering
Section titled “Pagination and filtering”The content_units method supports cursor-based pagination and filtering by content unit keys.
For example, retrieve up to 20 content units matching a specific key:
units = client.content_units( 'project-id', 'item-id', limit: 20, 'filter-keys': 'welcome.title')To retrieve the next page, pass the returned cursor while preserving the filter:
if units.more? next_page = client.content_units( 'project-id', 'item-id', limit: 20, after: units.cursor, 'filter-keys': 'welcome.title' )endThe API supports a maximum of 500 content units per page.