silverpop 0.0.3 → 0.0.4
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 +8 -8
- data/lib/client/user.rb +46 -0
- data/lib/silverpop/client.rb +2 -0
- data/lib/silverpop/version.rb +1 -1
- data/spec/client/user_spec.rb +28 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjdkNDEyMWVlNjQyODViYWNjYWQ0MDQ2ZjI0NDQ5NGU1YjgwM2Y5Yg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTJiYTM3MTJiMDM5ZWQzNTNiZDg1Nzc3Mzk0YzExYjE5NGVlZmU3Zg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
Y2E1ZjI5MTMyMDk0ZWViOWFmMmRjZDcxNmYwMzYzYzhjOWExNmVjYzVjZjJl
|
10
|
+
ODczNGJhNjZiM2RlYmY4Njg5Y2VmYmY4MzhmYTM2NDlkOWY2ODAzNTkwYTk0
|
11
|
+
OTEwNDljZTZiODA3YTZlMjBkNDFlYzI0NTYxNjEwN2NjMmQwYjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzUxNWE0OThiZmEwMjc3NDNjYzU1ZWE5MjA1YWE0OTUwYjUzNTkwMTMzMDBi
|
14
|
+
YzI3YzIyN2MxZDAxM2FkYmFjZTIxODI4Y2FkZmQzOGM3YjYzMzA1M2I5NmJk
|
15
|
+
ZDZhNmM3NDZjMzFmZGFjYWZkOWQ5M2E5OWE1MWFkY2Y1OTZiZTQ=
|
data/lib/client/user.rb
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
module SilverPop
|
2
|
+
class Client
|
3
|
+
module User
|
4
|
+
|
5
|
+
# ExportList - This interface exports contact data from a database, query, or contact list. Engage exports the results to a CSV file, then adds that file to the FTP account associated with the current session.
|
6
|
+
#
|
7
|
+
# @param list_id [String] Unique identifier for the database, query, or contact list Engage is exporting.
|
8
|
+
# @param export_type [String] Specifies which contacts to export.
|
9
|
+
# @param export_format [String] Specifies the format (file type) for the exported data.
|
10
|
+
# @param options [Hash] Optional parameters to send
|
11
|
+
# @param export_colums [Array] XML node used to request specific custom database columns to export for each contact.
|
12
|
+
# @return [Mash] Mashify body from the API call
|
13
|
+
# @example Export list 12345 for 1/1/2014 to 1/2/2014
|
14
|
+
# s = SilverPop.new({access_token: "abc123", url: "https://api1.silverpop.com"})
|
15
|
+
# s.export_list('12345', 'ALL', 'CSV", {DATE_START: "1/1/2014", DATE_END:"1/2/2014"})
|
16
|
+
def export_list(list_id, export_type, export_format, options={}, export_columns=[])
|
17
|
+
builder = Builder::XmlMarkup.new
|
18
|
+
xml = builder.Envelope {
|
19
|
+
builder.Body {
|
20
|
+
builder.ExportList {
|
21
|
+
builder.LIST_ID list_id
|
22
|
+
builder.EXPORT_TYPE export_type
|
23
|
+
builder.EXPORT_FORMAT export_format
|
24
|
+
unless options.empty?
|
25
|
+
options.each do |o|
|
26
|
+
builder.tag! o[0], o[1]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
unless export_columns.empty?
|
30
|
+
builder.EXPORT_COLUMNS {
|
31
|
+
export_columns.each do |e|
|
32
|
+
builder.COLUMN e
|
33
|
+
end
|
34
|
+
}
|
35
|
+
end
|
36
|
+
}
|
37
|
+
}
|
38
|
+
}
|
39
|
+
post(xml)
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
data/lib/silverpop/client.rb
CHANGED
@@ -3,6 +3,7 @@ require 'silverpop/connection'
|
|
3
3
|
require 'silverpop/request'
|
4
4
|
require 'client/contact'
|
5
5
|
require 'client/reporting'
|
6
|
+
require 'client/user'
|
6
7
|
|
7
8
|
module SilverPop
|
8
9
|
class Client
|
@@ -15,5 +16,6 @@ module SilverPop
|
|
15
16
|
include SilverPop::Request
|
16
17
|
include SilverPop::Client::Contact
|
17
18
|
include SilverPop::Client::Reporting
|
19
|
+
include SilverPop::Client::User
|
18
20
|
end
|
19
21
|
end
|
data/lib/silverpop/version.rb
CHANGED
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe SilverPop::Client::User do
|
4
|
+
before do
|
5
|
+
@client = SilverPop.new({access_token: "abc123",url: 'https://api1.silverpop.com'})
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ".export_list" do
|
9
|
+
it 'returns the job_id' do
|
10
|
+
stub_post("/XMLAPI?access_token=abc123").
|
11
|
+
with(:body => "<Envelope><Body><ExportList><LIST_ID>59294</LIST_ID><EXPORT_TYPE>ALL</EXPORT_TYPE><EXPORT_FORMAT>CSV</EXPORT_FORMAT></ExportList></Body></Envelope>").
|
12
|
+
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"})
|
13
|
+
|
14
|
+
resp = @client.export_list('59294', 'ALL', 'CSV')
|
15
|
+
resp.Envelope.Body.RESULT.JOB_ID.should eql "499600"
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns the job_id when passing options' do
|
19
|
+
stub_post("/XMLAPI?access_token=abc123").
|
20
|
+
with(:body => "<Envelope><Body><ExportList><LIST_ID>59294</LIST_ID><EXPORT_TYPE>ALL</EXPORT_TYPE><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><EXPORT_COLUMNS><COLUMN>FIRST_NAME</COLUMN><COLUMN>INITIAL</COLUMN><COLUMN>LAST_NAME</COLUMN></EXPORT_COLUMNS></ExportList></Body></Envelope>").
|
21
|
+
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"})
|
22
|
+
|
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
|
+
resp.Envelope.Body.RESULT.JOB_ID.should eql "499600"
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
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.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Upworthy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -153,6 +153,7 @@ files:
|
|
153
153
|
- Rakefile
|
154
154
|
- lib/client/contact.rb
|
155
155
|
- lib/client/reporting.rb
|
156
|
+
- lib/client/user.rb
|
156
157
|
- lib/silverpop.rb
|
157
158
|
- lib/silverpop/client.rb
|
158
159
|
- lib/silverpop/connection.rb
|
@@ -161,6 +162,7 @@ files:
|
|
161
162
|
- silverpop.gemspec
|
162
163
|
- spec/client/contact_spec.rb
|
163
164
|
- spec/client/reporting_spec.rb
|
165
|
+
- spec/client/user_spec.rb
|
164
166
|
- spec/fixtures/contact.xml
|
165
167
|
- spec/fixtures/reporting.xml
|
166
168
|
- spec/fixtures/sent_mailings_org.xml
|
@@ -193,6 +195,7 @@ summary: A Ruby wrapper for the SilverPop API
|
|
193
195
|
test_files:
|
194
196
|
- spec/client/contact_spec.rb
|
195
197
|
- spec/client/reporting_spec.rb
|
198
|
+
- spec/client/user_spec.rb
|
196
199
|
- spec/fixtures/contact.xml
|
197
200
|
- spec/fixtures/reporting.xml
|
198
201
|
- spec/fixtures/sent_mailings_org.xml
|