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.



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

def initialize(master)
    @master = master
end

Instance Attribute Details

#masterObject

Returns the value of attribute master.



1998
1999
2000
# File 'lib/mandrill/api.rb', line 1998

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



2022
2023
2024
2025
# File 'lib/mandrill/api.rb', line 2022

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



2045
2046
2047
2048
# File 'lib/mandrill/api.rb', line 2045

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
      


2010
2011
2012
2013
# File 'lib/mandrill/api.rb', line 2010

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



2034
2035
2036
2037
# File 'lib/mandrill/api.rb', line 2034

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