mirror of https://github.com/captn3m0/outliner.git
14 lines
386 B
Ruby
14 lines
386 B
Ruby
module Outliner
|
|
class Helper
|
|
def find_or_create_collection(client, name)
|
|
collections = client.collections_list(limit: 100)['data']
|
|
collections.filter!{|c|c['name'] == name}
|
|
if collections.size >= 1
|
|
collections[0]['id']
|
|
else
|
|
client.collections_create(name: name, description: 'Imported Collection')['data']['id']
|
|
end
|
|
end
|
|
end
|
|
end
|