Git Product home page Git Product logo

email_direct's People

Contributors

wynst avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

email_direct's Issues

Email_AddWithFields doesn't set lists, publications nor custom fields

When using Email_AddWithFields, the lists, publications and custom fields aren't being set.

require 'rubygems'
require 'email_direct'

username = 'username'
password = 'password'

@soap = EmailDirect::SOAP.new(username, password)
#uncomment this line for full debug info
#@soap.debug = true

result = @soap.Source_GetAll()
source_id = result.data["Element"].first["ElementID"]

# create some publication
@soap.Publication_Add("ElementName" => "Publication1", "Description" => "publication 1 info")
@soap.Publication_Add("ElementName" => "Publication2", "Description" => "publication 2 info")

result = @soap.Publication_GetAll()
publication_id1 = result.data["Element"][0]["ElementID"]
publication_id2 = result.data["Element"][1]["ElementID"]

# create some list
result = @soap.List_Add("ElementName" => "List1", "Description" => "List 1 info")
result = @soap.List_Add("ElementName" => "List2", "Description" => "List 2 info")

result = @soap.List_GetAll()
list_id1 = result.data["Element"][0]["ElementID"]
list_id2 = result.data["Element"][1]["ElementID"]

result = @soap.Email_AddWithFields(
  "Email" => "[email protected]",
  "SourceID" => source_id,
  "Publications" => [
      {"int" => publication_id1},
      {"int" => publication_id2}
    ],
    "Lists" => [
      {"int" => list_id1},
      {"int" => list_id2}
    ],
    "AutoResponderID" => 0,
    "Force" => "false",
    "CustomFields" => [
      {
        "FieldName" => "FirstName",
        "Value" => "Jason"
      }, {
        "FieldName" => "LastName",
        "Value" => "Red"
      }
    ])

puts result.message
# Success

result = @soap.Email_GetProperties("Email" => "[email protected]")
p result.data
# {"Status"=>"Active", "Lists"=>nil, "CreateDate"=>"2011-04-25T21:00:00", "EmailID"=>"2",
#  "DateStamp"=>"2011-04-25T21:00:00", "IPAddress"=>nil, "Source"=>{"ElementID"=>"126",
#  "Description"=>"a description.", "ElementName"=>"name581090"}, "Publications"=>nil,
#  "Email"=>"[email protected]", "CustomFields"=>{"CustomField"=>[
#    {"FieldName"=>"Email", "Value"=>"[email protected]"}, {"FieldName"=>"IPAddress", "Value"=>nil},
#    {"FieldName"=>"DateStamp", "Value"=>"4/25/2011"}, {"FieldName"=>"FirstName", "Value"=>nil},
#    {"FieldName"=>"LastName", "Value"=>nil}, {"FieldName"=>"Gender", "Value"=>nil},
#    {"FieldName"=>"Address", "Value"=>nil}, {"FieldName"=>"City", "Value"=>nil},
#    {"FieldName"=>"State", "Value"=>nil}, {"FieldName"=>"Zip", "Value"=>nil},
#    {"FieldName"=>"Phone", "Value"=>nil}, {"FieldName"=>"Fax", "Value"=>nil},
#    {"FieldName"=>"Age", "Value"=>nil}, {"FieldName"=>"SourceCode", "Value"=>nil},
#    {"FieldName"=>"Domain", "Value"=>nil}, {"FieldName"=>"CampusList", "Value"=>nil},
#    {"FieldName"=>"VendorCode", "Value"=>nil}, {"FieldName"=>"LeadStatus", "Value"=>nil}]}}

cannot create/delete/create a list with the same name

require 'rubygems'
require 'email_direct'

username = 'username'
password = 'password'

@soap = EmailDirect::SOAP.new(username, password)

list_name = 'List1021'
list_description = 'none.'

result = @soap.List_Add("ElementName" => list_name, "Description" => list_description)
p result.success?
# true

result = @soap.List_GetAll()
p result.data
# {"Element"=>{"ElementID"=>"<some number>", "Description"=>"none.", "ElementName"=>"List1010"}}
list_id = result.data['Element']['ElementID']

# delete the list
result = @soap.List_Delete('ListID' => list_id)
p result.success?
# true


# check
result = @soap.List_GetAll()
p result.data
# nil


# recreating the same list
result = @soap.List_Add("ElementName" => list_name, "Description" => list_description)
p result.success?
# false
p result.message
# "A List with this name already exists."

# there are no lists with this name!
# the web interface doesn't show this list either and if I try to create it on the web interface, it will work.

inconsistent type of result.data['Element']

require 'rubygems'
require 'email_direct'

username = 'username'
password = 'password'

@soap = EmailDirect::SOAP.new(username, password)

result = @soap.List_Add("ElementName" => "List100", "Description" => "List 1 info")
result = @soap.List_GetAll()
p result.data
#{"Element"=>{"ElementID"=>"27", "Description"=>"List 1 info", "ElementName"=>"List100"}}


result = @soap.List_Add("ElementName" => "List200", "Description" => "List 2 info")
result = @soap.List_GetAll()
p result.data
#{"Element"=>[{"ElementID"=>"27", "Description"=>"List 1 info", "ElementName"=>"List100"}, {"ElementID"=>"28", "Description"=>"List 2 info", "ElementName"=>"List200"}]}


# the result.data['Element'] type is a hash if there is only 1 list and a list if there is more than 1 list (!)
# to be consistent, it should be always a list
# {"Element"=>[{"ElementID"=>"27", "Description"=>"List 1 info", "ElementName"=>"List100"}}]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.