constantcontact 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +127 -136
- data/constantcontact.gemspec +4 -3
- data/lib/constantcontact.rb +63 -44
- data/lib/constantcontact/api.rb +932 -535
- data/lib/constantcontact/auth/oauth2.rb +86 -66
- data/lib/constantcontact/components/account/verified_email_address.rb +14 -14
- data/lib/constantcontact/components/activities/activity.rb +30 -30
- data/lib/constantcontact/components/activities/activity_error.rb +14 -14
- data/lib/constantcontact/components/activities/add_contacts.rb +1 -1
- data/lib/constantcontact/components/activities/add_contacts_import_data.rb +37 -36
- data/lib/constantcontact/components/component.rb +25 -0
- data/lib/constantcontact/components/contacts/address.rb +12 -12
- data/lib/constantcontact/components/contacts/contact.rb +50 -44
- data/lib/constantcontact/components/contacts/contact_list.rb +12 -12
- data/lib/constantcontact/components/contacts/custom_field.rb +14 -14
- data/lib/constantcontact/components/contacts/email_address.rb +14 -14
- data/lib/constantcontact/components/contacts/note.rb +13 -13
- data/lib/constantcontact/components/email_marketing/campaign.rb +41 -41
- data/lib/constantcontact/components/email_marketing/click_through_details.rb +14 -14
- data/lib/constantcontact/components/email_marketing/message_footer.rb +14 -14
- data/lib/constantcontact/components/email_marketing/schedule.rb +14 -15
- data/lib/constantcontact/components/email_marketing/test_send.rb +21 -21
- data/lib/constantcontact/components/event_spot/contact.rb +27 -0
- data/lib/constantcontact/components/event_spot/event.rb +63 -0
- data/lib/constantcontact/components/event_spot/event_track.rb +28 -0
- data/lib/constantcontact/components/event_spot/fee.rb +27 -0
- data/lib/constantcontact/components/event_spot/guest.rb +31 -0
- data/lib/constantcontact/components/event_spot/notification_option.rb +27 -0
- data/lib/constantcontact/components/event_spot/promo_code.rb +26 -0
- data/lib/constantcontact/components/event_spot/registrant.rb +54 -0
- data/lib/constantcontact/components/event_spot/registrant_field.rb +27 -0
- data/lib/constantcontact/components/event_spot/registrant_section.rb +34 -0
- data/lib/constantcontact/components/event_spot/sale_item.rb +27 -0
- data/lib/constantcontact/components/library/file/library_file.rb +27 -0
- data/lib/constantcontact/components/library/folder/library_folder.rb +26 -0
- data/lib/constantcontact/components/library/info/library_summary.rb +26 -0
- data/lib/constantcontact/components/library/info/move_results.rb +26 -0
- data/lib/constantcontact/components/library/info/upload_status.rb +26 -0
- data/lib/constantcontact/components/tracking/bounce_activity.rb +14 -14
- data/lib/constantcontact/components/tracking/click_activity.rb +14 -14
- data/lib/constantcontact/components/tracking/forward_activity.rb +14 -14
- data/lib/constantcontact/components/tracking/open_activity.rb +14 -14
- data/lib/constantcontact/components/tracking/send_activity.rb +14 -14
- data/lib/constantcontact/components/tracking/tracking_summary.rb +17 -17
- data/lib/constantcontact/components/tracking/unsubscribe_activity.rb +14 -14
- data/lib/constantcontact/services/account_service.rb +4 -3
- data/lib/constantcontact/services/activity_service.rb +40 -3
- data/lib/constantcontact/services/base_service.rb +34 -6
- data/lib/constantcontact/services/campaign_tracking_service.rb +20 -20
- data/lib/constantcontact/services/contact_service.rb +10 -12
- data/lib/constantcontact/services/contact_tracking_service.rb +20 -20
- data/lib/constantcontact/services/email_marketing_service.rb +8 -10
- data/lib/constantcontact/services/event_spot_service.rb +254 -0
- data/lib/constantcontact/services/library_service.rb +297 -0
- data/lib/constantcontact/services/list_service.rb +6 -5
- data/lib/constantcontact/util/config.rb +135 -117
- data/lib/constantcontact/version.rb +1 -1
- data/spec/constantcontact/api_spec.rb +1223 -173
- data/spec/constantcontact/auth/oauth2_spec.rb +60 -47
- data/spec/constantcontact/components/contacts/address_spec.rb +1 -1
- data/spec/constantcontact/components/contacts/contact_list_spec.rb +1 -1
- data/spec/constantcontact/components/contacts/contact_spec.rb +1 -1
- data/spec/constantcontact/components/contacts/email_address_spec.rb +1 -1
- data/spec/constantcontact/services/activity_service_spec.rb +201 -0
- data/spec/constantcontact/services/base_service_spec.rb +27 -0
- data/spec/constantcontact/services/campaign_schedule_service_spec.rb +111 -0
- data/spec/constantcontact/services/campaign_tracking_service_spec.rb +127 -0
- data/spec/constantcontact/services/contact_service_spec.rb +24 -22
- data/spec/constantcontact/services/contact_tracking_service_spec.rb +127 -0
- data/spec/constantcontact/services/email_marketing_spec.rb +72 -66
- data/spec/constantcontact/services/event_spot_spec.rb +217 -0
- data/spec/constantcontact/services/library_service_spec.rb +248 -0
- data/spec/constantcontact/services/list_service_spec.rb +33 -17
- data/spec/spec_helper.rb +3 -1
- metadata +63 -7
@@ -11,52 +11,58 @@ module ConstantContact
|
|
11
11
|
attr_accessor :id, :status, :first_name, :middle_name, :last_name, :confirmed, :email_addresses,
|
12
12
|
:prefix_name, :job_title, :addresses, :company_name, :home_phone,
|
13
13
|
:work_phone, :cell_phone, :fax, :custom_fields, :lists,
|
14
|
-
:source_details, :
|
15
|
-
:created_date, :notes, :source
|
14
|
+
:source_details, :notes, :source
|
16
15
|
|
17
16
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
17
|
+
# Factory method to create a Contact object from a json string
|
18
|
+
# @param [Hash] props - properties to create object from
|
19
|
+
# @return [Contact]
|
20
|
+
def self.create(props)
|
21
|
+
obj = Contact.new
|
22
|
+
if props
|
23
|
+
props.each do |key, value|
|
24
|
+
if key == 'email_addresses'
|
25
|
+
if value
|
26
|
+
obj.email_addresses = []
|
27
|
+
value.each do |email_address|
|
28
|
+
obj.email_addresses << Components::EmailAddress.create(email_address)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
elsif key == 'addresses'
|
32
|
+
if value
|
33
|
+
obj.addresses = []
|
34
|
+
value.each do |address|
|
35
|
+
obj.addresses << Components::Address.create(address)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
elsif key == 'notes'
|
39
|
+
if value
|
40
|
+
obj.notes = []
|
41
|
+
value.each do |note|
|
42
|
+
obj.notes << Components::Note.create(note)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
elsif key == 'custom_fields'
|
46
|
+
if value
|
47
|
+
obj.custom_fields = []
|
48
|
+
value.each do |custom_field|
|
49
|
+
obj.custom_fields << Components::CustomField.create(custom_field)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
elsif key == 'lists'
|
53
|
+
if value
|
54
|
+
obj.lists = []
|
55
|
+
value.each do |contact_list|
|
56
|
+
obj.lists << Components::ContactList.create(contact_list)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
else
|
60
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
obj
|
65
|
+
end
|
60
66
|
|
61
67
|
# Setter
|
62
68
|
# @param [ContactList] contact_list
|
@@ -7,20 +7,20 @@
|
|
7
7
|
module ConstantContact
|
8
8
|
module Components
|
9
9
|
class ContactList < Component
|
10
|
-
attr_accessor :id, :name, :status, :
|
10
|
+
attr_accessor :id, :name, :status, :contact_count
|
11
11
|
|
12
12
|
# Factory method to create a ContactList object from a json string
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
13
|
+
# @param [Hash] props - properties to create object from
|
14
|
+
# @return [ContactList]
|
15
|
+
def self.create(props)
|
16
|
+
obj = ContactList.new
|
17
|
+
if props
|
18
|
+
props.each do |key, value|
|
19
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
20
|
+
end
|
21
|
+
end
|
22
|
+
obj
|
23
|
+
end
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -9,18 +9,18 @@ module ConstantContact
|
|
9
9
|
class CustomField < Component
|
10
10
|
attr_accessor :name, :value
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
12
|
+
# Factory method to create a CustomField object from a json string
|
13
|
+
# @param [Hash] props - properties to create object from
|
14
|
+
# @return [CustomField]
|
15
|
+
def self.create(props)
|
16
|
+
obj = CustomField.new
|
17
|
+
if props
|
18
|
+
props.each do |key, value|
|
19
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
20
|
+
end
|
21
|
+
end
|
22
|
+
obj
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
26
|
end
|
@@ -16,18 +16,18 @@ module ConstantContact
|
|
16
16
|
@email_address = email_address if email_address
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
# Factory method to create an EmailAddress object from a json string
|
20
|
+
# @param [Hash] props - properties to create object from
|
21
|
+
# @return [EmailAddress]
|
22
|
+
def self.create(props)
|
23
|
+
obj = EmailAddress.new
|
24
|
+
if props
|
25
|
+
props.each do |key, value|
|
26
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
27
|
+
end
|
28
|
+
end
|
29
|
+
obj
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
33
|
end
|
@@ -9,18 +9,18 @@ module ConstantContact
|
|
9
9
|
class Note < Component
|
10
10
|
attr_accessor :id, :note, :created_date
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
# Factory method to create a Note object from a json string
|
13
|
+
# @param [String] props - properties to create object from
|
14
|
+
# @return Note
|
15
|
+
def self.create(props)
|
16
|
+
note = Note.new
|
17
|
+
if props
|
18
|
+
props.each do |key, value|
|
19
|
+
note.send("#{key}=", value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
note
|
23
|
+
end
|
24
24
|
end
|
25
|
-
|
25
|
+
end
|
26
26
|
end
|
@@ -5,49 +5,49 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
module Components
|
9
|
+
class Campaign < Component
|
10
|
+
attr_accessor :id, :name, :subject, :status, :from_name, :from_email, :reply_to_email, :template_type,
|
11
|
+
:created_date, :modified_date, :last_run_date, :next_run_date,
|
12
|
+
:is_permission_reminder_enabled, :permission_reminder_text,
|
13
|
+
:is_view_as_webpage_enabled, :view_as_web_page_text, :view_as_web_page_link_text,
|
14
|
+
:greeting_salutations, :greeting_name, :greeting_string, :email_content, :text_content,
|
15
|
+
:message_footer, :tracking_summary, :email_content_format, :style_sheet, :sent_to_contact_lists,
|
16
|
+
:click_through_details, :permalink_url
|
17
17
|
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
19
|
+
# Factory method to create an EmailCampaign object from an array
|
20
|
+
# @param [Hash] props - properties to create object from
|
21
|
+
# @return [Campaign]
|
22
|
+
def self.create(props)
|
23
|
+
campaign = Campaign.new
|
24
|
+
if props
|
25
|
+
props.each do |key, value|
|
26
|
+
if key == 'message_footer'
|
27
|
+
campaign.message_footer = Components::MessageFooter.create(value)
|
28
|
+
elsif key == 'tracking_summary'
|
29
|
+
campaign.tracking_summary = Components::TrackingSummary.create(value)
|
30
|
+
elsif key == 'sent_to_contact_lists'
|
31
|
+
if value
|
32
|
+
campaign.sent_to_contact_lists = []
|
33
|
+
value.each do |sent_to_contact_list|
|
34
|
+
campaign.sent_to_contact_lists << Components::ContactList.create(sent_to_contact_list)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
elsif key == 'click_through_details'
|
38
|
+
if value
|
39
|
+
campaign.click_through_details = []
|
40
|
+
value.each do |click_through_details|
|
41
|
+
campaign.click_through_details << Components::ClickThroughDetails.create(click_through_details)
|
42
|
+
end
|
43
|
+
end
|
44
44
|
else
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
campaign.send("#{key}=", value) if campaign.respond_to? key
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
campaign
|
50
|
+
end
|
51
51
|
|
52
52
|
|
53
53
|
# Factory method to create a Campaign object from an array
|
@@ -57,7 +57,7 @@ module ConstantContact
|
|
57
57
|
campaign = Campaign.new
|
58
58
|
if props
|
59
59
|
props.each do |key, value|
|
60
|
-
campaign.send("#{key}=", value)
|
60
|
+
campaign.send("#{key}=", value) if campaign.respond_to? key
|
61
61
|
end
|
62
62
|
end
|
63
63
|
campaign
|
@@ -10,18 +10,18 @@ module ConstantContact
|
|
10
10
|
attr_accessor :url, :url_uid, :click_count
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
13
|
+
# Factory method to create an ClickThroughDetails object from an array
|
14
|
+
# @param [Hash] props - properties to create object from
|
15
|
+
# @return [ClickThroughDetails]
|
16
|
+
def self.create(props)
|
17
|
+
obj = ClickThroughDetails.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
21
|
+
end
|
22
|
+
end
|
23
|
+
obj
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
@@ -12,18 +12,18 @@ module ConstantContact
|
|
12
12
|
:postal_code, :include_forward_email, :forward_email_link_text,
|
13
13
|
:include_subscribe_link, :subscribe_link_text
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
15
|
+
# Factory method to create a MessageFooter object from an array
|
16
|
+
# @param [Hash] props - properties to create object from
|
17
|
+
# @return [MessageFooter]
|
18
|
+
def self.create(props)
|
19
|
+
obj = MessageFooter.new
|
20
|
+
if props
|
21
|
+
props.each do |key, value|
|
22
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
23
|
+
end
|
24
|
+
end
|
25
|
+
obj
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|
@@ -10,19 +10,18 @@ module ConstantContact
|
|
10
10
|
attr_accessor :id, :scheduled_date
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
end
|
13
|
+
# Factory method to create a Schedule object from an array
|
14
|
+
# @param [Hash] props - properties to create object from
|
15
|
+
# @return [Schedule]
|
16
|
+
def self.create(props)
|
17
|
+
obj = Schedule.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
21
|
+
end
|
22
|
+
end
|
23
|
+
obj
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
28
27
|
end
|
@@ -10,27 +10,27 @@ module ConstantContact
|
|
10
10
|
attr_accessor :format, :personal_message, :email_addresses
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
13
|
+
# Factory method to create a TestSend object from an array
|
14
|
+
# @param [Hash] props - properties to create object from
|
15
|
+
# @return [TestSend]
|
16
|
+
def self.create(props)
|
17
|
+
obj = TestSend.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
if key == 'email_addresses'
|
21
|
+
if value
|
22
|
+
obj.email_addresses = []
|
23
|
+
value.each do |email_address|
|
24
|
+
obj.email_addresses << email_address
|
25
|
+
end
|
26
|
+
end
|
27
|
+
else
|
28
|
+
obj.send("#{key}=", value) if obj.respond_to? key
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
obj
|
33
|
+
end
|
34
34
|
|
35
35
|
|
36
36
|
# Add an email address to the set of addresses to send the test send too
|