Skip to content
Browse files

Changes to Client.GetCampaigns and List.GetStats

  • Loading branch information...
1 parent a75fba9 commit 4dd053422609973fc5d3d3daaf0d760a46072a83 Marcelo Menezes committed Nov 30, 2009
View
8 lib/campaigning/campaign.rb
@@ -8,13 +8,15 @@ class Campaign
include ModuleMixin
attr_accessor :campaignID
attr_accessor :subject
+ attr_accessor :name
attr_accessor :sentDate
attr_accessor :totalRecipients
-
- def initialize(campaignID = nil, subject = nil, sentDate = nil, totalRecipients = nil, opts={})
+
+ def initialize(campaignID = nil, subject = nil, name = nil, sentDate = nil, totalRecipients = nil, opts={})
@apiKey = opts[:apiKey] || CAMPAIGN_MONITOR_API_KEY
@campaignID = campaignID
@subject = subject
+ @name = name
@sentDate = sentDate
@totalRecipients = totalRecipients
end
@@ -59,7 +61,7 @@ def self.create!(params)
)
campaign_id = handle_response response.campaign_CreateResult
- Campaign.new( campaign_id, nil, nil, nil, :apiKey=> (params[:apiKey] || CAMPAIGN_MONITOR_API_KEY) )
+ Campaign.new( campaign_id, nil, params[:campaignName], nil, nil, :apiKey=> (params[:apiKey] || CAMPAIGN_MONITOR_API_KEY) )
end
#Deletes an existing campaign.
View
2 lib/campaigning/client.rb
@@ -196,7 +196,7 @@ def campaigns
response = @@soap.getClientCampaigns(:apiKey => @apiKey, :clientID => @clientID )
campaign_list = handle_response response.client_GetCampaignsResult
campaign_list.collect do |campaign|
- Campaign.new(campaign.campaignID, campaign.subject, campaign.sentDate, campaign.totalRecipients, :apiKey=> @apiKey)
+ Campaign.new(campaign.campaignID, campaign.subject, campaign.name, campaign.sentDate, campaign.totalRecipients, :apiKey=> @apiKey)
end
end
View
33 lib/campaigning/list.rb
@@ -97,6 +97,39 @@ def self.delete!(list_id, opts={})
response = @@soap.deleteList(:apiKey => opts[:apiKey] || CAMPAIGN_MONITOR_API_KEY, :listID => list_id)
handle_response response.list_DeleteResult
end
+
+ #Gets statistics for a subscriber list
+ #
+ #*Return*:
+ #
+ #*Success*: A successful call to List.GetStats will return a ListStatistics object, consisting of TotalActiveSubscribers,
+ #NewActiveSubscribersToday, NewActiveSubscribersYesterday, NewActiveSubscribersThisWeek, NewActiveSubscribersThisMonth,
+ #NewActiveSubscribersThisYear, TotalUnsubscribes, UnsubscribesToday, UnsubscribesYesterday, UnsubscribesThisWeek,
+ #UnsubscribesThisMonth, UnsubscribesThisYear, TotalDeleted, DeletedToday, DeletedYesterday, DeletedThisWeek, DeletedThisMonth,
+ #DeletedThisYear, TotalBounces, BouncesToday, BouncesYesterday, BouncesThisWeek, BouncesThisMonth and BouncesThisYear.
+ #
+ #*Error*: An Exception containing the cause of the error will be raised.
+ def stats
+ List.stats(@listID, :apiKey=> @apiKey)
+ end
+
+
+ #Gets statistics for a subscriber list
+ #
+ #*Return*:
+ #
+ #*Success*: A successful call to List.GetStats will return a ListStatistics object, consisting of TotalActiveSubscribers,
+ #NewActiveSubscribersToday, NewActiveSubscribersYesterday, NewActiveSubscribersThisWeek, NewActiveSubscribersThisMonth,
+ #NewActiveSubscribersThisYear, TotalUnsubscribes, UnsubscribesToday, UnsubscribesYesterday, UnsubscribesThisWeek,
+ #UnsubscribesThisMonth, UnsubscribesThisYear, TotalDeleted, DeletedToday, DeletedYesterday, DeletedThisWeek, DeletedThisMonth,
+ #DeletedThisYear, TotalBounces, BouncesToday, BouncesYesterday, BouncesThisWeek, BouncesThisMonth and BouncesThisYear.
+ #
+ #*Error*: An Exception containing the cause of the error will be raised.
+ def self.stats(list_id, opts={})
+ response = @@soap.getListStats(:apiKey => opts[:apiKey] || CAMPAIGN_MONITOR_API_KEY, :listID => list_id)
+ handle_response response.list_GetStatsResult
+ end
+
#Deletes a custom field from a list
#
View
167 lib/campaigning/soap/generated/default.rb
@@ -3,23 +3,6 @@
module Campaigning
-# {http://api.createsend.com/api/}ArrayOfSubscriberCustomField
-class ArrayOfSubscriberCustomField < ::Array
-end
-
-# {http://api.createsend.com/api/}SubscriberCustomField
-# key - SOAP::SOAPString
-# value - SOAP::SOAPString
-class SubscriberCustomField
- attr_accessor :key
- attr_accessor :value
-
- def initialize(key = nil, value = nil)
- @key = key
- @value = value
- end
-end
-
# {http://api.createsend.com/api/}Result
# code - SOAP::SOAPInt
# message - SOAP::SOAPString
@@ -250,22 +233,104 @@ def initialize(listID = nil, name = nil)
# {http://api.createsend.com/api/}Campaign
# campaignID - SOAP::SOAPString
# subject - SOAP::SOAPString
+# name - SOAP::SOAPString
# sentDate - SOAP::SOAPString
# totalRecipients - SOAP::SOAPInt
class Campaign
attr_accessor :campaignID
attr_accessor :subject
+ attr_accessor :name
attr_accessor :sentDate
attr_accessor :totalRecipients
- def initialize(campaignID = nil, subject = nil, sentDate = nil, totalRecipients = nil)
+ def initialize(campaignID = nil, subject = nil, name = nil, sentDate = nil, totalRecipients = nil)
@campaignID = campaignID
@subject = subject
+ @name = name
@sentDate = sentDate
@totalRecipients = totalRecipients
end
end
+# {http://api.createsend.com/api/}ListStatistics
+# totalActiveSubscribers - SOAP::SOAPInt
+# newActiveSubscribersToday - SOAP::SOAPInt
+# newActiveSubscribersYesterday - SOAP::SOAPInt
+# newActiveSubscribersThisWeek - SOAP::SOAPInt
+# newActiveSubscribersThisMonth - SOAP::SOAPInt
+# newActiveSubscribersThisYear - SOAP::SOAPInt
+# totalUnsubscribes - SOAP::SOAPInt
+# unsubscribesToday - SOAP::SOAPInt
+# unsubscribesYesterday - SOAP::SOAPInt
+# unsubscribesThisWeek - SOAP::SOAPInt
+# unsubscribesThisMonth - SOAP::SOAPInt
+# unsubscribesThisYear - SOAP::SOAPInt
+# totalDeleted - SOAP::SOAPInt
+# deletedToday - SOAP::SOAPInt
+# deletedYesterday - SOAP::SOAPInt
+# deletedThisWeek - SOAP::SOAPInt
+# deletedThisMonth - SOAP::SOAPInt
+# deletedThisYear - SOAP::SOAPInt
+# totalBounces - SOAP::SOAPInt
+# bouncesToday - SOAP::SOAPInt
+# bouncesYesterday - SOAP::SOAPInt
+# bouncesThisWeek - SOAP::SOAPInt
+# bouncesThisMonth - SOAP::SOAPInt
+# bouncesThisYear - SOAP::SOAPInt
+class ListStatistics
+ attr_accessor :totalActiveSubscribers
+ attr_accessor :newActiveSubscribersToday
+ attr_accessor :newActiveSubscribersYesterday
+ attr_accessor :newActiveSubscribersThisWeek
+ attr_accessor :newActiveSubscribersThisMonth
+ attr_accessor :newActiveSubscribersThisYear
+ attr_accessor :totalUnsubscribes
+ attr_accessor :unsubscribesToday
+ attr_accessor :unsubscribesYesterday
+ attr_accessor :unsubscribesThisWeek
+ attr_accessor :unsubscribesThisMonth
+ attr_accessor :unsubscribesThisYear
+ attr_accessor :totalDeleted
+ attr_accessor :deletedToday
+ attr_accessor :deletedYesterday
+ attr_accessor :deletedThisWeek
+ attr_accessor :deletedThisMonth
+ attr_accessor :deletedThisYear
+ attr_accessor :totalBounces
+ attr_accessor :bouncesToday
+ attr_accessor :bouncesYesterday
+ attr_accessor :bouncesThisWeek
+ attr_accessor :bouncesThisMonth
+ attr_accessor :bouncesThisYear
+
+ def initialize(totalActiveSubscribers = nil, newActiveSubscribersToday = nil, newActiveSubscribersYesterday = nil, newActiveSubscribersThisWeek = nil, newActiveSubscribersThisMonth = nil, newActiveSubscribersThisYear = nil, totalUnsubscribes = nil, unsubscribesToday = nil, unsubscribesYesterday = nil, unsubscribesThisWeek = nil, unsubscribesThisMonth = nil, unsubscribesThisYear = nil, totalDeleted = nil, deletedToday = nil, deletedYesterday = nil, deletedThisWeek = nil, deletedThisMonth = nil, deletedThisYear = nil, totalBounces = nil, bouncesToday = nil, bouncesYesterday = nil, bouncesThisWeek = nil, bouncesThisMonth = nil, bouncesThisYear = nil)
+ @totalActiveSubscribers = totalActiveSubscribers
+ @newActiveSubscribersToday = newActiveSubscribersToday
+ @newActiveSubscribersYesterday = newActiveSubscribersYesterday
+ @newActiveSubscribersThisWeek = newActiveSubscribersThisWeek
+ @newActiveSubscribersThisMonth = newActiveSubscribersThisMonth
+ @newActiveSubscribersThisYear = newActiveSubscribersThisYear
+ @totalUnsubscribes = totalUnsubscribes
+ @unsubscribesToday = unsubscribesToday
+ @unsubscribesYesterday = unsubscribesYesterday
+ @unsubscribesThisWeek = unsubscribesThisWeek
+ @unsubscribesThisMonth = unsubscribesThisMonth
+ @unsubscribesThisYear = unsubscribesThisYear
+ @totalDeleted = totalDeleted
+ @deletedToday = deletedToday
+ @deletedYesterday = deletedYesterday
+ @deletedThisWeek = deletedThisWeek
+ @deletedThisMonth = deletedThisMonth
+ @deletedThisYear = deletedThisYear
+ @totalBounces = totalBounces
+ @bouncesToday = bouncesToday
+ @bouncesYesterday = bouncesYesterday
+ @bouncesThisWeek = bouncesThisWeek
+ @bouncesThisMonth = bouncesThisMonth
+ @bouncesThisYear = bouncesThisYear
+ end
+end
+
# {http://api.createsend.com/api/}ListCustomField
# fieldName - SOAP::SOAPString
# key - SOAP::SOAPString
@@ -333,6 +398,23 @@ def initialize(emailAddress = nil, name = nil, date = nil, state = nil, customFi
end
end
+# {http://api.createsend.com/api/}ArrayOfSubscriberCustomField
+class ArrayOfSubscriberCustomField < ::Array
+end
+
+# {http://api.createsend.com/api/}SubscriberCustomField
+# key - SOAP::SOAPString
+# value - SOAP::SOAPString
+class SubscriberCustomField
+ attr_accessor :key
+ attr_accessor :value
+
+ def initialize(key = nil, value = nil)
+ @key = key
+ @value = value
+ end
+end
+
# {http://api.createsend.com/api/}ArrayOfSubscriber
class ArrayOfSubscriber < ::Array
end
@@ -381,6 +463,32 @@ class SubscriberFieldDataType < ::String
Text = SubscriberFieldDataType.new("Text")
end
+# {http://api.createsend.com/api/}User.GetApiKey
+# siteUrl - SOAP::SOAPString
+# username - SOAP::SOAPString
+# password - SOAP::SOAPString
+class UserGetApiKey
+ attr_accessor :siteUrl
+ attr_accessor :username
+ attr_accessor :password
+
+ def initialize(siteUrl = nil, username = nil, password = nil)
+ @siteUrl = siteUrl
+ @username = username
+ @password = password
+ end
+end
+
+# {http://api.createsend.com/api/}User.GetApiKeyResponse
+# user_GetApiKeyResult - (any)
+class UserGetApiKeyResponse
+ attr_accessor :user_GetApiKeyResult
+
+ def initialize(user_GetApiKeyResult = nil)
+ @user_GetApiKeyResult = user_GetApiKeyResult
+ end
+end
+
# {http://api.createsend.com/api/}Subscriber.AddWithCustomFields
# apiKey - SOAP::SOAPString
# listID - SOAP::SOAPString
@@ -856,6 +964,29 @@ def initialize(list_CreateCustomFieldResult = nil)
end
end
+# {http://api.createsend.com/api/}List.GetStats
+# apiKey - SOAP::SOAPString
+# listID - SOAP::SOAPString
+class ListGetStats
+ attr_accessor :apiKey
+ attr_accessor :listID
+
+ def initialize(apiKey = nil, listID = nil)
+ @apiKey = apiKey
+ @listID = listID
+ end
+end
+
+# {http://api.createsend.com/api/}List.GetStatsResponse
+# list_GetStatsResult - (any)
+class ListGetStatsResponse
+ attr_accessor :list_GetStatsResult
+
+ def initialize(list_GetStatsResult = nil)
+ @list_GetStatsResult = list_GetStatsResult
+ end
+end
+
# {http://api.createsend.com/api/}Client.GetCampaigns
# apiKey - SOAP::SOAPString
# clientID - SOAP::SOAPString
View
16 lib/campaigning/soap/generated/defaultDriver.rb
@@ -8,6 +8,14 @@ class ApiSoap < ::SOAP::RPC::Driver
DefaultEndpointUrl = "http://api.createsend.com/api/api.asmx"
Methods = [
+ [ "http://api.createsend.com/api/User.GetApiKey",
+ "getApiKey",
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetApiKey"]],
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "User.GetApiKeyResponse"]] ],
+ { :request_style => :document, :request_use => :literal,
+ :response_style => :document, :response_use => :literal,
+ :faults => {} }
+ ],
[ "http://api.createsend.com/api/Subscriber.AddWithCustomFields",
"addSubscriberWithCustomFields",
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Subscriber.AddWithCustomFields"]],
@@ -144,6 +152,14 @@ class ApiSoap < ::SOAP::RPC::Driver
:response_style => :document, :response_use => :literal,
:faults => {} }
],
+ [ "http://api.createsend.com/api/List.GetStats",
+ "getListStats",
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.GetStats"]],
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "List.GetStatsResponse"]] ],
+ { :request_style => :document, :request_use => :literal,
+ :response_style => :document, :response_use => :literal,
+ :faults => {} }
+ ],
[ "http://api.createsend.com/api/Client.GetCampaigns",
"getClientCampaigns",
[ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.createsend.com/api/", "Client.GetCampaigns"]],
View
168 lib/campaigning/soap/generated/defaultMappingRegistry.rb
@@ -9,23 +9,6 @@ module DefaultMappingRegistry
NsApi = "http://api.createsend.com/api/"
EncodedRegistry.register(
- :class => Campaigning::ArrayOfSubscriberCustomField,
- :schema_type => XSD::QName.new(NsApi, "ArrayOfSubscriberCustomField"),
- :schema_element => [
- ["subscriberCustomField", ["Campaigning::SubscriberCustomField[]", XSD::QName.new(NsApi, "SubscriberCustomField")], [0, nil]]
- ]
- )
-
- EncodedRegistry.register(
- :class => Campaigning::SubscriberCustomField,
- :schema_type => XSD::QName.new(NsApi, "SubscriberCustomField"),
- :schema_element => [
- ["key", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Key")], [0, 1]],
- ["value", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Value")], [0, 1]]
- ]
- )
-
- EncodedRegistry.register(
:class => Campaigning::Result,
:schema_type => XSD::QName.new(NsApi, "Result"),
:schema_element => [
@@ -174,12 +157,44 @@ module DefaultMappingRegistry
:schema_element => [
["campaignID", ["SOAP::SOAPString", XSD::QName.new(NsApi, "CampaignID")], [0, 1]],
["subject", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Subject")], [0, 1]],
+ ["name", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Name")], [0, 1]],
["sentDate", ["SOAP::SOAPString", XSD::QName.new(NsApi, "SentDate")], [0, 1]],
["totalRecipients", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalRecipients")]]
]
)
EncodedRegistry.register(
+ :class => Campaigning::ListStatistics,
+ :schema_type => XSD::QName.new(NsApi, "ListStatistics"),
+ :schema_element => [
+ ["totalActiveSubscribers", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalActiveSubscribers")]],
+ ["newActiveSubscribersToday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersToday")]],
+ ["newActiveSubscribersYesterday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersYesterday")]],
+ ["newActiveSubscribersThisWeek", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersThisWeek")]],
+ ["newActiveSubscribersThisMonth", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersThisMonth")]],
+ ["newActiveSubscribersThisYear", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersThisYear")]],
+ ["totalUnsubscribes", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalUnsubscribes")]],
+ ["unsubscribesToday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesToday")]],
+ ["unsubscribesYesterday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesYesterday")]],
+ ["unsubscribesThisWeek", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesThisWeek")]],
+ ["unsubscribesThisMonth", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesThisMonth")]],
+ ["unsubscribesThisYear", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesThisYear")]],
+ ["totalDeleted", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalDeleted")]],
+ ["deletedToday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedToday")]],
+ ["deletedYesterday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedYesterday")]],
+ ["deletedThisWeek", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedThisWeek")]],
+ ["deletedThisMonth", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedThisMonth")]],
+ ["deletedThisYear", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedThisYear")]],
+ ["totalBounces", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalBounces")]],
+ ["bouncesToday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesToday")]],
+ ["bouncesYesterday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesYesterday")]],
+ ["bouncesThisWeek", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesThisWeek")]],
+ ["bouncesThisMonth", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesThisMonth")]],
+ ["bouncesThisYear", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesThisYear")]]
+ ]
+ )
+
+ EncodedRegistry.register(
:class => Campaigning::ListCustomField,
:schema_type => XSD::QName.new(NsApi, "ListCustomField"),
:schema_element => [
@@ -223,6 +238,23 @@ module DefaultMappingRegistry
)
EncodedRegistry.register(
+ :class => Campaigning::ArrayOfSubscriberCustomField,
+ :schema_type => XSD::QName.new(NsApi, "ArrayOfSubscriberCustomField"),
+ :schema_element => [
+ ["subscriberCustomField", ["Campaigning::SubscriberCustomField[]", XSD::QName.new(NsApi, "SubscriberCustomField")], [0, nil]]
+ ]
+ )
+
+ EncodedRegistry.register(
+ :class => Campaigning::SubscriberCustomField,
+ :schema_type => XSD::QName.new(NsApi, "SubscriberCustomField"),
+ :schema_element => [
+ ["key", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Key")], [0, 1]],
+ ["value", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Value")], [0, 1]]
+ ]
+ )
+
+ EncodedRegistry.register(
:class => Campaigning::ArrayOfSubscriber,
:schema_type => XSD::QName.new(NsApi, "ArrayOfSubscriber"),
:schema_element => [
@@ -308,23 +340,6 @@ module DefaultMappingRegistry
)
LiteralRegistry.register(
- :class => Campaigning::ArrayOfSubscriberCustomField,
- :schema_type => XSD::QName.new(NsApi, "ArrayOfSubscriberCustomField"),
- :schema_element => [
- ["subscriberCustomField", ["Campaigning::SubscriberCustomField[]", XSD::QName.new(NsApi, "SubscriberCustomField")], [0, nil]]
- ]
- )
-
- LiteralRegistry.register(
- :class => Campaigning::SubscriberCustomField,
- :schema_type => XSD::QName.new(NsApi, "SubscriberCustomField"),
- :schema_element => [
- ["key", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Key")], [0, 1]],
- ["value", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Value")], [0, 1]]
- ]
- )
-
- LiteralRegistry.register(
:class => Campaigning::Result,
:schema_type => XSD::QName.new(NsApi, "Result"),
:schema_element => [
@@ -473,12 +488,44 @@ module DefaultMappingRegistry
:schema_element => [
["campaignID", ["SOAP::SOAPString", XSD::QName.new(NsApi, "CampaignID")], [0, 1]],
["subject", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Subject")], [0, 1]],
+ ["name", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Name")], [0, 1]],
["sentDate", ["SOAP::SOAPString", XSD::QName.new(NsApi, "SentDate")], [0, 1]],
["totalRecipients", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalRecipients")]]
]
)
LiteralRegistry.register(
+ :class => Campaigning::ListStatistics,
+ :schema_type => XSD::QName.new(NsApi, "ListStatistics"),
+ :schema_element => [
+ ["totalActiveSubscribers", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalActiveSubscribers")]],
+ ["newActiveSubscribersToday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersToday")]],
+ ["newActiveSubscribersYesterday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersYesterday")]],
+ ["newActiveSubscribersThisWeek", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersThisWeek")]],
+ ["newActiveSubscribersThisMonth", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersThisMonth")]],
+ ["newActiveSubscribersThisYear", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "NewActiveSubscribersThisYear")]],
+ ["totalUnsubscribes", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalUnsubscribes")]],
+ ["unsubscribesToday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesToday")]],
+ ["unsubscribesYesterday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesYesterday")]],
+ ["unsubscribesThisWeek", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesThisWeek")]],
+ ["unsubscribesThisMonth", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesThisMonth")]],
+ ["unsubscribesThisYear", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "UnsubscribesThisYear")]],
+ ["totalDeleted", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalDeleted")]],
+ ["deletedToday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedToday")]],
+ ["deletedYesterday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedYesterday")]],
+ ["deletedThisWeek", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedThisWeek")]],
+ ["deletedThisMonth", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedThisMonth")]],
+ ["deletedThisYear", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "DeletedThisYear")]],
+ ["totalBounces", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "TotalBounces")]],
+ ["bouncesToday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesToday")]],
+ ["bouncesYesterday", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesYesterday")]],
+ ["bouncesThisWeek", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesThisWeek")]],
+ ["bouncesThisMonth", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesThisMonth")]],
+ ["bouncesThisYear", ["SOAP::SOAPInt", XSD::QName.new(NsApi, "BouncesThisYear")]]
+ ]
+ )
+
+ LiteralRegistry.register(
:class => Campaigning::ListCustomField,
:schema_type => XSD::QName.new(NsApi, "ListCustomField"),
:schema_element => [
@@ -522,6 +569,23 @@ module DefaultMappingRegistry
)
LiteralRegistry.register(
+ :class => Campaigning::ArrayOfSubscriberCustomField,
+ :schema_type => XSD::QName.new(NsApi, "ArrayOfSubscriberCustomField"),
+ :schema_element => [
+ ["subscriberCustomField", ["Campaigning::SubscriberCustomField[]", XSD::QName.new(NsApi, "SubscriberCustomField")], [0, nil]]
+ ]
+ )
+
+ LiteralRegistry.register(
+ :class => Campaigning::SubscriberCustomField,
+ :schema_type => XSD::QName.new(NsApi, "SubscriberCustomField"),
+ :schema_element => [
+ ["key", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Key")], [0, 1]],
+ ["value", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Value")], [0, 1]]
+ ]
+ )
+
+ LiteralRegistry.register(
:class => Campaigning::ArrayOfSubscriber,
:schema_type => XSD::QName.new(NsApi, "ArrayOfSubscriber"),
:schema_element => [
@@ -607,6 +671,24 @@ module DefaultMappingRegistry
)
LiteralRegistry.register(
+ :class => Campaigning::UserGetApiKey,
+ :schema_name => XSD::QName.new(NsApi, "User.GetApiKey"),
+ :schema_element => [
+ ["siteUrl", ["SOAP::SOAPString", XSD::QName.new(NsApi, "SiteUrl")], [0, 1]],
+ ["username", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Username")], [0, 1]],
+ ["password", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Password")], [0, 1]]
+ ]
+ )
+
+ LiteralRegistry.register(
+ :class => Campaigning::UserGetApiKeyResponse,
+ :schema_name => XSD::QName.new(NsApi, "User.GetApiKeyResponse"),
+ :schema_element => [
+ ["user_GetApiKeyResult", [nil, XSD::QName.new(NsApi, "User.GetApiKeyResult")], [0, 1]]
+ ]
+ )
+
+ LiteralRegistry.register(
:class => Campaigning::SubscriberAddWithCustomFields,
:schema_name => XSD::QName.new(NsApi, "Subscriber.AddWithCustomFields"),
:schema_element => [
@@ -924,6 +1006,23 @@ module DefaultMappingRegistry
)
LiteralRegistry.register(
+ :class => Campaigning::ListGetStats,
+ :schema_name => XSD::QName.new(NsApi, "List.GetStats"),
+ :schema_element => [
+ ["apiKey", ["SOAP::SOAPString", XSD::QName.new(NsApi, "ApiKey")], [0, 1]],
+ ["listID", ["SOAP::SOAPString", XSD::QName.new(NsApi, "ListID")], [0, 1]]
+ ]
+ )
+
+ LiteralRegistry.register(
+ :class => Campaigning::ListGetStatsResponse,
+ :schema_name => XSD::QName.new(NsApi, "List.GetStatsResponse"),
+ :schema_element => [
+ ["list_GetStatsResult", [nil, XSD::QName.new(NsApi, "List.GetStatsResult")], [0, 1]]
+ ]
+ )
+
+ LiteralRegistry.register(
:class => Campaigning::ClientGetCampaigns,
:schema_name => XSD::QName.new(NsApi, "Client.GetCampaigns"),
:schema_element => [
@@ -1422,7 +1521,6 @@ module DefaultMappingRegistry
["message", ["SOAP::SOAPString", XSD::QName.new(NsApi, "Message")], [0, 1]]
]
)
-
end
end
View
6 sample/list_sample.rb
@@ -150,4 +150,10 @@
list.delete!
puts "Was my second list deleted successfully: #{list.listID}"
+#Get statistics from a List
+client = Campaigning::Client.find_by_name("Client One Company")
+list = client.find_list_by_name "New list to test BLA"
+puts "List statistics: #{list.stats}"
+
+
View
170 test/campaign_test.rb
@@ -11,92 +11,92 @@ def setup
Campaigning.set_debug_mode(:on)
end
- # def test_campaign_create
- # client = Campaigning::Client.find_by_name("Client One Company")
- # response = Campaigning::Campaign.create!(
- # :clientID => client.clientID,
- # :campaignName => "Campaign by Campaigning TO DELETE - CODEE",
- # :campaignSubject => "Campaign by myself - OK - CODEE",
- # :fromName => "Mr. Gordon23",
- # :fromEmail => "gordon23@test.com",
- # :replyTo => "no-reply@test.com",
- # :htmlUrl => "http://gnumarcelo.github.com",
- # :textUrl => "http://gnumarcelo.github.com",
- # :subscriberListIDs => ["ac52b645c048888a44c87b5f1ecf6b7d"],
- # :listSegments => client.segments
- # )
- # puts response.inspect
- # end
+ def test_campaign_create
+ client = Campaigning::Client.find_by_name("Client One Company")
+ response = Campaigning::Campaign.create!(
+ :clientID => client.clientID,
+ :campaignName => "Campaign by Campaigning TO DELETE - CODEE",
+ :campaignSubject => "Campaign by myself - OK - CODEE",
+ :fromName => "Mr. Gordon23",
+ :fromEmail => "gordon23@test.com",
+ :replyTo => "no-reply@test.com",
+ :htmlUrl => "http://gnumarcelo.github.com",
+ :textUrl => "http://gnumarcelo.github.com",
+ :subscriberListIDs => ["ac52b645c048888a44c87b5f1ecf6b7d"],
+ :listSegments => client.segments
+ )
+ puts response.inspect
+ end
+
+
+ def test_campaign_delete!
+ #client = Campaigning::Client.find_by_name("Client One Company")
+ response = Campaigning::Campaign.delete!("4e5952a0840869b77f05b29b9a7a292b")
+ puts response.inspect
+ end
+
+ def test_campaign_bounces
+ client = Campaigning::Client.find_by_name("Client One Company")
+ puts client.campaigns[1].bounces.inspect
+ end
+ def test_campaign_lists
+ client = Campaigning::Client.find_by_name("Client One Company")
+ client.campaigns[0].lists
+ end
+
+ def test_campaign_opens
+ client = Campaigning::Client.find_by_name("Client One Company")
+ puts client.campaigns[0].opens
+ end
+
+ def test_campaign_find_campaigns_by_subject
+ client = Campaigning::Client.find_by_name("Client One Company")
+ campaigns = client.find_campaigns_by_subject("Campaign to BOUNCE")
+ assert campaign.length > 0
+ end
- # def test_campaign_delete!
- # #client = Campaigning::Client.find_by_name("Client One Company")
- # response = Campaigning::Campaign.delete!("4e5952a0840869b77f05b29b9a7a292b")
- # puts response.inspect
- # end
- # def test_campaign_bounces
- # client = Campaigning::Client.find_by_name("Client One Company")
- # puts client.campaigns[1].bounces.inspect
- # end
- #
- # def test_campaign_lists
- # client = Campaigning::Client.find_by_name("Client One Company")
- # client.campaigns[0].lists
- # end
- #
- # def test_campaign_opens
- # client = Campaigning::Client.find_by_name("Client One Company")
- # puts client.campaigns[0].opens
- # end
- #
- # def test_campaign_find_campaigns_by_subject
- # client = Campaigning::Client.find_by_name("Client One Company")
- # campaigns = client.find_campaigns_by_subject("Campaign to BOUNCE")
- # assert campaign.length > 0
- # end
- #
- #
- # def test_campaign_summary
- # client = Campaigning::Client.find_by_name("Client One Company")
- # # client.campaigns[2].subscriber_clicks.each do |subscriber|
- # # puts "Subscriber: #{subscriber.emailAddress}"
- # # subscriber.clickedLinks.each { |clicked| puts "Link: #{clicked.link} - Number of clicks: #{clicked.clicks}"}
- # # end
- # assert client.campaigns[2].subscriber_clicks != nil
- # assert client.campaigns[2].subscriber_clicks != []
- #
- # end
- #
- #
- # def test_campaign_summary
- # client = Campaigning::Client.find_by_name("Client One Company")
- # puts client.campaigns[1].summary
- # end
- #
- # def test_campaign_unsubscribes
- # client = Campaigning::Client.find_by_name("Client One Company")
- # puts client.campaigns[0].unsubscribes
- # end
- #
- # def test_campaign_send
- # client = Campaigning::Client.find_by_name("Client One Company")
- # response = Campaigning::Campaign.create!(
- # :clientID => client.clientID,
- # :campaignName => "Campaign by myself RUBY NEW CREATED",
- # :campaignSubject => "Campaign by myself - OK",
- # :fromName => "Mr. Gordon2",
- # :fromEmail => "gordon2@test.com",
- # :replyTo => "no-reply@test.com",
- # :htmlUrl => "http://www.campaignmonitor.com/api/method/campaign-create/",
- # :textUrl => "http://www.google.com",
- # :subscriberListIDs => ["ac52b645c048888a44c87b5f1ecf6b7d"],
- # :listSegments => client.segments
- # )
- #
- # puts client.campaigns[0].send!(
- # :confirmationEmail => "userhdhd@test.com",
- # :sendDate => "2009-04-30 11:55:01" # Date format YYYY-MM-DD HH:MM:SS.
- # )
- # end
+ def test_campaign_summary
+ client = Campaigning::Client.find_by_name("Client One Company")
+ # client.campaigns[2].subscriber_clicks.each do |subscriber|
+ # puts "Subscriber: #{subscriber.emailAddress}"
+ # subscriber.clickedLinks.each { |clicked| puts "Link: #{clicked.link} - Number of clicks: #{clicked.clicks}"}
+ # end
+ assert client.campaigns[2].subscriber_clicks != nil
+ assert client.campaigns[2].subscriber_clicks != []
+
+ end
+
+
+ def test_campaign_summary
+ client = Campaigning::Client.find_by_name("Client One Company")
+ puts client.campaigns[1].summary
+ end
+
+ def test_campaign_unsubscribes
+ client = Campaigning::Client.find_by_name("Client One Company")
+ puts client.campaigns[0].unsubscribes
+ end
+
+ def test_campaign_send
+ client = Campaigning::Client.find_by_name("Client One Company")
+ response = Campaigning::Campaign.create!(
+ :clientID => client.clientID,
+ :campaignName => "Campaign by myself RUBY NEW CREATED",
+ :campaignSubject => "Campaign by myself - OK",
+ :fromName => "Mr. Gordon2",
+ :fromEmail => "gordon2@test.com",
+ :replyTo => "no-reply@test.com",
+ :htmlUrl => "http://www.campaignmonitor.com/api/method/campaign-create/",
+ :textUrl => "http://www.google.com",
+ :subscriberListIDs => ["ac52b645c048888a44c87b5f1ecf6b7d"],
+ :listSegments => client.segments
+ )
+
+ puts client.campaigns[0].send!(
+ :confirmationEmail => "userhdhd@test.com",
+ :sendDate => "2009-04-30 11:55:01" # Date format YYYY-MM-DD HH:MM:SS.
+ )
+ end
end
View
43 test/client_test.rb
@@ -4,6 +4,7 @@
CAMPAIGN_MONITOR_API_KEY = '__PUT_YOUR_API_KEY_HERE__'
+
class ClientTest < Test::Unit::TestCase
@@ -17,7 +18,7 @@ def test_client_get_templates
puts "#{client.name} - #{client.clientID}"
puts "Templates: #{client.templates.inspect}"
end
-
+
def test_client_get_all_clients
clients = Campaigning::Client.get_all_clients
assert clients.length > 0
@@ -61,28 +62,28 @@ def test_get_client_campaigns
client = Campaigning::Client.find_by_name("Client One Company")
puts client.campaigns.inspect
end
-
+
def test_get_client_details
client = Campaigning::Client.find_by_name("Client One Company")
- # client_details = client.details
- # basic_details = client_details.basicDetails
- # access_and_billing_details = client_details.accessAndBilling
- # puts "Basic details:"
- # puts "Client ID: #{basic_details.clientID} - \n
- # Company: #{basic_details.companyName} - \n
- # Contact: #{basic_details.contactName} - \n
- # Country: #{basic_details.country} - \n
- # Timezone: #{basic_details.timezone}"
- #
- # puts "Access and Billing Details:"
- # puts "Username: #{access_and_billing_details.username} - \n
- # Password: #{access_and_billing_details.password} - \n
- # Billing Type: #{access_and_billing_details.billingType} - \n
- # Currency: #{access_and_billing_details.currency} - \n
- # Delivery Fee: #{access_and_billing_details.deliveryFee} - \n
- # Cost per Recipient: #{access_and_billing_details.costPerRecipient} - \n
- # Design and Span test Fee: #{access_and_billing_details.designAndSpamTestFee} - \n
- # Access Level: #{access_and_billing_details.accessLevel}"
+ client_details = client.details
+ basic_details = client_details.basicDetails
+ access_and_billing_details = client_details.accessAndBilling
+ puts "Basic details:"
+ puts "Client ID: #{basic_details.clientID} - \n
+ Company: #{basic_details.companyName} - \n
+ Contact: #{basic_details.contactName} - \n
+ Country: #{basic_details.country} - \n
+ Timezone: #{basic_details.timezone}"
+
+ puts "Access and Billing Details:"
+ puts "Username: #{access_and_billing_details.username} - \n
+ Password: #{access_and_billing_details.password} - \n
+ Billing Type: #{access_and_billing_details.billingType} - \n
+ Currency: #{access_and_billing_details.currency} - \n
+ Delivery Fee: #{access_and_billing_details.deliveryFee} - \n
+ Cost per Recipient: #{access_and_billing_details.costPerRecipient} - \n
+ Design and Span test Fee: #{access_and_billing_details.designAndSpamTestFee} - \n
+ Access Level: #{access_and_billing_details.accessLevel}"
assert !client.details.nil?
View
183 test/list_test.rb
@@ -11,96 +11,103 @@ def setup
Campaigning.set_debug_mode(:on)
end
-
- def test_list_find_single_subscriber
- client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- subscriber = list.find_single_subscriber("user_custon2@test.com")
- puts subscriber.inspect
- assert subscriber.name != nil
- end
-
- def test_list_find_unsubscribed
- client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- subscriber_list = list.find_unsubscribed(DateTime.new(y=2009,m=4,d=01, h=01,min=00,s=00))
- puts subscriber_list.inspect
- assert subscriber_list.length > 0
- end
-
- def test_list_find_active_subscribers
- client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- subscriber_list = list.find_active_subscribers(DateTime.new(y=2009,m=5,d=01, h=01,min=00,s=00))
- assert subscriber_list.length > 0
- end
-
- def test_list_get_all_active_subscribers
- client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- subscriber_list = list.get_all_active_subscribers
- puts subscriber_list.inspect
- assert subscriber_list.length > 0
- end
-
- def test_list_create
- client = Campaigning::Client.find_by_name("Client One Company")
- list = Campaigning::List.create!(
- :clientID => client.clientID,
- :title => "New list to test",
- :unsubscribePage => "",
- :confirmOptIn => false,
- :confirmationSuccessPage => ""
- )
- assert list.listID != nil
- end
-
- def test_list_create_custom_field
+ def test_list_stats
client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- result = list.create_custom_field!(
- :fieldName => "Country" ,
- :dataType => "MultiSelectOne",
- :options => %w[Brazil Ireland England]
- )
- assert result.code == 0
+ list = client.find_list_by_name "New list to test BLA"
+ puts list.stats.inspect
+ #assert subscriber_list.length > 0
end
- def test_list_delete
- result = Campaigning::List.delete!("916797045feddc92df10a4722f819771")
- puts result.inspect
- end
- def test_list_delete_custom_field
- client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- result = list.delete_custom_field!("Country")
- assert result.code == 0
- end
-
- def test_list_custom_fields
- client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- result = list.custom_fields
- puts result.inspect
- end
-
- def test_list_details
- client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- result = list.details
- puts result.inspect
- end
-
- def test_list_update
- client = Campaigning::Client.find_by_name("Client One Company")
- list = client.find_list_by_name "My Friends"
- result = list.update!(
- :title => "NEW TITLE : My new list created by ruby list.create",
- :unsubscribePage => "",
- :confirmOptIn => false,
- :confirmationSuccessPage => ""
- )
- assert result.code == 0
- end
+ # def test_list_find_single_subscriber
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # subscriber = list.find_single_subscriber("user_custon2@test.com")
+ # puts subscriber.inspect
+ # assert subscriber.name != nil
+ # end
+ #
+ # def test_list_find_unsubscribed
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # subscriber_list = list.find_unsubscribed(DateTime.new(y=2009,m=4,d=01, h=01,min=00,s=00))
+ # puts subscriber_list.inspect
+ # assert subscriber_list.length > 0
+ # end
+ #
+ # def test_list_find_active_subscribers
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # subscriber_list = list.find_active_subscribers(DateTime.new(y=2009,m=5,d=01, h=01,min=00,s=00))
+ # assert subscriber_list.length > 0
+ # end
+ #
+ # def test_list_get_all_active_subscribers
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # subscriber_list = list.get_all_active_subscribers
+ # puts subscriber_list.inspect
+ # assert subscriber_list.length > 0
+ # end
+ #
+ # def test_list_create
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = Campaigning::List.create!(
+ # :clientID => client.clientID,
+ # :title => "New list to test",
+ # :unsubscribePage => "",
+ # :confirmOptIn => false,
+ # :confirmationSuccessPage => ""
+ # )
+ # assert list.listID != nil
+ # end
+ #
+ # def test_list_create_custom_field
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # result = list.create_custom_field!(
+ # :fieldName => "Country" ,
+ # :dataType => "MultiSelectOne",
+ # :options => %w[Brazil Ireland England]
+ # )
+ # assert result.code == 0
+ # end
+ #
+ # def test_list_delete
+ # result = Campaigning::List.delete!("916797045feddc92df10a4722f819771")
+ # puts result.inspect
+ # end
+ #
+ # def test_list_delete_custom_field
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # result = list.delete_custom_field!("Country")
+ # assert result.code == 0
+ # end
+ #
+ # def test_list_custom_fields
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # result = list.custom_fields
+ # puts result.inspect
+ # end
+ #
+ # def test_list_details
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # result = list.details
+ # puts result.inspect
+ # end
+ #
+ # def test_list_update
+ # client = Campaigning::Client.find_by_name("Client One Company")
+ # list = client.find_list_by_name "My Friends"
+ # result = list.update!(
+ # :title => "NEW TITLE : My new list created by ruby list.create",
+ # :unsubscribePage => "",
+ # :confirmOptIn => false,
+ # :confirmationSuccessPage => ""
+ # )
+ # assert result.code == 0
+ # end
end

0 comments on commit 4dd0534

Please sign in to comment.
Something went wrong with that request. Please try again.