silverpop 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/.travis.yml +7 -0
- data/Gemfile +9 -1
- data/README.md +4 -0
- data/lib/client/reporting.rb +27 -0
- data/lib/silverpop/version.rb +1 -1
- data/silverpop.gemspec +3 -5
- data/spec/client/reporting_spec.rb +30 -0
- data/spec/fixtures/sent_mailings_org.xml +33 -0
- metadata +15 -53
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YzIwNDYxYmM2N2M4ZmVjNjQ1MzI2ZjZkOGNkM2M2YTgwYzM2OTc0MA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NGFkYjI4NzRhNzI3NTZkN2NmNmI2NjgwZmY0NjZhYTc1M2FiYWMzMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTMxNjRkMjc4NDQyMGQ1ZTVmODA4MjQyZWJkYTE2MmVlODA0NDA2M2RjNTU2
|
10
|
+
ZTAxNTA0ZGUzYmRlNmI0MzliNzgyN2FhMTE5NjAyNzQ0NDY5MmUyNDM4Mzk1
|
11
|
+
ZjhkZjIyYWNlMzdjNGQ3MjQ1NWYwNWI0NmNjOTI4NWNkYzlkZWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MzRkYzc0NTcyZGYyNzFiZWEyNzI2MTU2OWU4MGFmNDAyMjY3OGRmM2ZlNGM0
|
14
|
+
YzViY2M4ZDZmYjAyZDk5YTZmYTQzZjU3YTM2ZmFmYTMyZjZmYzE0MGE5M2U1
|
15
|
+
MDIyZGFlOThlMjc0ZTkzNTlhOTEyNTFhMTAwNjcwZmFlZTcyZTY=
|
data/.travis.yml
ADDED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,13 @@
|
|
1
1
|
# SilverPop API
|
2
2
|
A Ruby wrapper for the SilverPop API
|
3
3
|
|
4
|
+
[![Build Status](https://secure.travis-ci.org/upworthy/silverpop.png?branch=master)][travis]
|
5
|
+
[travis]: http://travis-ci.org/upworthy/silverpop
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
9
|
+
$ gem install silverpop
|
10
|
+
|
7
11
|
## Documentation
|
8
12
|
|
9
13
|
|
data/lib/client/reporting.rb
CHANGED
@@ -2,6 +2,33 @@ module SilverPop
|
|
2
2
|
class Client
|
3
3
|
module Reporting
|
4
4
|
|
5
|
+
# GetSentMailingsForOrg - This interface extracts a listing of mailings sent for an organization for a specified date range.
|
6
|
+
#
|
7
|
+
# @param date_start [String] Starting Date in the format “mm/dd/yyyy hh:mm:ss”
|
8
|
+
# @param date_end [String] Required Ending Date in the format “mm/dd/yyyy hh:mm:ss”
|
9
|
+
# @param options [Hash] Optional parameters to send
|
10
|
+
# @return [Mash] Mashify body from the API call
|
11
|
+
# @example Get sent mailing for organization for 1/1/2014 to 1/2/2014
|
12
|
+
# s = SilverPop.new({access_token: "abc123", url: "https://api1.silverpop.com"})
|
13
|
+
# s.get_sent_mailings_for_org("1/1/2014", "1/2/2014)
|
14
|
+
def get_sent_mailings_for_org(date_start, date_end, options={})
|
15
|
+
builder = Builder::XmlMarkup.new
|
16
|
+
xml = builder.Envelope {
|
17
|
+
builder.Body {
|
18
|
+
builder.GetSentMailingsForOrg {
|
19
|
+
unless options.empty?
|
20
|
+
options.each do |o|
|
21
|
+
builder.tag! o[0], o[1]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
builder.DATE_START date_start
|
25
|
+
builder.DATE_END date_end
|
26
|
+
}
|
27
|
+
}
|
28
|
+
}
|
29
|
+
post(xml)
|
30
|
+
end
|
31
|
+
|
5
32
|
# RawRecipientDataExport - Allows exporting unique contact-level events and creates a .zip file containing a single flat file with all metrics
|
6
33
|
#
|
7
34
|
# @param query_params [Hash] The list of fields to run the query against MAILING_ID, REPORT_ID, etc.
|
data/lib/silverpop/version.rb
CHANGED
data/silverpop.gemspec
CHANGED
@@ -7,19 +7,17 @@ Gem::Specification.new do |gem|
|
|
7
7
|
gem.add_dependency 'faraday_middleware', '~> 0.8'
|
8
8
|
gem.add_dependency 'hashie', '~> 2.0'
|
9
9
|
gem.add_dependency 'builder', '~> 3.0'
|
10
|
+
gem.add_dependency 'multi_xml', '~> 0.5'
|
10
11
|
gem.add_development_dependency 'oauth2'
|
11
|
-
gem.add_development_dependency 'rake'
|
12
12
|
gem.add_development_dependency 'rdiscount'
|
13
|
-
gem.add_development_dependency 'rspec'
|
14
|
-
gem.add_development_dependency 'simplecov'
|
15
|
-
gem.add_development_dependency 'webmock'
|
16
13
|
gem.add_development_dependency 'yard'
|
17
14
|
gem.author = "Upworthy"
|
18
15
|
gem.description = %q{A Ruby wrapper for the SilverPop API}
|
19
16
|
gem.email = 'webmaster@upworthy.com'
|
20
17
|
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
21
18
|
gem.files = `git ls-files`.split("\n")
|
22
|
-
gem.homepage = ''
|
19
|
+
gem.homepage = 'http://www.github.com/upworthy/silverpop'
|
20
|
+
gem.licenses = ['BSD-3-Clause']
|
23
21
|
gem.name = 'silverpop'
|
24
22
|
gem.require_paths = ['lib']
|
25
23
|
gem.summary = gem.description
|
@@ -5,6 +5,36 @@ describe SilverPop::Client::Reporting do
|
|
5
5
|
@client = SilverPop.new({access_token: "abc123",url: 'https://api1.silverpop.com'})
|
6
6
|
end
|
7
7
|
|
8
|
+
describe ".get_sent_mailings_for_org" do
|
9
|
+
it "returns the mailingId for the given dates" do
|
10
|
+
stub_post("/XMLAPI?access_token=abc123").
|
11
|
+
with(:body => "<Envelope><Body><GetSentMailingsForOrg><DATE_START>1/1/2014 00:00:00</DATE_START><DATE_END>1/2/2014 23:59:59</DATE_END></GetSentMailingsForOrg></Body></Envelope>").
|
12
|
+
to_return(:status => 200, :body => fixture('sent_mailings_org.xml'), :headers => {'Content-type' => "text/xml"})
|
13
|
+
|
14
|
+
resp = @client.get_sent_mailings_for_org("1/1/2014 00:00:00", "1/2/2014 23:59:59")
|
15
|
+
resp.Envelope.Body.RESULT.Mailing[0].MailingId.should eql "5758"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the mailingId for the given dates when passing an option" do
|
19
|
+
stub_post("/XMLAPI?access_token=abc123").
|
20
|
+
with(:body => "<Envelope><Body><GetSentMailingsForOrg><PRIVATE/><DATE_START>1/1/2014 00:00:00</DATE_START><DATE_END>1/2/2014 23:59:59</DATE_END></GetSentMailingsForOrg></Body></Envelope>").
|
21
|
+
to_return(:status => 200, :body => fixture('sent_mailings_org.xml'), :headers => {'Content-type' => "text/xml"})
|
22
|
+
|
23
|
+
resp = @client.get_sent_mailings_for_org("1/1/2014 00:00:00", "1/2/2014 23:59:59", {PRIVATE: nil})
|
24
|
+
resp.Envelope.Body.RESULT.Mailing[0].MailingId.should eql "5758"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "returns the SentMailingCount" do
|
28
|
+
stub_post("/XMLAPI?access_token=abc123").
|
29
|
+
with(:body => "<Envelope><Body><GetSentMailingsForOrg><MAILING_COUNT_ONLY/><DATE_START>1/1/2014 00:00:00</DATE_START><DATE_END>1/2/2014 23:59:59</DATE_END></GetSentMailingsForOrg></Body></Envelope>").
|
30
|
+
to_return(:status => 200, :body => "<Envelope><Body><RESULT><SUCCESS>TRUE</SUCCESS><SentMailingsCount>5758</SentMailingsCount></RESULT></Body></Envelope>", :headers => {'Content-type' => "text/xml"})
|
31
|
+
|
32
|
+
resp = @client.get_sent_mailings_for_org("1/1/2014 00:00:00", "1/2/2014 23:59:59", {MAILING_COUNT_ONLY: nil})
|
33
|
+
resp.Envelope.Body.RESULT.SentMailingsCount.should eql "5758"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
8
38
|
describe ".raw_recipient_data_export" do
|
9
39
|
it "should return true when passing a MAILING_ID" do
|
10
40
|
stub_post("/XMLAPI?access_token=abc123").
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<Envelope>
|
2
|
+
<Body>
|
3
|
+
<RESULT>
|
4
|
+
<SUCCESS>TRUE</SUCCESS>
|
5
|
+
<Mailing>
|
6
|
+
<MailingId>5758</MailingId>
|
7
|
+
<ReportId>109118</ReportId>
|
8
|
+
<ScheduledTS>2011-06-14 10:54:06.0</ScheduledTS>
|
9
|
+
<MailingName><![CDATA[This is the mailing name]]></MailingName>
|
10
|
+
<ListName><![CDATA[This is the database name]]></ListName>
|
11
|
+
<ListId>4615</ListId>
|
12
|
+
<UserName> John Doe </UserName>
|
13
|
+
<SentTS/>
|
14
|
+
<NumSent>0</NumSent>
|
15
|
+
<Subject><![CDATA[Summer Sale]]></Subject>
|
16
|
+
<Visibility>Private</Visibility>
|
17
|
+
</Mailing>
|
18
|
+
<Mailing>
|
19
|
+
<MailingId>5758</MailingId>
|
20
|
+
<ReportId>109118</ReportId>
|
21
|
+
<ScheduledTS>2011-06-14 10:54:06.0</ScheduledTS>
|
22
|
+
<MailingName><![CDATA[My Mailing 2]]></MailingName>
|
23
|
+
<ListName><![CDATA[This is the database name 2]]></ListName>
|
24
|
+
<ListId>4616</ListId>
|
25
|
+
<UserName>John Doe</UserName>
|
26
|
+
<SentTS/>
|
27
|
+
<NumSent>0</NumSent>
|
28
|
+
<Subject><![CDATA[Summer Sale]]></Subject>
|
29
|
+
<Visibility>Private</Visibility>
|
30
|
+
</Mailing>
|
31
|
+
</RESULT>
|
32
|
+
</Body>
|
33
|
+
</Envelope>
|
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.3
|
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-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -81,21 +81,21 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: multi_xml
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :
|
89
|
+
version: '0.5'
|
90
|
+
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
96
|
+
version: '0.5'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: oauth2
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ! '>='
|
@@ -122,48 +122,6 @@ dependencies:
|
|
122
122
|
- - ! '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
- !ruby/object:Gem::Dependency
|
126
|
-
name: rspec
|
127
|
-
requirement: !ruby/object:Gem::Requirement
|
128
|
-
requirements:
|
129
|
-
- - ! '>='
|
130
|
-
- !ruby/object:Gem::Version
|
131
|
-
version: '0'
|
132
|
-
type: :development
|
133
|
-
prerelease: false
|
134
|
-
version_requirements: !ruby/object:Gem::Requirement
|
135
|
-
requirements:
|
136
|
-
- - ! '>='
|
137
|
-
- !ruby/object:Gem::Version
|
138
|
-
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: simplecov
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - ! '>='
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - ! '>='
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '0'
|
153
|
-
- !ruby/object:Gem::Dependency
|
154
|
-
name: webmock
|
155
|
-
requirement: !ruby/object:Gem::Requirement
|
156
|
-
requirements:
|
157
|
-
- - ! '>='
|
158
|
-
- !ruby/object:Gem::Version
|
159
|
-
version: '0'
|
160
|
-
type: :development
|
161
|
-
prerelease: false
|
162
|
-
version_requirements: !ruby/object:Gem::Requirement
|
163
|
-
requirements:
|
164
|
-
- - ! '>='
|
165
|
-
- !ruby/object:Gem::Version
|
166
|
-
version: '0'
|
167
125
|
- !ruby/object:Gem::Dependency
|
168
126
|
name: yard
|
169
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -187,6 +145,7 @@ files:
|
|
187
145
|
- .gemtest
|
188
146
|
- .gitignore
|
189
147
|
- .rspec
|
148
|
+
- .travis.yml
|
190
149
|
- .yardopts
|
191
150
|
- Gemfile
|
192
151
|
- LICENSE.md
|
@@ -204,10 +163,12 @@ files:
|
|
204
163
|
- spec/client/reporting_spec.rb
|
205
164
|
- spec/fixtures/contact.xml
|
206
165
|
- spec/fixtures/reporting.xml
|
166
|
+
- spec/fixtures/sent_mailings_org.xml
|
207
167
|
- spec/helper.rb
|
208
168
|
- spec/silverpop_spec.rb
|
209
|
-
homepage:
|
210
|
-
licenses:
|
169
|
+
homepage: http://www.github.com/upworthy/silverpop
|
170
|
+
licenses:
|
171
|
+
- BSD-3-Clause
|
211
172
|
metadata: {}
|
212
173
|
post_install_message:
|
213
174
|
rdoc_options: []
|
@@ -234,6 +195,7 @@ test_files:
|
|
234
195
|
- spec/client/reporting_spec.rb
|
235
196
|
- spec/fixtures/contact.xml
|
236
197
|
- spec/fixtures/reporting.xml
|
198
|
+
- spec/fixtures/sent_mailings_org.xml
|
237
199
|
- spec/helper.rb
|
238
200
|
- spec/silverpop_spec.rb
|
239
201
|
has_rdoc:
|