class Iterable::Catalogs

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

@example 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)

Attributes

name[R]

Public Class Methods

new(name, conf = nil) click to toggle source

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

@param name [String] The name of the catalog to interact with @param conf [Iterable::Config] A config to optionally pass for requests

@return [Iterable::Catalog]

Calls superclass method Iterable::ApiResource::new
# File lib/iterable/catalogs.rb, line 25
def initialize(name, conf = nil)
  @name = name
  super conf
end

Public Instance Methods

create() click to toggle source

Create a catalog

@return [Iterable::Response] A response object

# File lib/iterable/catalogs.rb, line 35
def create
  Iterable.request(conf, base_path).post
end
delete() click to toggle source

Delete a catalog

@return [Iterable::Response] A response object

# File lib/iterable/catalogs.rb, line 44
def delete
  Iterable.request(conf, base_path).delete
end
names(params = {}) click to toggle source

Get a list of all catalog names

@return [Iterable::Response] A response object

# File lib/iterable/catalogs.rb, line 53
def names(params = {})
  Iterable.request(conf, '/catalogs', params).get
end

Private Instance Methods

base_path() click to toggle source
# File lib/iterable/catalogs.rb, line 59
def base_path
  "/catalogs/#{@name}"
end