Class: Mandrill::Metadata

Inherits:
Object
  • Object
show all
Defined in:
lib/mandrill/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(master) ⇒ Metadata

Returns a new instance of Metadata.



2003
2004
2005
# File 'lib/mandrill/api.rb', line 2003

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



2001
2002
2003
# File 'lib/mandrill/api.rb', line 2001

def master
  @master
end

Instance Method Details

#add(name, view_template = nil) ⇒ Hash

Add a new custom metadata field to be indexed for the account.

Parameters:

  • name (String)

    a unique identifier for the metadata field

  • view_template (String) (defaults to: nil)

    optional Mustache template to control how the metadata is rendered in your activity log

Returns:

  • (Hash)

    the information saved about the new metadata field

    • String

      name the unique identifier of the metadata field to update

    • String

      state the current state of the metadata field, one of “active”, “delete”, or “index”

    • String

      view_template Mustache template to control how the metadata is rendered in your activity log



2025
2026
2027
2028
# File 'lib/mandrill/api.rb', line 2025

def add(name, view_template=nil)
    _params = {:name => name, :view_template => view_template}
    return @master.call 'metadata/add', _params
end

#delete(name) ⇒ Hash

Delete an existing custom metadata field. Deletion isn’t instataneous, and /metadata/list will continue to return the field until the asynchronous deletion process is complete.

Parameters:

  • name (String)

    the unique identifier of the metadata field to update

Returns:

  • (Hash)

    the information for the deleted metadata field

    • String

      name the unique identifier of the metadata field to update

    • String

      state the current state of the metadata field, one of “active”, “delete”, or “index”

    • String

      view_template Mustache template to control how the metadata is rendered in your activity log



2048
2049
2050
2051
# File 'lib/mandrill/api.rb', line 2048

def delete(name)
    _params = {:name => name}
    return @master.call 'metadata/delete', _params
end

#listArray

Get the list of custom metadata fields indexed for the account.

Returns:

  • (Array)

    the custom metadata fields for the account

    • Hash

      return[] the individual custom metadata field info

      - [String] name the unique identifier of the metadata field to update
      - [String] state the current state of the metadata field, one of "active", "delete", or "index"
      - [String] view_template Mustache template to control how the metadata is rendered in your activity log
      


2013
2014
2015
2016
# File 'lib/mandrill/api.rb', line 2013

def list()
    _params = {}
    return @master.call 'metadata/list', _params
end

#update(name, view_template) ⇒ Hash

Update an existing custom metadata field.

Parameters:

  • name (String)

    the unique identifier of the metadata field to update

  • view_template (String)

    optional Mustache template to control how the metadata is rendered in your activity log

Returns:

  • (Hash)

    the information for the updated metadata field

    • String

      name the unique identifier of the metadata field to update

    • String

      state the current state of the metadata field, one of “active”, “delete”, or “index”

    • String

      view_template Mustache template to control how the metadata is rendered in your activity log



2037
2038
2039
2040
# File 'lib/mandrill/api.rb', line 2037

def update(name, view_template)
    _params = {:name => name, :view_template => view_template}
    return @master.call 'metadata/update', _params
end