Class: SilverPop::Client

Inherits:
Object
  • Object
show all
Includes:
Contact, RelationalTable, Reporting, User, Connection, Request
Defined in:
lib/client/user.rb,
lib/client/contact.rb,
lib/client/reporting.rb,
lib/silverpop/client.rb,
lib/client/relational_table.rb

Defined Under Namespace

Modules: Contact, RelationalTable, Reporting, User

Instance Method Summary collapse

Methods included from RelationalTable

#insert_update_relational_table

Methods included from User

#export_list

Methods included from Reporting

#get_job_status, #get_sent_mailings_for_org, #raw_recipient_data_export

Methods included from Contact

#add_recipient

Methods included from Request

#post

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



11
12
13
14
# File 'lib/silverpop/client.rb', line 11

def initialize(options={})
  @access_token = options[:access_token]
  @silverpop_url = options[:url]
end

Instance Method Details

#export_table(table_id, export_format, options = {}) ⇒ Mash

ExportTable - This interface supports programmatically exporting Relational Table data from Engage into a CSV file, which Engage uploads to the FTP account or to the Stored Files directory associated with the session.

Examples:

Export Table 12345 for 1/1/2014 to 1/2/2014

s = SilverPop.new({access_token: "abc123", url: "https://api1.silverpop.com"})
s.export_table('12345', 'CSV', {DATE_START: "1/1/2014", DATE_END:"1/2/2014"})

Parameters:

  • table_id (String)

    Optional parameter to specify the ID of the Relational Table you are exporting. Either TABLE_NAME or TABLE_ID is required.

  • export_format (String)

    Specifies the format (file type) for the exported data, CSV, TAB, PIPE.

  • options (Hash) (defaults to: {})

    Optional parameters to send

  • export_colums (Array)

    XML node used to request specific custom database columns to export for each contact.

Returns:

  • (Mash)

    Mashify body from the API call



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/client/relational_table.rb', line 48

def export_table(table_id, export_format, options={})
  builder = Builder::XmlMarkup.new
  xml = builder.Envelope {
    builder.Body {
      builder.ExportTable {
        builder.TABLE_NAME table_id
        builder.EXPORT_FORMAT export_format
        unless options.empty?
          options.each do |o|
            builder.tag! o[0], o[1]
          end
        end
        }
      }
  }
  post(xml)
end