Class: Iterable::CatalogItems
- Inherits:
-
ApiResource
- Object
- ApiResource
- Iterable::CatalogItems
- Defined in:
- lib/iterable/catalog_items.rb
Overview
Interact with /catalogs/catalogName/itemID API endpoints **currently in Beta only**
Instance Attribute Summary collapse
-
#catalog ⇒ Object
readonly
Returns the value of attribute catalog.
-
#item_id ⇒ Object
readonly
Returns the value of attribute item_id.
Attributes inherited from ApiResource
Instance Method Summary collapse
-
#all(params = {}) ⇒ Iterable::Response
Get all items for a catalog.
-
#create(item_attrs = {}) ⇒ Iterable::Response
(also: #replace)
Create a catalog item.
-
#delete ⇒ Iterable::Response
Delete a catalog item.
-
#get ⇒ Iterable::Response
Get a specific catalog item.
-
#initialize(catalog, item_id = nil, conf = nil) ⇒ Iterable::Catalog
constructor
Initialize CatalogItems with a catalog name and item ID **currently in Beta only**.
-
#update(item_attrs = {}) ⇒ Iterable::Response
Update a catalog item.
Methods inherited from ApiResource
default_config, #default_config
Constructor Details
#initialize(catalog, item_id = nil, conf = nil) ⇒ Iterable::Catalog
Initialize CatalogItems with a catalog name and item ID **currently in Beta only**
27 28 29 30 31 |
# File 'lib/iterable/catalog_items.rb', line 27 def initialize(catalog, item_id = nil, conf = nil) @catalog = catalog @item_id = item_id super conf end |
Instance Attribute Details
#catalog ⇒ Object (readonly)
Returns the value of attribute catalog.
16 17 18 |
# File 'lib/iterable/catalog_items.rb', line 16 def catalog @catalog end |
#item_id ⇒ Object (readonly)
Returns the value of attribute item_id.
16 17 18 |
# File 'lib/iterable/catalog_items.rb', line 16 def item_id @item_id end |
Instance Method Details
#all(params = {}) ⇒ Iterable::Response
Get all items for a catalog
40 41 42 |
# File 'lib/iterable/catalog_items.rb', line 40 def all(params = {}) Iterable.request(conf, base_path, params).get end |
#create(item_attrs = {}) ⇒ Iterable::Response Also known as: replace
Create a catalog item
51 52 53 54 |
# File 'lib/iterable/catalog_items.rb', line 51 def create(item_attrs = {}) body = { value: item_attrs } Iterable.request(conf, base_path).put(body) end |
#delete ⇒ Iterable::Response
Delete a catalog item
83 84 85 |
# File 'lib/iterable/catalog_items.rb', line 83 def delete Iterable.request(conf, base_path).delete end |
#get ⇒ Iterable::Response
Get a specific catalog item
74 75 76 |
# File 'lib/iterable/catalog_items.rb', line 74 def get Iterable.request(conf, base_path).get end |
#update(item_attrs = {}) ⇒ Iterable::Response
Update a catalog item
64 65 66 67 |
# File 'lib/iterable/catalog_items.rb', line 64 def update(item_attrs = {}) body = { update: item_attrs } Iterable.request(conf, base_path).patch(body) end |