goacoustic 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1be8c3589dd5a04b36baefaf5f1afefa1be1d35bcff0b9aeb9190d1aa7718e65
4
- data.tar.gz: 7413c19d7d8a11d8d2a40d1fafdb87ec047f888d7542cf0c71c167e746c6d902
3
+ metadata.gz: a3f302e81b48776bbc4131a0ef4aea3849f6ecef29c12159460a462a0e45d8da
4
+ data.tar.gz: 5a85666558b193c66543a6f7631ef3f201770aaa6fdcebe67a8a8a641159352b
5
5
  SHA512:
6
- metadata.gz: 83b5148cb725a68ab7ba4b8e6224c7947245d43136901f0420b395fdbe9445cd643cc8c9efc9604e97d9183d09a50b4f6fd8f19d6dc6299a5e69bc0f6e2cfc1a
7
- data.tar.gz: 9cc297d2abde9fcc6e27d8a5dd68a91771d5faf0c8852b265806a74b8dc9b4c44fd8396630bf02d29b4f58399790acff1c3ab7bc6214d468a89b74980b08ebf0
6
+ metadata.gz: 4cb24943d0eda6bdc26e3f0f3e9e2ff1edc2c7a9e36e15cfb3d962737d5ec147d9d3116807bae2e29421148212937ad7baf2b7c46864979ab04e7097d74a9abc
7
+ data.tar.gz: 791dcda134bd270e961e9d6c8505aa34922e0192aa100672d5ec250fff69e38f77458424c5bd027d034cc496643527e8c96514a77baa6bf56371ea0e15fa1587
data/README.md CHANGED
@@ -11,14 +11,14 @@ A Ruby wrapper for the Acoustic API
11
11
 
12
12
 
13
13
  ## Usage Examples
14
- require 'acoustic'
14
+ require 'goacoustic'
15
15
  require 'oauth2'
16
16
 
17
17
  #Generate your OAuth2 access token
18
18
  client = OAuth2::Client.new(ACOUSTIC_CLIENT_ID, ACOUSTIC_CLIENT_SECRET, site: "https://api-campaign-us-1.goacoustic.com/oauth/token")
19
19
  access_token = OAuth2::AccessToken.from_hash(client, refresh_token: ACOUSTIC_REFRESH_TOKEN).refresh!
20
20
 
21
- @client = Acoustic.new({access_token: access_token.token, url: "https://api-campaign-us-1.goacoustic.com"})
21
+ @client = GoAcoustic.new({access_token: access_token.token, url: "https://api-campaign-us-1.goacoustic.com"})
22
22
 
23
23
  #add_recipeint
24
24
  #pass in user variables, database contact list, and contact list id
@@ -1,5 +1,5 @@
1
1
  # encoding: utf-8
