Class: Iterable::Catalogs

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

Overview

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

Examples:

Creating catalog endpoint object

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

# With custom config
conf = Iterable::Config.new(token: 'new-token')
catalog = Iterable::Catalogs.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(name, conf = nil) ⇒ Iterable::Catalog

Initialize Catalogs with a catalog name **currently in Beta only**

Parameters:

  • name (String)

    The name of the catalog to interact with

  • conf (Iterable::Config) (defaults to: nil)

    A config to optionally pass for requests



26
27
28
29
# File 'lib/iterable/catalogs.rb', line 26

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



16
17
18
# File 'lib/iterable/catalogs.rb', line 16

def name
  @name
end

Instance Method Details

#createIterable::Response

Create a catalog

Returns:



36
37
38
# File 'lib/iterable/catalogs.rb', line 36

def create
  Iterable.request(conf, base_path).post
end

#deleteIterable::Response

Delete a catalog

Returns:



45
46
47
# File 'lib/iterable/catalogs.rb', line 45

def delete
  Iterable.request(conf, base_path).delete
end

#names(params = {}) ⇒ Iterable::Response

Get a list of all catalog names

Returns:



54
55
56
# File 'lib/iterable/catalogs.rb', line 54

def names(params = {})
  Iterable.request(conf, '/catalogs', params).get
end