Class: Iterable::BulkCatalogItems

Inherits:
ApiResource show all
Defined in:
lib/iterable/bulk_catalog_items.rb

Overview

Interact with /catalogs/catalogName/items API endpoints **currently in Beta only**

Examples:

Creating catalog items endpoint object

# With default config
catalog = Iterable::BulkCatalogItems.new "catalog-name"
catalog.items

# With custom config
conf = Iterable::Config.new(token: 'new-token')
catalog = Iterable::BulkCatalogItems.new("catalog-name", config)

Instance Attribute Summary collapse

Attributes inherited from ApiResource

#conf

Instance Method Summary collapse

Methods inherited from ApiResource

default_config, #default_config

Constructor Details

#initialize(catalog, conf = nil) ⇒ BulkCatalogItems

Returns a new instance of BulkCatalogItems.



29
30
31
32
# File 'lib/iterable/bulk_catalog_items.rb', line 29

def initialize(catalog, conf = nil)
  @catalog = catalog
  super conf
end

Instance Attribute Details

#catalogObject (readonly)

Returns the value of attribute catalog.



18
19
20
# File 'lib/iterable/bulk_catalog_items.rb', line 18

def catalog
  @catalog
end

Instance Method Details

#create(items = {}, replace_uploaded_fields_only: false) ⇒ Object



62
63
64
65
66
67
68
# File 'lib/iterable/bulk_catalog_items.rb', line 62

def create(items = {}, replace_uploaded_fields_only: false)
  body = {
    documents: items,
    replaceUploadedFieldsOnly: replace_uploaded_fields_only
  }
  Iterable.request(conf, base_path).post(body)
end

#delete(item_ids = []) ⇒ Object



42
43
44
45
# File 'lib/iterable/bulk_catalog_items.rb', line 42

def delete(item_ids = [])
  body = { itemIds: item_ids }
  Iterable.request(conf, base_path).delete(body)
end