2
- require File.expand_path('../lib/acoustic/version', __FILE__)
2
+ require File.expand_path('../lib/goacoustic/version', __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.add_dependency 'addressable', '~> 2.7'
@@ -22,5 +22,5 @@ Gem::Specification.new do |gem|
22
22
  gem.require_paths = ['lib']
23
23
  gem.summary = gem.description
24
24
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
25
- gem.version = Acoustic::VERSION
25
+ gem.version = GoAcoustic::VERSION
26
26
  end
@@ -1,15 +1,15 @@
1
- module Acoustic
1
+ module GoAcoustic
2
2
  class Client
3
3
  module Contact
4
4
 
5
5
  # Adds one new contact to an existing database.
6
6
  #
7
- # @param fields [Hash] The list of fields to be passed into Acoustic.
7
+ # @param fields [Hash] The list of fields to be passed into GoAcoustic.
8
8
  # @param list_id [Integer] The ID of the database which you are adding the contact
9
9
  # @param contact_list_id [Array] The id of the contact list.
10
10
  # @return [Mash] Mashify body from the API call
11
11
  # @example Add a new email to the database and contact list
12
- # s = Acoustic::Client.new(access_token)
12
+ # s = GoAcoustic::Client.new(access_token)
13
13
  # s.add_recipient({email: "test@example.com", firstname: "Hello"}, 12345, [4567])
14
14
  def add_recipient(fields, list_id, contact_list_id=nil, created_from=1, options={})
15
15
  builder = Builder::XmlMarkup.new
@@ -1,4 +1,4 @@
1
- module Acoustic
1
+ module GoAcoustic
2
2
  class Client
3
3
  module RelationalTable
4
4
  # InsertUpdateRelationalTable - This interface inserts or updates relational data.
@@ -7,7 +7,7 @@ module Acoustic
7
7
  # @param rows [Array]
8
8
  # @return [Mash] Mashify body from the API call
9
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'
10
+ # s = GoAcoustic.new access_token: 'abc123', url: 'https://api-campaign-us-1.goacoustic.com'
11
11
  # s.insert_update_relational_table '86767', [{'Record Id' => 'GHbjh73643hsdiy'}]
12
12
  def insert_update_relational_table table_id, rows
13
13
  builder = Builder::XmlMarkup.new
@@ -43,7 +43,7 @@ module Acoustic
43
43
  # @param export_colums [Array] XML node used to request specific custom database columns to export for each contact.
44
44
  # @return [Mash] Mashify body from the API call
45
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"})
46
+ # s = GoAcoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
47
47
  # s.export_table('12345', 'CSV', {DATE_START: "1/1/2014", DATE_END:"1/2/2014"})
48
48
  def export_table(table_id, export_format, options={})
49
49
  builder = Builder::XmlMarkup.new
@@ -1,4 +1,4 @@
1
- module Acoustic
1
+ module GoAcoustic
2
2
  class Client
3
3
  module Reporting
4
4
 
@@ -9,7 +9,7 @@ module Acoustic
9
9
  # @param options [Hash] Optional parameters to send
10
10
  # @return [Mash] Mashify body from the API call
11
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"})
12
+ # s = GoAcoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
13
13
  # s.get_sent_mailings_for_org("1/1/2014", "1/2/2014)
14
14
  def get_sent_mailings_for_org(date_start, date_end, options={})
15
15
  builder = Builder::XmlMarkup.new
@@ -36,7 +36,7 @@ module Acoustic
36
36
  # @param columns [Array] Optional list of columns to limit the flat file.
37
37
  # @return [Mash] Mashify body from the API call
38
38
  # @example Export raw data events for mailing id
39
- # s = Acoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
39
+ # s = GoAcoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
40
40
  # s.raw_recipient_data_export({MAILING_ID: 1234},{MOVE_TO_FTP: nil})
41
41
  def raw_recipient_data_export(query_params={}, options={}, columns=[])
42
42
  builder = Builder::XmlMarkup.new
@@ -79,7 +79,7 @@ module Acoustic
79
79
  # @param job_id [Integer] The Job ID of the data job
80
80
  # @return [Mash] Mashify body from the API call
81
81
  # @example Get Job Status for JOB_ID 1234
82
- # s = Acoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
82
+ # s = GoAcoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
83
83
  # s.get_job_status(1234)
84
84
  def get_job_status(job_id)
85
85
  builder = Builder::XmlMarkup.new
@@ -1,4 +1,4 @@
1
- module Acoustic
1
+ module GoAcoustic
2
2
  class Client
3
3
  module User
4
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.
@@ -10,7 +10,7 @@ module Acoustic
10
10
  # @param export_colums [Array] XML node used to request specific custom database columns to export for each contact.
11
11
  # @return [Mash] Mashify body from the API call
12
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"})
13
+ # s = GoAcoustic.new({access_token: "abc123", url: "https://api-campaign-us-1.goacoustic.com"})
14
14
  # s.export_list('12345', 'ALL', 'CSV", {DATE_START: "1/1/2014", DATE_END:"1/2/2014"})
15
15
  def export_list(list_id, export_type, export_format, options={}, export_columns=[])
16
16
  builder = Builder::XmlMarkup.new
@@ -1,15 +1,15 @@
1
- require 'acoustic/client'
1
+ require 'goacoustic/client'
2
2
 
3
- module Acoustic
3
+ module GoAcoustic
4
4
  class << self
5
- # Alias for Acoustic::Client.new
5
+ # Alias for GoAcoustic::Client.new
6
6
  #
7
- # @return [Acoustic::Client]
7
+ # @return [GoAcoustic::Client]
8
8
  def new(options={})
9
- Acoustic::Client.new(options)
9
+ GoAcoustic::Client.new(options)
10
10
  end
11
11
 
12
- # Delegate to Acoustic::Client.new
12
+ # Delegate to GoAcoustic::Client.new
13
13
  def method_missing(method, *args, &block)
14
14
  return super unless new.respond_to?(method)
15
15
  new.send(method, *args, &block)
@@ -0,0 +1,23 @@
1
+ require 'builder'
2
+ require 'goacoustic/connection'
3
+ require 'goacoustic/request'
4
+ require 'client/contact'
5
+ require 'client/reporting'
6
+ require 'client/user'
7
+ require 'client/relational_table'
8
+
9
+ module GoAcoustic
10
+ class Client
11
+ def initialize(options={})
12
+ @access_token = options[:access_token]
13
+ @goacoustic_url = options[:url]
14
+ end
15
+
16
+ include GoAcoustic::Connection
17
+ include GoAcoustic::Request
18
+ include GoAcoustic::Client::Contact
19
+ include GoAcoustic::Client::Reporting
20
+ include GoAcoustic::Client::User
21
+ include GoAcoustic::Client::RelationalTable
22
+ end
23
+ end
@@ -1,12 +1,12 @@
1
1
  require 'faraday_middleware'
2
2
 
3
- module Acoustic
3
+ module GoAcoustic
4
4
  # @private
5
5
  module Connection
6
6
  private
7
7
 
8
8
  def connection(options={})
9
- connection = Faraday.new @acoustic_url do |conn|
9
+ connection = Faraday.new @goacoustic_url do |conn|
10
10
  # Uncomment if want to log to stdout
11
11
  #conn.response :logger
12
12
 
@@ -1,4 +1,4 @@
1
- module Acoustic
1
+ module GoAcoustic
2
2
  module Request
3
3
  def post(body)
4
4
  request(:post, body)
@@ -6,7 +6,7 @@ module Acoustic
6
6
 
7
7
  private
8
8
 
9
- # POST the XML to the Acoustic end point.
9
+ # POST the XML to the GoAcoustic end point.
10
10
  #
11
11
  # @param body [String] The formatted XML of the API call make sure to call builder.to_xml.
12
12
  # @return [XML] XML Body from the API call
@@ -0,0 +1,3 @@
1
+ module GoAcoustic
2
+ VERSION = "0.1.1"
3
+ end
@@ -1,8 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- describe Acoustic::Client::Contact do
3
+ describe GoAcoustic::Client::Contact do
4
4
  before do
5
- @client = Acoustic::Client.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
5
+ @client = GoAcoustic::Client.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
6
6
  end
7
7
 
8
8
  describe "#add_recipient" do
@@ -1,8 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- describe Acoustic::Client::RelationalTable do
3
+ describe GoAcoustic::Client::RelationalTable do
4
4
  before do
5
- @client = Acoustic.new access_token: 'abc123', url: 'https://api-campaign-us-1.goacoustic.com'
5
+ @client = GoAcoustic.new access_token: 'abc123', url: 'https://api-campaign-us-1.goacoustic.com'
6
6
  end
7
7
 
8
8
  describe '.insert_update_relational_table' do
@@ -1,8 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- describe Acoustic::Client::Reporting do
3
+ describe GoAcoustic::Client::Reporting do
4
4
  before do
5
- @client = Acoustic.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
5
+ @client = GoAcoustic.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
6
6
  end
7
7
 
8
8
  describe ".get_sent_mailings_for_org" do
@@ -1,8 +1,8 @@
1
1
  require 'helper'
2
2
 
3
- describe Acoustic::Client::User do
3
+ describe GoAcoustic::Client::User do
4
4
  before do
5
- @client = Acoustic.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
5
+ @client = GoAcoustic.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
6
6
  end
7
7
 
8
8
  describe ".export_list" do
@@ -0,0 +1,15 @@
1
+ require 'helper'
2
+
3
+ describe GoAcoustic do
4
+ describe ".new" do
5
+ it "should be a new GoAcoustic::Client" do
6
+ expect(GoAcoustic.new).to be_a GoAcoustic::Client
7
+ end
8
+ end
9
+
10
+ describe ".respond_to?" do
11
+ pending it "should be true if method exists" do
12
+ expect(GoAcoustic.respond_to?(:new, true)).to be_true
13
+ end
14
+ end
15
+ end
@@ -4,13 +4,13 @@ unless ENV['CI']
4
4
  add_filter 'spec'
5
5
  end
6
6
  end
7
- require 'acoustic'
7
+ require 'goacoustic'
8
8
  require 'rspec'
9
9
  require 'webmock/rspec'
10
10
  require 'pry'
11
11
 
12
12
  def stub_post(url)
13
- stub_request(:post, acoustic_url(url))
13
+ stub_request(:post, goacoustic_url(url))
14
14
  end
15
15
 
16
16
  def fixture_path
@@ -21,6 +21,6 @@ def fixture(file)
21
21
  File.new(fixture_path + '/' + file)
22
22
  end
23
23
 
24
- def acoustic_url(url)
24
+ def goacoustic_url(url)
25
25
  "https://api-campaign-us-1.goacoustic.com#{url}"
26
26
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goacoustic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Anderson, Upworthy
@@ -152,16 +152,15 @@ files:
152
152
  - README.md
153
153
  - Rakefile
154
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
155
  - lib/client/contact.rb
161
156
  - lib/client/relational_table.rb
162
157
  - lib/client/reporting.rb
163
158
  - lib/client/user.rb
164
- - spec/acoustic_spec.rb
159
+ - lib/goacoustic.rb
160
+ - lib/goacoustic/client.rb
161
+ - lib/goacoustic/connection.rb
162
+ - lib/goacoustic/request.rb
163
+ - lib/goacoustic/version.rb
165
164
  - spec/client/contact_spec.rb
166
165
  - spec/client/relational_table_spec.rb
167
166
  - spec/client/reporting_spec.rb
@@ -170,6 +169,7 @@ files:
170
169
  - spec/fixtures/relational_table.xml
171
170
  - spec/fixtures/reporting.xml
172
171
  - spec/fixtures/sent_mailings_org.xml
172
+ - spec/goacoustic_spec.rb
173
173
  - spec/helper.rb
174
174
  homepage: http://www.github.com/harman-signal-processing/goacoustic
175
175
  licenses:
@@ -195,7 +195,6 @@ signing_key:
195
195
  specification_version: 4
196
196
  summary: A Ruby wrapper for the Acoustic API
197
197
  test_files:
198
- - spec/acoustic_spec.rb
199
198
  - spec/client/contact_spec.rb
200
199
  - spec/client/relational_table_spec.rb
201
200
  - spec/client/reporting_spec.rb
@@ -204,4 +203,5 @@ test_files:
204
203
  - spec/fixtures/relational_table.xml
205
204
  - spec/fixtures/reporting.xml
206
205
  - spec/fixtures/sent_mailings_org.xml
206
+ - spec/goacoustic_spec.rb
207
207
  - spec/helper.rb
@@ -1,23 +0,0 @@
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
@@ -1,3 +0,0 @@
1
- module Acoustic
2
- VERSION = "0.1.0"
3
- end
@@ -1,15 +0,0 @@
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