Class: Iterable::MetadataTable

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

Overview

Interact with /metadata/table API endpoints

Examples:

Creating metadata table endpoint object

# With default config
templates = Iterable::MetadataTable.new "table-name"
templates.get

# With custom config
conf = Iterable::Config.new(token: 'new-token')
templates = Iterable::MetadataTable.new("table-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) ⇒ MetadataTable

Returns a new instance of MetadataTable.



33
34
35
36
# File 'lib/iterable/metadata_table.rb', line 33

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



17
18
19
# File 'lib/iterable/metadata_table.rb', line 17

def name
  @name
end

Instance Method Details

#add(key, value = {}) ⇒ Object



79
80
81
# File 'lib/iterable/metadata_table.rb', line 79

def add(key, value = {})
  Iterable.request(conf, base_path(key)).put(value: value)
end

#deleteObject



58
59
60
# File 'lib/iterable/metadata_table.rb', line 58

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

#get(key) ⇒ Object



91
92
93
# File 'lib/iterable/metadata_table.rb', line 91

def get(key)
  Iterable.request(conf, base_path(key)).get
end

#list_keys(next_marker = nil) ⇒ Object



46
47
48
49
50
# File 'lib/iterable/metadata_table.rb', line 46

def list_keys(next_marker = nil)
  params = {}
  params['nextMarker'] = next_marker if next_marker
  Iterable.request(conf, base_path, params).get
end

#remove(key) ⇒ Object



103
104
105
# File 'lib/iterable/metadata_table.rb', line 103

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