silverpop 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9d3e167bdb75f92390cc2a04454f0e096ac57808
4
- data.tar.gz: 47cccd7b2b00a22728b942fa1482cb5305ac78ec
3
+ metadata.gz: 3205a40089ed6c45072a31029dd8245c45e0db18
4
+ data.tar.gz: b8329eac05e5fe1f943ad63cf5e33a743438bf7a
5
5
  SHA512:
6
- metadata.gz: 16eab93b6faabc91ae4c9df809ecaeaff1f45a92fa72b6d420a7bcc09ab6640a79008e70f4a54e3daf46095c7412b5eb5e6a5962b41ddad74eb9e77fd387f65b
7
- data.tar.gz: 8d1cad93169a41dcf8e7918787d9d6d20ec70d4f20fbc645982c9fec8a83d1d005d1efe7f5776d5afb36f79ef59913ffa1b17aea7ea52575da181579e30ca6e9
6
+ metadata.gz: a65cb37791b17359e98c289ae259e6b13d0aba6149b360049d9163ea43ff4136860e8c505900bc5cc2801f097a4b8bdb22a9d516110cc5b3c87228cc0391950b
7
+ data.tar.gz: 3886f813f1961085f19ed9dbd8660cc6cd86edeb67f1ee2d8c383ece34e5529bebfee7727bc01fd2e1638efff3bc5ba285ca6bfa6adc2114d8b7d959eb81ce2a
@@ -40,6 +40,35 @@ module SilverPop
40
40
  end
41
41
 
42
42
  end
43
+
44
+ # 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.
45
+ #
46
+ # @param table_id [String] Optional parameter to specify the ID of the Relational Table you are exporting. Either TABLE_NAME or TABLE_ID is required.
47
+ # @param export_format [String] Specifies the format (file type) for the exported data, CSV, TAB, PIPE.
48
+ # @param options [Hash] Optional parameters to send
49
+ # @param export_colums [Array] XML node used to request specific custom database columns to export for each contact.
50
+ # @return [Mash] Mashify body from the API call
51
+ # @example Export Table 12345 for 1/1/2014 to 1/2/2014
52
+ # s = SilverPop.new({access_token: "abc123", url: "https://api1.silverpop.com"})
53
+ # s.export_table('12345', 'CSV', {DATE_START: "1/1/2014", DATE_END:"1/2/2014"})
54
+ def export_table(table_id, export_format, options={})
55
+ builder = Builder::XmlMarkup.new
56
+ xml = builder.Envelope {
57
+ builder.Body {
58
+ builder.ExportTable {
59
+ builder.TABLE_NAME table_id
60
+ builder.EXPORT_FORMAT export_format
61
+ unless options.empty?
62
+ options.each do |o|
63
+ builder.tag! o[0], o[1]
64
+ end
65
+ end
66
+ }
67
+ }
68
+ }
69
+ post(xml)
70
+ end
71
+
43
72
  end
44
73
  end
45
74
 
@@ -1,3 +1,3 @@
1
1
  module SilverPop
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
@@ -23,6 +23,16 @@ describe SilverPop::Client::User do
23
23
  resp = @client.export_list('59294', 'ALL', 'CSV', {ADD_TO_STORED_FILES: nil, DATE_START: "07/25/2011 12:12:11", DATE_END: "09/30/2011 14:14:11"}, ["FIRST_NAME","INITIAL","LAST_NAME"])
24
24
  resp.Envelope.Body.RESULT.JOB_ID.should eql "499600"
25
25
  end
26
+ end
27
+
28
+ describe ".export_table" do
29
+ it 'returns the job_id of the relational table' do
30
+ stub_post("/XMLAPI?access_token=abc123").
31
+ with(:body => "<Envelope><Body><ExportTable><TABLE_NAME>59294</TABLE_NAME><EXPORT_FORMAT>CSV</EXPORT_FORMAT><ADD_TO_STORED_FILES/><DATE_START>07/25/2011 12:12:11</DATE_START><DATE_END>09/30/2011 14:14:11</DATE_END></ExportTable></Body></Envelope>").
32
+ to_return(:status => 200, :body => "<Envelope><Body><RESULT><SUCCESS>TRUE</SUCCESS><JOB_ID>499600</JOB_ID><FILE_PATH>file.CSV</FILE_PATH></RESULT></Body></Envelope>", :headers => {'Content-type' => "text/xml"})
26
33
 
34
+ resp = @client.export_table('59294','CSV',{ADD_TO_STORED_FILES: nil, DATE_START: "07/25/2011 12:12:11", DATE_END:"09/30/2011 14:14:11"})
35
+ resp.Envelope.Body.RESULT.JOB_ID.should eql "499600"
36
+ end
27
37
  end
28
38
  end
@@ -8,8 +8,8 @@ describe SilverPop do
8
8
  end
9
9
 
10
10
  describe ".respond_to?" do
11
- it "should be true if method exists" do
12
- SilverPop.respond_to?(:new, true).should be_true
11
+ pending it "should be true if method exists" do
12
+ expect(SilverPop.respond_to?(:new, true)).to be_true
13
13
  end
14
14
  end
15
15
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silverpop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Upworthy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-04 00:00:00.000000000 Z
11
+ date: 2015-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: addressable