Class: Typesense::Collections
- Inherits:
-
Object
- Object
- Typesense::Collections
- Defined in:
- lib/typesense/collections.rb
Constant Summary collapse
- RESOURCE_PATH =
'/collections'
Instance Method Summary collapse
- #[](collection_name) ⇒ Object
- #create(schema) ⇒ Object
-
#initialize(api_call) ⇒ Collections
constructor
A new instance of Collections.
- #retrieve(options = {}) ⇒ Object
Constructor Details
#initialize(api_call) ⇒ Collections
Returns a new instance of Collections.
7 8 9 10 |
# File 'lib/typesense/collections.rb', line 7 def initialize(api_call) @api_call = api_call @collections = {} end |
Instance Method Details
#[](collection_name) ⇒ Object
20 21 22 |
# File 'lib/typesense/collections.rb', line 20 def [](collection_name) @collections[collection_name] ||= Collection.new(collection_name, @api_call) end |
#create(schema) ⇒ Object
12 13 14 |
# File 'lib/typesense/collections.rb', line 12 def create(schema) @api_call.post(RESOURCE_PATH, schema) end |
#retrieve(options = {}) ⇒ Object
16 17 18 |
# File 'lib/typesense/collections.rb', line 16 def retrieve( = {}) @api_call.get(RESOURCE_PATH, ) end |