goacoustic 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gemtest +0 -0
- data/.gitignore +38 -0
- data/.rspec +2 -0
- data/.travis.yml +9 -0
- data/.yardopts +3 -0
- data/Gemfile +16 -0
- data/LICENSE.md +12 -0
- data/README.md +82 -0
- data/Rakefile +16 -0
- data/goacoustic.gemspec +26 -0
- data/lib/acoustic.rb +23 -0
- data/lib/acoustic/client.rb +23 -0
- data/lib/acoustic/connection.rb +23 -0
- data/lib/acoustic/request.rb +22 -0
- data/lib/acoustic/version.rb +3 -0
- data/lib/client/contact.rb +47 -0
- data/lib/client/relational_table.rb +66 -0
- data/lib/client/reporting.rb +98 -0
- data/lib/client/user.rb +44 -0
- data/spec/acoustic_spec.rb +15 -0
- data/spec/client/contact_spec.rb +28 -0
- data/spec/client/relational_table_spec.rb +21 -0
- data/spec/client/reporting_spec.rb +104 -0
- data/spec/client/user_spec.rb +38 -0
- data/spec/fixtures/contact.xml +10 -0
- data/spec/fixtures/relational_table.xml +7 -0
- data/spec/fixtures/reporting.xml +14 -0
- data/spec/fixtures/sent_mailings_org.xml +33 -0
- data/spec/helper.rb +26 -0
- metadata +207 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 1be8c3589dd5a04b36baefaf5f1afefa1be1d35bcff0b9aeb9190d1aa7718e65
|
4
|
+
data.tar.gz: 7413c19d7d8a11d8d2a40d1fafdb87ec047f888d7542cf0c71c167e746c6d902
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 83b5148cb725a68ab7ba4b8e6224c7947245d43136901f0420b395fdbe9445cd643cc8c9efc9604e97d9183d09a50b4f6fd8f19d6dc6299a5e69bc0f6e2cfc1a
|
7
|
+
data.tar.gz: 9cc297d2abde9fcc6e27d8a5dd68a91771d5faf0c8852b265806a74b8dc9b4c44fd8396630bf02d29b4f58399790acff1c3ab7bc6214d468a89b74980b08ebf0
|
data/.gemtest
ADDED
File without changes
|
data/.gitignore
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
*.sw[a-p]
|
4
|
+
*.tmproj
|
5
|
+
*.tmproject
|
6
|
+
*.un~
|
7
|
+
*~
|
8
|
+
.Spotlight-V100
|
9
|
+
.Trashes
|
10
|
+
._*
|
11
|
+
.bundle
|
12
|
+
.config
|
13
|
+
.directory
|
14
|
+
.elc
|
15
|
+
.emacs.desktop
|
16
|
+
.emacs.desktop.lock
|
17
|
+
.redcar
|
18
|
+
.yardoc
|
19
|
+
Desktop.ini
|
20
|
+
Gemfile.lock
|
21
|
+
Icon?
|
22
|
+
InstalledFiles
|
23
|
+
Session.vim
|
24
|
+
\#*\#
|
25
|
+
_yardoc
|
26
|
+
auto-save-list
|
27
|
+
coverage
|
28
|
+
doc
|
29
|
+
lib/bundler/man
|
30
|
+
pkg
|
31
|
+
pkg/*
|
32
|
+
rdoc
|
33
|
+
spec/reports
|
34
|
+
test/tmp
|
35
|
+
test/version_tmp
|
36
|
+
tmp
|
37
|
+
tmtags
|
38
|
+
tramp
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Copyright (c) 2013, Cloud Tiger Media d.b.a. Upworthy
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
+
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
9
|
+
|
10
|
+
3. Neither the name of the Cloud Tiger Media d.b.a Upworthy nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
11
|
+
|
12
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,82 @@
|
|
1
|
+
# Acoustic API
|
2
|
+
A Ruby wrapper for the Acoustic API
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
|
6
|
+
$ gem install goacoustic
|
7
|
+
|
8
|
+
## Documentation
|
9
|
+
|
10
|
+
[http://rdoc.info/gems/goacoustic](http://rdoc.info/gems/goacoustic)
|
11
|
+
|
12
|
+
|
13
|
+
## Usage Examples
|
14
|
+
require 'acoustic'
|
15
|
+
require 'oauth2'
|
16
|
+
|
17
|
+
#Generate your OAuth2 access token
|
18
|
+
client = OAuth2::Client.new(ACOUSTIC_CLIENT_ID, ACOUSTIC_CLIENT_SECRET, site: "https://api-campaign-us-1.goacoustic.com/oauth/token")
|
19
|
+
access_token = OAuth2::AccessToken.from_hash(client, refresh_token: ACOUSTIC_REFRESH_TOKEN).refresh!
|
20
|
+
|
21
|
+
@client = Acoustic.new({access_token: access_token.token, url: "https://api-campaign-us-1.goacoustic.com"})
|
22
|
+
|
23
|
+
#add_recipeint
|
24
|
+
#pass in user variables, database contact list, and contact list id
|
25
|
+
a = @client.add_recipient({email:"test@example.com"}, 123, [456])
|
26
|
+
resp.Envelope.Body.RESULT.SUCCESS # => "TRUE"
|
27
|
+
|
28
|
+
## Contributing
|
29
|
+
In the spirit of [free software][free-sw], **everyone** is encouraged to help improve
|
30
|
+
this project.
|
31
|
+
|
32
|
+
[free-sw]: http://www.fsf.org/licensing/essays/free-sw.html
|
33
|
+
|
34
|
+
Here are some ways *you* can contribute:
|
35
|
+
|
36
|
+
* by using alpha, beta, and prerelease versions
|
37
|
+
* by reporting bugs
|
38
|
+
* by suggesting new features
|
39
|
+
* by writing or editing documentation
|
40
|
+
* by writing specifications
|
41
|
+
* by writing code (**no patch is too small**: fix typos, add comments, clean up
|
42
|
+
inconsistent whitespace)
|
43
|
+
* by refactoring code
|
44
|
+
* by fixing [issues][]
|
45
|
+
* by reviewing patches
|
46
|
+
|
47
|
+
[issues]: http://github.com/harman-signal-processing/goacoustic/issues
|
48
|
+
|
49
|
+
## Submitting an Issue
|
50
|
+
We use the [GitHub issue tracker][issues] to track bugs and features. Before
|
51
|
+
submitting a bug report or feature request, check to make sure it hasn't
|
52
|
+
already been submitted. When submitting a bug report, please include a [Gist][]
|
53
|
+
that includes a stack trace and any details that may be necessary to reproduce
|
54
|
+
the bug, including your gem version, Ruby version, and operating system.
|
55
|
+
Ideally, a bug report should include a pull request with failing specs.
|
56
|
+
|
57
|
+
[gist]: https://gist.github.com/
|
58
|
+
|
59
|
+
## Submitting a Pull Request
|
60
|
+
1. [Fork the repository.][fork]
|
61
|
+
2. [Create a topic branch.][branch]
|
62
|
+
3. Add specs for your unimplemented feature or bug fix.
|
63
|
+
4. Run `bundle exec rake spec`. If your specs pass, return to step 3.
|
64
|
+
5. Implement your feature or bug fix.
|
65
|
+
6. Run `bundle exec rake spec`. If your specs fail, return to step 5.
|
66
|
+
7. Run `open coverage/index.html`. If your changes are not completely covered
|
67
|
+
by your tests, return to step 3.
|
68
|
+
8. Add documentation for your feature or bug fix.
|
69
|
+
9. Run `bundle exec rake yard`. If your changes are not 100% documented, go
|
70
|
+
back to step 8.
|
71
|
+
10. Add, commit, and push your changes.
|
72
|
+
11. [Submit a pull request.][pr]
|
73
|
+
|
74
|
+
[fork]: http://help.github.com/fork-a-repo/
|
75
|
+
[branch]: http://learn.github.com/p/branching.html
|
76
|
+
[pr]: http://help.github.com/send-pull-requests/
|
77
|
+
|
78
|
+
## Copyright
|
79
|
+
Copyright (c) 2020 Harman. See [LICENSE][] for details.
|
80
|
+
|
81
|
+
[license]: https://github.com/harman-signal-processing/goacoustic/blob/master/LICENSE.md
|
82
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'bundler'
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
|
7
|
+
task :default => :spec
|
8
|
+
task :test => :spec
|
9
|
+
|
10
|
+
require 'yard'
|
11
|
+
namespace :doc do
|
12
|
+
YARD::Rake::YardocTask.new do |task|
|
13
|
+
task.files = ['LICENSE.md', 'lib/**/*.rb']
|
14
|
+
task.options = ['--markup', 'markdown']
|
15
|
+
end
|
16
|
+
end
|
data/goacoustic.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('../lib/acoustic/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.add_dependency 'addressable', '~> 2.7'
|
6
|
+
gem.add_dependency 'faraday', '~> 1.0'
|
7
|
+
gem.add_dependency 'faraday_middleware', '~> 1.0'
|
8
|
+
gem.add_dependency 'hashie', '~> 4.0'
|
9
|
+
gem.add_dependency 'builder', '~> 3.2'
|
10
|
+
gem.add_dependency 'multi_xml', '~> 0.6'
|
11
|
+
gem.add_development_dependency 'oauth2'
|
12
|
+
gem.add_development_dependency 'rdiscount'
|
13
|
+
gem.add_development_dependency 'yard'
|
14
|
+
gem.author = "Adam Anderson, Upworthy"
|
15
|
+
gem.description = %q{A Ruby wrapper for the Acoustic API}
|
16
|
+
gem.email = 'adam.anderson@harman.com'
|
17
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
18
|
+
gem.files = `git ls-files`.split("\n")
|
19
|
+
gem.homepage = 'http://www.github.com/harman-signal-processing/goacoustic'
|
20
|
+
gem.licenses = ['BSD-3-Clause']
|
21
|
+
gem.name = 'goacoustic'
|
22
|
+
gem.require_paths = ['lib']
|
23
|
+
gem.summary = gem.description
|
24
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
+
gem.version = Acoustic::VERSION
|
26
|
+
end
|
data/lib/acoustic.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'acoustic/client'
|
2
|
+
|
3
|
+
module Acoustic
|
4
|
+
class << self
|
5
|
+
# Alias for Acoustic::Client.new
|
6
|
+
#
|
7
|
+
# @return [Acoustic::Client]
|
8
|
+
def new(options={})
|
9
|
+
Acoustic::Client.new(options)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Delegate to Acoustic::Client.new
|
13
|
+
def method_missing(method, *args, &block)
|
14
|
+
return super unless new.respond_to?(method)
|
15
|
+
new.send(method, *args, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def respond_to?(method, include_private=false)
|
19
|
+
new.respond_to?(method, include_private) || super(method, include_private)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'builder'
|
2
|
+
require 'acoustic/connection'
|
3
|
+
require 'acoustic/request'
|
4
|
+
require 'client/contact'
|
5
|
+
require 'client/reporting'
|
6
|
+
require 'client/user'
|
7
|
+
require 'client/relational_table'
|
8
|
+
|
9
|
+
module Acoustic
|
10
|
+
class Client
|
11
|
+
def initialize(options={})
|
12
|
+
@access_token = options[:access_token]
|
13
|
+
@acoustic_url = options[:url]
|
14
|
+
end
|
15
|
+
|
16
|
+
include Acoustic::Connection
|
17
|
+
include Acoustic::Request
|
18
|
+
include Acoustic::Client::Contact
|
19
|
+
include Acoustic::Client::Reporting
|
20
|
+
include Acoustic::Client::User
|
21
|
+
include Acoustic::Client::RelationalTable
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'faraday_middleware'
|
2
|
+
|
3
|
+
module Acoustic
|
4
|
+
# @private
|
5
|
+
module Connection
|
6
|
+
private
|
7
|
+
|
8
|
+
def connection(options={})
|
9
|
+
connection = Faraday.new @acoustic_url do |conn|
|
10
|
+
# Uncomment if want to log to stdout
|
11
|
+
#conn.response :logger
|
12
|
+
|
13
|
+
conn.request :oauth2, @access_token, token_type: :bearer
|
14
|
+
conn.request :url_encoded
|
15
|
+
conn.response :mashify
|
16
|
+
|
17
|
+
conn.response :xml, :content_type => /\bxml$/
|
18
|
+
conn.adapter Faraday.default_adapter
|
19
|
+
end
|
20
|
+
connection
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Acoustic
|
2
|
+
module Request
|
3
|
+
def post(body)
|
4
|
+
request(:post, body)
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
# POST the XML to the Acoustic end point.
|
10
|
+
#
|
11
|
+
# @param body [String] The formatted XML of the API call make sure to call builder.to_xml.
|
12
|
+
# @return [XML] XML Body from the API call
|
13
|
+
def request(method, body)
|
14
|
+
response = connection.send(method) do |request|
|
15
|
+
request.url "/XMLAPI"
|
16
|
+
request.headers['Content-type'] = "text/xml"
|
17
|
+
request.body = body
|
18
|
+
end
|
19
|
+
response.body
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Acoustic
|
2
|
+
class Client
|
3
|
+
module Contact
|
4
|
+
|
5
|
+
# Adds one new contact to an existing database.
|
6
|
+
#
|
7
|
+
# @param fields [Hash] The list of fields to be passed into Acoustic.
|
8
|
+
# @param list_id [Integer] The ID of the database which you are adding the contact
|
9
|
+
# @param contact_list_id [Array] The id of the contact list.
|
10
|
+
# @return [Mash] Mashify body from the API call
|
11
|
+
# @example Add a new email to the database and contact list
|
12
|
+
# s = Acoustic::Client.new(access_token)
|
13
|
+
# s.add_recipient({email: "test@example.com", firstname: "Hello"}, 12345, [4567])
|
14
|
+
def add_recipient(fields, list_id, contact_list_id=nil, created_from=1, options={})
|
15
|
+
builder = Builder::XmlMarkup.new
|
16
|
+
xml = builder.Envelope {
|
17
|
+
builder.Body {
|
18
|
+
builder.AddRecipient {
|
19
|
+
builder.LIST_ID list_id
|
20
|
+
builder.CREATED_FROM created_from
|
21
|
+
if contact_list_id
|
22
|
+
builder.CONTACT_LISTS {
|
23
|
+
contact_list_id.each do |id|
|
24
|
+
builder.CONTACT_LIST_ID id
|
25
|
+
end
|
26
|
+
}
|
27
|
+
end
|
28
|
+
unless options.empty?
|
29
|
+
options.each do |opt|
|
30
|
+
builder.tag! opt[0], opt[1]
|
31
|
+
end
|
32
|
+
end
|
33
|
+
fields.each do |field|
|
34
|
+
builder.COLUMN {
|
35
|
+
builder.NAME field[0].to_s
|
36
|
+
builder.VALUE field[1]
|
37
|
+
}
|
38
|
+
end
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
response = post(xml)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module Acoustic
|
2
|
+
class Client
|
3
|
+
module RelationalTable
|
4
|
+
# InsertUpdateRelationalTable - This interface inserts or updates relational data.
|
5
|
+
#
|
6
|
+
# @param table_id [String] Required parameter to specify the ID of the Relational Table you are interacting with. Either TABLE_NAME or TABLE_ID is required.
|
7
|
+
# @param rows [Array]
|
8
|
+
# @return [Mash] Mashify body from the API call
|
9
|
+
# @example Insert into table 86767 a row with one column
|
10
|
+
# s = Acoustic.new access_token: 'abc123', url: 'https://api-campaign-us-1.goacoustic.com'
|
11
|
+
# s.insert_update_relational_table '86767', [{'Record Id' => 'GHbjh73643hsdiy'}]
|
12
|
+
def insert_update_relational_table table_id, rows
|
13
|
+
builder = Builder::XmlMarkup.new
|
14
|
+
|
15
|
+
xml = builder.Envelope {
|
16
|
+
builder.Body {
|
17
|
+
builder.InsertUpdateRelationalTable {
|
18
|
+
builder.TABLE_ID table_id
|
19
|
+
builder.ROWS {
|
20
|
+
rows.each do |row|
|
21
|
+
builder.ROW {
|
22
|
+
row.each do |key, value|
|
23
|
+
builder.COLUMN(name: key) {
|
24
|
+
builder.cdata!(value)
|
25
|
+
}
|
26
|
+
end
|
27
|
+
}
|
28
|
+
end
|
29
|
+
}
|
30
|
+
}
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
post(xml)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# 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.
|
39
|
+
#
|
40
|
+
# @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.
|
41
|
+
# @param export_format [String] Specifies the format (file type) for the exported data, CSV, TAB, PIPE.
|
42
|
+
# @param options [Hash] Optional parameters to send
|
43
|
+
# @param export_colums [Array] XML node used to request specific custom database columns to export for each contact.
|
44
|
+
# @return [Mash] Mashify body from the API call
|
45
|
+
# @example Export Table 12345 for 1/1/2014 to 1/2/2014
|
46
|
+
# s = Acoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
|
47
|
+
# s.export_table('12345', 'CSV', {DATE_START: "1/1/2014", DATE_END:"1/2/2014"})
|
48
|
+
def export_table(table_id, export_format, options={})
|
49
|
+
builder = Builder::XmlMarkup.new
|
50
|
+
xml = builder.Envelope {
|
51
|
+
builder.Body {
|
52
|
+
builder.ExportTable {
|
53
|
+
builder.TABLE_NAME table_id
|
54
|
+
builder.EXPORT_FORMAT export_format
|
55
|
+
unless options.empty?
|
56
|
+
options.each do |o|
|
57
|
+
builder.tag! o[0], o[1]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
post(xml)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,98 @@
|
|
1
|
+
module Acoustic
|
2
|
+
class Client
|
3
|
+
module Reporting
|
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 = Acoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.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
|
+
|
32
|
+
# RawRecipientDataExport - Allows exporting unique contact-level events and creates a .zip file containing a single flat file with all metrics
|
33
|
+
#
|
34
|
+
# @param query_params [Hash] The list of fields to run the query against MAILING_ID, REPORT_ID, etc.
|
35
|
+
# @param options [Hash] The various options on how to export the data EXPORT_FORMAT, FILE_ENCODING, etc.
|
36
|
+
# @param columns [Array] Optional list of columns to limit the flat file.
|
37
|
+
# @return [Mash] Mashify body from the API call
|
38
|
+
# @example Export raw data events for mailing id
|
39
|
+
# s = Acoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
|
40
|
+
# s.raw_recipient_data_export({MAILING_ID: 1234},{MOVE_TO_FTP: nil})
|
41
|
+
def raw_recipient_data_export(query_params={}, options={}, columns=[])
|
42
|
+
builder = Builder::XmlMarkup.new
|
43
|
+
xml = builder.Envelope {
|
44
|
+
builder.Body {
|
45
|
+
builder.RawRecipientDataExport {
|
46
|
+
unless query_params.empty?
|
47
|
+
query_params.each do |q|
|
48
|
+
if q[0] == :MAILING_ID || q[0] == :REPORT_ID
|
49
|
+
builder.MAILING {
|
50
|
+
builder.tag! q[0], q[1]
|
51
|
+
}
|
52
|
+
else
|
53
|
+
builder.tag! q[0], q[1]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
unless options.empty?
|
58
|
+
options.each do |opt|
|
59
|
+
builder.tag! opt[0], opt[1]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
unless columns.empty?
|
63
|
+
builder.COLUMNS {
|
64
|
+
columns.each do |column|
|
65
|
+
builder.COLUMN {
|
66
|
+
builder.NAME column
|
67
|
+
}
|
68
|
+
end
|
69
|
+
}
|
70
|
+
end
|
71
|
+
}
|
72
|
+
}
|
73
|
+
}
|
74
|
+
post(xml)
|
75
|
+
end
|
76
|
+
|
77
|
+
# GetJobStatus - After initiating a data job, you can monitor the status of the job using this operation.
|
78
|
+
#
|
79
|
+
# @param job_id [Integer] The Job ID of the data job
|
80
|
+
# @return [Mash] Mashify body from the API call
|
81
|
+
# @example Get Job Status for JOB_ID 1234
|
82
|
+
# s = Acoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
|
83
|
+
# s.get_job_status(1234)
|
84
|
+
def get_job_status(job_id)
|
85
|
+
builder = Builder::XmlMarkup.new
|
86
|
+
xml = builder.Envelope {
|
87
|
+
builder.Body {
|
88
|
+
builder.GetJobStatus {
|
89
|
+
builder.JOB_ID job_id
|
90
|
+
}
|
91
|
+
}
|
92
|
+
}
|
93
|
+
post(xml)
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
data/lib/client/user.rb
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
module Acoustic
|
2
|
+
class Client
|
3
|
+
module User
|
4
|
+
# 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.
|
5
|
+
#
|
6
|
+
# @param list_id [String] Unique identifier for the database, query, or contact list Engage is exporting.
|
7
|
+
# @param export_type [String] Specifies which contacts to export.
|
8
|
+
# @param export_format [String] Specifies the format (file type) for the exported data.
|
9
|
+
# @param options [Hash] Optional parameters to send
|
10
|
+
# @param export_colums [Array] XML node used to request specific custom database columns to export for each contact.
|
11
|
+
# @return [Mash] Mashify body from the API call
|
12
|
+
# @example Export list 12345 for 1/1/2014 to 1/2/2014
|
13
|
+
# s = Acoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
|
14
|
+
# s.export_list('12345', 'ALL', 'CSV", {DATE_START: "1/1/2014", DATE_END:"1/2/2014"})
|
15
|
+
def export_list(list_id, export_type, export_format, options={}, export_columns=[])
|
16
|
+
builder = Builder::XmlMarkup.new
|
17
|
+
xml = builder.Envelope {
|
18
|
+
builder.Body {
|
19
|
+
builder.ExportList {
|
20
|
+
builder.LIST_ID list_id
|
21
|
+
builder.EXPORT_TYPE export_type
|
22
|
+
builder.EXPORT_FORMAT export_format
|
23
|
+
unless options.empty?
|
24
|
+
options.each do |o|
|
25
|
+
builder.tag! o[0], o[1]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
unless export_columns.empty?
|
29
|
+
builder.EXPORT_COLUMNS {
|
30
|
+
export_columns.each do |e|
|
31
|
+
builder.COLUMN e
|
32
|
+
end
|
33
|
+
}
|
34
|
+
end
|
35
|
+
}
|
36
|
+
}
|
37
|
+
}
|
38
|
+
post(xml)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Acoustic do
|
4
|
+
describe ".new" do
|
5
|
+
it "should be a new Acoustic::Client" do
|
6
|
+
expect(Acoustic.new).to be_a Acoustic::Client
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
describe ".respond_to?" do
|
11
|
+
pending it "should be true if method exists" do
|
12
|
+
expect(Acoustic.respond_to?(:new, true)).to be_true
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Acoustic::Client::Contact do
|
4
|
+
before do
|
5
|
+
@client = Acoustic::Client.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#add_recipient" do
|
9
|
+
it "should add a recipient to an existing database" do
|
10
|
+
stub_post("/XMLAPI").
|
11
|
+
with(:body => "<Envelope><Body><AddRecipient><LIST_ID>123</LIST_ID><CREATED_FROM>1</CREATED_FROM><CONTACT_LISTS><CONTACT_LIST_ID>456</CONTACT_LIST_ID></CONTACT_LISTS><COLUMN><NAME>email</NAME><VALUE>test@example.com</VALUE></COLUMN></AddRecipient></Body></Envelope>").
|
12
|
+
to_return(:status => 200, :body => fixture("contact.xml"), :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
|
13
|
+
|
14
|
+
resp = @client.add_recipient({email:"test@example.com"}, 123, [456])
|
15
|
+
expect(resp.Envelope.Body.RESULT.SUCCESS).to eql "TRUE"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should add a recipient to an existing database with options" do
|
19
|
+
stub_post("/XMLAPI").
|
20
|
+
with(:body => "<Envelope><Body><AddRecipient><LIST_ID>123</LIST_ID><CREATED_FROM>1</CREATED_FROM><CONTACT_LISTS><CONTACT_LIST_ID>456</CONTACT_LIST_ID></CONTACT_LISTS><UPDATE_IF_FOUND>true</UPDATE_IF_FOUND><COLUMN><NAME>email</NAME><VALUE>test@example.com</VALUE></COLUMN></AddRecipient></Body></Envelope>").
|
21
|
+
to_return(:status => 200, :body => fixture("contact.xml"), :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
|
22
|
+
|
23
|
+
resp = @client.add_recipient({email:"test@example.com"}, 123, [456], 1, {UPDATE_IF_FOUND: "true"})
|
24
|
+
expect(resp.Envelope.Body.RESULT.SUCCESS).to eql "TRUE"
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Acoustic::Client::RelationalTable do
|
4
|
+
before do
|
5
|
+
@client = Acoustic.new access_token: 'abc123', url: 'https://api-campaign-us-1.goacoustic.com'
|
6
|
+
end
|
7
|
+
|
8
|
+
describe '.insert_update_relational_table' do
|
9
|
+
it 'returns the success as true' do
|
10
|
+
stub_post('/XMLAPI')
|
11
|
+
.with(body: '<Envelope><Body><InsertUpdateRelationalTable><TABLE_ID>86767</TABLE_ID><ROWS><ROW><COLUMN name="Record Id"><![CDATA[GHbjh73643hsdiy]]></COLUMN></ROW></ROWS></InsertUpdateRelationalTable></Body></Envelope>')
|
12
|
+
.to_return status: 200,
|
13
|
+
body: fixture('relational_table.xml'),
|
14
|
+
headers: { 'Content-type' => 'text/xml', 'Authorization' => 'Bearer abc123' }
|
15
|
+
|
16
|
+
resp = @client.insert_update_relational_table '86767', [{'Record Id' => 'GHbjh73643hsdiy'}]
|
17
|
+
|
18
|
+
expect(resp.Envelope.Body.RESULT.SUCCESS).to eq('true')
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Acoustic::Client::Reporting do
|
4
|
+
before do
|
5
|
+
@client = Acoustic.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ".get_sent_mailings_for_org" do
|
9
|
+
it "returns the mailingId for the given dates" do
|
10
|
+
stub_post("/XMLAPI").
|
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", 'Authorization' => 'Bearer abc123'})
|
13
|
+
|
14
|
+
resp = @client.get_sent_mailings_for_org("1/1/2014 00:00:00", "1/2/2014 23:59:59")
|
15
|
+
expect(resp.Envelope.Body.RESULT.Mailing[0].MailingId).to eql "5758"
|
16
|
+
end
|
17
|
+
|
18
|
+
it "returns the mailingId for the given dates when passing an option" do
|
19
|
+
stub_post("/XMLAPI").
|
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", 'Authorization' => 'Bearer abc123'})
|
22
|
+
|
23
|
+
resp = @client.get_sent_mailings_for_org("1/1/2014 00:00:00", "1/2/2014 23:59:59", {PRIVATE: nil})
|
24
|
+
expect(resp.Envelope.Body.RESULT.Mailing[0].MailingId).to eql "5758"
|
25
|
+
end
|
26
|
+
|
27
|
+
it "returns the SentMailingCount" do
|
28
|
+
stub_post("/XMLAPI").
|
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", 'Authorization' => 'Bearer abc123'})
|
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
|
+
expect(resp.Envelope.Body.RESULT.SentMailingsCount).to eql "5758"
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
describe ".raw_recipient_data_export" do
|
39
|
+
it "should return true when passing a MAILING_ID" do
|
40
|
+
stub_post("/XMLAPI").
|
41
|
+
with(:body => "<Envelope><Body><RawRecipientDataExport><MAILING><MAILING_ID>1234</MAILING_ID></MAILING></RawRecipientDataExport></Body></Envelope>").
|
42
|
+
to_return(:status => 200, :body => fixture("reporting.xml"), :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
|
43
|
+
|
44
|
+
|
45
|
+
resp = @client.raw_recipient_data_export({MAILING_ID: 1234})
|
46
|
+
expect(resp.Envelope.Body.RESULT.SUCCESS).to eql "TRUE"
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should return true when passing a REPORT_ID" do
|
50
|
+
stub_post("/XMLAPI").
|
51
|
+
with(:body => "<Envelope><Body><RawRecipientDataExport><MAILING><REPORT_ID>5678</REPORT_ID></MAILING></RawRecipientDataExport></Body></Envelope>").
|
52
|
+
to_return(:status => 200, :body => fixture("reporting.xml"), :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
|
53
|
+
|
54
|
+
|
55
|
+
resp = @client.raw_recipient_data_export({REPORT_ID: 5678})
|
56
|
+
expect(resp.Envelope.Body.RESULT.SUCCESS).to eql "TRUE"
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should return true when passing a EVENT_DATE_START and EVENT_DATE_END" do
|
60
|
+
stub_post("/XMLAPI").
|
61
|
+
with(:body => "<Envelope><Body><RawRecipientDataExport><EVENT_DATE_START>1/1/2013</EVENT_DATE_START><EVENT_DATE_END>7/1/2013</EVENT_DATE_END></RawRecipientDataExport></Body></Envelope>").
|
62
|
+
to_return(:status => 200, :body => fixture("reporting.xml"), :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
|
63
|
+
|
64
|
+
|
65
|
+
resp = @client.raw_recipient_data_export({EVENT_DATE_START: "1/1/2013", EVENT_DATE_END: "7/1/2013"})
|
66
|
+
expect(resp.Envelope.Body.RESULT.SUCCESS).to eql "TRUE"
|
67
|
+
end
|
68
|
+
|
69
|
+
it "should return true when passing options" do
|
70
|
+
stub_post("/XMLAPI").
|
71
|
+
with(:body => "<Envelope><Body><RawRecipientDataExport><MAILING><MAILING_ID>1234</MAILING_ID></MAILING><MOVE_TO_FTP/></RawRecipientDataExport></Body></Envelope>").
|
72
|
+
to_return(:status => 200, :body => fixture("reporting.xml"), :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
|
73
|
+
|
74
|
+
resp = @client.raw_recipient_data_export({MAILING_ID: 1234},{MOVE_TO_FTP: nil})
|
75
|
+
expect(resp.Envelope.Body.RESULT.SUCCESS).to eql "TRUE"
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should return true when passing extra columns to export" do
|
79
|
+
stub_post("/XMLAPI").
|
80
|
+
with(:body => "<Envelope><Body><RawRecipientDataExport><MAILING><MAILING_ID>1234</MAILING_ID></MAILING><COLUMNS><COLUMN><NAME>CustomerID</NAME></COLUMN><COLUMN><NAME>Address</NAME></COLUMN></COLUMNS></RawRecipientDataExport></Body></Envelope>").
|
81
|
+
to_return(:status => 200, :body => fixture("reporting.xml"), :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
|
82
|
+
|
83
|
+
resp = @client.raw_recipient_data_export({MAILING_ID: 1234},{}, ["CustomerID", "Address"])
|
84
|
+
expect(resp.Envelope.Body.RESULT.SUCCESS).to eql "TRUE"
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe ".get_job_status" do
|
89
|
+
it "returns the job_status for the given job_id" do
|
90
|
+
stub_post("/XMLAPI").
|
91
|
+
with(:body => "<Envelope><Body><GetJobStatus><JOB_ID>1234</JOB_ID></GetJobStatus></Body></Envelope>").
|
92
|
+
to_return(:status => 200, :body => '<Envelope><Body><RESULT><SUCCESS>TRUE</SUCCESS>
|
93
|
+
<JOB_ID>1234</JOB_ID><JOB_STATUS>COMPLETE</JOB_STATUS>
|
94
|
+
<JOB_DESCRIPTION> Creating new contact source, Master Database</JOB_DESCRIPTION>
|
95
|
+
<PARAMETERS><PARAMETER><NAME>NOT_ALLOWED</NAME><VALUE>0</VALUE></PARAMETER></PARAMETERS>
|
96
|
+
</RESULT></Body></Envelope>', :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
|
97
|
+
|
98
|
+
|
99
|
+
resp = @client.get_job_status(1234)
|
100
|
+
expect(resp.Envelope.Body.RESULT.JOB_STATUS).to eql "COMPLETE"
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Acoustic::Client::User do
|
4
|
+
before do
|
5
|
+
@client = Acoustic.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ".export_list" do
|
9
|
+
it 'returns the job_id' do
|
10
|
+
stub_post("/XMLAPI").
|
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", 'Authorization' => 'Bearer abc123'})
|
13
|
+
|
14
|
+
resp = @client.export_list('59294', 'ALL', 'CSV')
|
15
|
+
expect(resp.Envelope.Body.RESULT.JOB_ID).to eql "499600"
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'returns the job_id when passing options' do
|
19
|
+
stub_post("/XMLAPI").
|
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", 'Authorization' => 'Bearer abc123'})
|
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
|
+
expect(resp.Envelope.Body.RESULT.JOB_ID).to eql "499600"
|
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").
|
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", 'Authorization' => 'Bearer abc123'})
|
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
|
+
expect(resp.Envelope.Body.RESULT.JOB_ID).to eql "499600"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -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>
|
data/spec/helper.rb
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
unless ENV['CI']
|
2
|
+
require 'simplecov'
|
3
|
+
SimpleCov.start do
|
4
|
+
add_filter 'spec'
|
5
|
+
end
|
6
|
+
end
|
7
|
+
require 'acoustic'
|
8
|
+
require 'rspec'
|
9
|
+
require 'webmock/rspec'
|
10
|
+
require 'pry'
|
11
|
+
|
12
|
+
def stub_post(url)
|
13
|
+
stub_request(:post, acoustic_url(url))
|
14
|
+
end
|
15
|
+
|
16
|
+
def fixture_path
|
17
|
+
File.expand_path("../fixtures", __FILE__)
|
18
|
+
end
|
19
|
+
|
20
|
+
def fixture(file)
|
21
|
+
File.new(fixture_path + '/' + file)
|
22
|
+
end
|
23
|
+
|
24
|
+
def acoustic_url(url)
|
25
|
+
"https://api-campaign-us-1.goacoustic.com#{url}"
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: goacoustic
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Adam Anderson, Upworthy
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-07-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: addressable
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.7'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '1.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: faraday_middleware
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: hashie
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '4.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '4.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: builder
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3.2'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3.2'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: multi_xml
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.6'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.6'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: oauth2
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rdiscount
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: yard
|
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
|
+
description: A Ruby wrapper for the Acoustic API
|
140
|
+
email: adam.anderson@harman.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files: []
|
144
|
+
files:
|
145
|
+
- ".gemtest"
|
146
|
+
- ".gitignore"
|
147
|
+
- ".rspec"
|
148
|
+
- ".travis.yml"
|
149
|
+
- ".yardopts"
|
150
|
+
- Gemfile
|
151
|
+
- LICENSE.md
|
152
|
+
- README.md
|
153
|
+
- Rakefile
|
154
|
+
- goacoustic.gemspec
|
155
|
+
- lib/acoustic.rb
|
156
|
+
- lib/acoustic/client.rb
|
157
|
+
- lib/acoustic/connection.rb
|
158
|
+
- lib/acoustic/request.rb
|
159
|
+
- lib/acoustic/version.rb
|
160
|
+
- lib/client/contact.rb
|
161
|
+
- lib/client/relational_table.rb
|
162
|
+
- lib/client/reporting.rb
|
163
|
+
- lib/client/user.rb
|
164
|
+
- spec/acoustic_spec.rb
|
165
|
+
- spec/client/contact_spec.rb
|
166
|
+
- spec/client/relational_table_spec.rb
|
167
|
+
- spec/client/reporting_spec.rb
|
168
|
+
- spec/client/user_spec.rb
|
169
|
+
- spec/fixtures/contact.xml
|
170
|
+
- spec/fixtures/relational_table.xml
|
171
|
+
- spec/fixtures/reporting.xml
|
172
|
+
- spec/fixtures/sent_mailings_org.xml
|
173
|
+
- spec/helper.rb
|
174
|
+
homepage: http://www.github.com/harman-signal-processing/goacoustic
|
175
|
+
licenses:
|
176
|
+
- BSD-3-Clause
|
177
|
+
metadata: {}
|
178
|
+
post_install_message:
|
179
|
+
rdoc_options: []
|
180
|
+
require_paths:
|
181
|
+
- lib
|
182
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
183
|
+
requirements:
|
184
|
+
- - ">="
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - ">="
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '0'
|
192
|
+
requirements: []
|
193
|
+
rubygems_version: 3.0.6
|
194
|
+
signing_key:
|
195
|
+
specification_version: 4
|
196
|
+
summary: A Ruby wrapper for the Acoustic API
|
197
|
+
test_files:
|
198
|
+
- spec/acoustic_spec.rb
|
199
|
+
- spec/client/contact_spec.rb
|
200
|
+
- spec/client/relational_table_spec.rb
|
201
|
+
- spec/client/reporting_spec.rb
|
202
|
+
- spec/client/user_spec.rb
|
203
|
+
- spec/fixtures/contact.xml
|
204
|
+
- spec/fixtures/relational_table.xml
|
205
|
+
- spec/fixtures/reporting.xml
|
206
|
+
- spec/fixtures/sent_mailings_org.xml
|
207
|
+
- spec/helper.rb
|