class Iterable::MetadataTable
Interact with /metadata/{table} API endpoints
@example 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)
Attributes
Public Class Methods
Initialize a MetadataTable
with a table name
@param name [String] The name of the table to interact with @param conf [Iterable::Config] A config to optionally pass for requests
@return [Iterable::MetadataTable]
Iterable::ApiResource::new
# File lib/iterable/metadata_table.rb, line 24 def initialize(name, conf = nil) @name = name super conf end
Public Instance Methods
Add metadata for table
@param key [String] Key of metadata to add @param value [Hash] Value of metadata key as a hash of key/value data
@return [Iterable::Response] A response object
# File lib/iterable/metadata_table.rb, line 59 def add(key, value = {}) Iterable.request(conf, base_path(key)).put(value: value) end
Delete metadata table
@return [Iterable::Response] A response object
# File lib/iterable/metadata_table.rb, line 47 def delete Iterable.request(conf, base_path).delete end
Get metadata key for table
@param key [String] Key of metadata to get
@return [Iterable::Response] A response object
# File lib/iterable/metadata_table.rb, line 70 def get(key) Iterable.request(conf, base_path(key)).get end
Get metadata table keys
@params next_marker [String] next result set id if more hits exist
@return [Iterable::Response] A response object
# File lib/iterable/metadata_table.rb, line 36 def list_keys(next_marker = nil) params = {} params['nextMarker'] = next_marker if next_marker Iterable.request(conf, base_path, params).get end
Remove metadata key for table
@param key [String] Key of metadata to delete
@return [Iterable::Response] A response object
# File lib/iterable/metadata_table.rb, line 81 def remove(key) Iterable.request(conf, base_path(key)).delete end
Private Instance Methods
# File lib/iterable/metadata_table.rb, line 87 def base_path(key = nil) path = "/metadata/#{@name}" path += "/#{key}" if key path end