require 'helper'
describe GoAcoustic::Client::User do
before do
@client = GoAcoustic.new({access_token: "abc123",url: 'https://api-campaign-us-1.goacoustic.com'})
end
describe ".export_list" do
it 'returns the job_id' do
stub_post("/XMLAPI").
with(:body => "59294ALLCSV").
to_return(:status => 200, :body => "TRUE499600file.CSV", :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
resp = @client.export_list('59294', 'ALL', 'CSV')
expect(resp.Envelope.Body.RESULT.JOB_ID).to eql "499600"
end
it 'returns the job_id when passing options' do
stub_post("/XMLAPI").
with(:body => "59294ALLCSV07/25/2011 12:12:1109/30/2011 14:14:11FIRST_NAMEINITIALLAST_NAME").
to_return(:status => 200, :body => "TRUE499600file.CSV", :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
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"])
expect(resp.Envelope.Body.RESULT.JOB_ID).to eql "499600"
end
end
describe ".export_table" do
it 'returns the job_id of the relational table' do
stub_post("/XMLAPI").
with(:body => "59294CSV07/25/2011 12:12:1109/30/2011 14:14:11").
to_return(:status => 200, :body => "TRUE499600file.CSV", :headers => {'Content-type' => "text/xml", 'Authorization' => 'Bearer abc123'})
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"})
expect(resp.Envelope.Body.RESULT.JOB_ID).to eql "499600"
end
end
end