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



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"})


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