constantcontact 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -7
- data/README.md +7 -0
- data/constantcontact.gemspec +1 -1
- data/lib/constantcontact.rb +54 -54
- data/lib/constantcontact/api.rb +5 -3
- data/lib/constantcontact/auth/oauth2.rb +7 -4
- data/lib/constantcontact/auth/session_data_store.rb +52 -52
- data/lib/constantcontact/components/account/verified_email_address.rb +17 -17
- data/lib/constantcontact/components/activities/activity.rb +34 -34
- data/lib/constantcontact/components/activities/activity_error.rb +17 -17
- data/lib/constantcontact/components/activities/add_contacts.rb +109 -109
- data/lib/constantcontact/components/activities/add_contacts_import_data.rb +37 -37
- data/lib/constantcontact/components/activities/export_contacts.rb +19 -19
- data/lib/constantcontact/components/component.rb +13 -13
- data/lib/constantcontact/components/contacts/address.rb +18 -18
- data/lib/constantcontact/components/contacts/contact.rb +69 -69
- data/lib/constantcontact/components/contacts/contact_list.rb +17 -17
- data/lib/constantcontact/components/contacts/custom_field.rb +17 -17
- data/lib/constantcontact/components/contacts/email_address.rb +23 -23
- data/lib/constantcontact/components/contacts/note.rb +16 -16
- data/lib/constantcontact/components/email_marketing/campaign.rb +67 -67
- data/lib/constantcontact/components/email_marketing/click_through_details.rb +17 -17
- data/lib/constantcontact/components/email_marketing/message_footer.rb +20 -20
- data/lib/constantcontact/components/email_marketing/schedule.rb +18 -18
- data/lib/constantcontact/components/email_marketing/test_send.rb +32 -32
- data/lib/constantcontact/components/result_set.rb +15 -15
- data/lib/constantcontact/components/tracking/bounce_activity.rb +18 -18
- data/lib/constantcontact/components/tracking/click_activity.rb +17 -17
- data/lib/constantcontact/components/tracking/forward_activity.rb +17 -17
- data/lib/constantcontact/components/tracking/open_activity.rb +17 -17
- data/lib/constantcontact/components/tracking/send_activity.rb +17 -17
- data/lib/constantcontact/components/tracking/tracking_activity.rb +15 -15
- data/lib/constantcontact/components/tracking/tracking_summary.rb +17 -17
- data/lib/constantcontact/components/tracking/unsubscribe_activity.rb +18 -18
- data/lib/constantcontact/exceptions/ctct_exception.rb +15 -15
- data/lib/constantcontact/exceptions/illegal_argument_exception.rb +3 -3
- data/lib/constantcontact/exceptions/oauth2_exception.rb +3 -3
- data/lib/constantcontact/services/account_service.rb +19 -19
- data/lib/constantcontact/services/activity_service.rb +99 -99
- data/lib/constantcontact/services/base_service.rb +24 -24
- data/lib/constantcontact/services/campaign_schedule_service.rb +85 -85
- data/lib/constantcontact/services/campaign_tracking_service.rb +151 -151
- data/lib/constantcontact/services/contact_service.rb +106 -106
- data/lib/constantcontact/services/contact_tracking_service.rb +151 -151
- data/lib/constantcontact/services/email_marketing_service.rb +66 -66
- data/lib/constantcontact/services/list_service.rb +67 -67
- data/lib/constantcontact/util/config.rb +102 -96
- data/lib/constantcontact/util/helpers.rb +18 -18
- data/lib/constantcontact/version.rb +4 -4
- data/spec/constantcontact/api_spec.rb +223 -173
- data/spec/constantcontact/auth/oauth2_spec.rb +68 -4
- data/spec/constantcontact/components/contacts/address_spec.rb +7 -7
- data/spec/constantcontact/components/contacts/contact_list_spec.rb +7 -7
- data/spec/constantcontact/components/contacts/contact_spec.rb +7 -7
- data/spec/constantcontact/components/contacts/custom_field_spec.rb +7 -7
- data/spec/constantcontact/components/contacts/email_address_spec.rb +7 -7
- data/spec/constantcontact/services/contact_service_spec.rb +95 -95
- data/spec/constantcontact/services/list_service_spec.rb +48 -48
- data/spec/spec_helper.rb +1 -1
- metadata +55 -44
@@ -5,23 +5,23 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Components
|
9
|
+
class ContactList < Component
|
10
|
+
attr_accessor :id, :name, :status, :created_date, :modified_date, :contact_count
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
# Factory method to create a ContactList object from a json string
|
13
|
+
# @param [Hash] props - array of properties to create object from
|
14
|
+
# @return [ContactList]
|
15
|
+
def self.create(props)
|
16
|
+
contact_list = ContactList.new
|
17
|
+
if props
|
18
|
+
props.each do |key, value|
|
19
|
+
contact_list.send("#{key}=", value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
contact_list
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
@@ -5,23 +5,23 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Components
|
9
|
+
class CustomField < Component
|
10
|
+
attr_accessor :name, :value
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
12
|
+
# Factory method to create a CustomField object from a json string
|
13
|
+
# @param [Hash] props - array of properties to create object from
|
14
|
+
# @return [CustomField]
|
15
|
+
def self.create(props)
|
16
|
+
custom_field = CustomField.new
|
17
|
+
if props
|
18
|
+
props.each do |key, value|
|
19
|
+
custom_field.send("#{key}=", value)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
custom_field
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
@@ -5,30 +5,30 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Components
|
9
|
+
class EmailAddress < Component
|
10
|
+
attr_accessor :id, :status, :confirm_status, :opt_in_source, :opt_in_date, :opt_out_date, :email_address
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
12
|
+
# Class constructor
|
13
|
+
# @param [String] email_address
|
14
|
+
# @return [EmailAddress]
|
15
|
+
def initialize(email_address = nil)
|
16
|
+
@email_address = email_address if email_address
|
17
|
+
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
19
|
+
# Factory method to create an EmailAddress object from a json string
|
20
|
+
# @param [Hash] props - array of properties to create object from
|
21
|
+
# @return [EmailAddress]
|
22
|
+
def self.create(props)
|
23
|
+
email_address = EmailAddress.new
|
24
|
+
if props
|
25
|
+
props.each do |key, value|
|
26
|
+
email_address.send("#{key}=", value)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
email_address
|
30
|
+
end
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
end
|
33
|
+
end
|
34
34
|
end
|
@@ -5,21 +5,21 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Components
|
9
|
+
class Note < Component
|
10
|
+
attr_accessor :id, :note, :created_date
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
12
|
+
# Factory method to create a Note object from a json string
|
13
|
+
# @param props - JSON string representing a contact
|
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
|
+
end
|
25
25
|
end
|
@@ -5,79 +5,79 @@
|
|
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, :include_forward_email, :is_visible_in_ui
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
19
|
+
# Factory method to create an EmailCampaign object from an array
|
20
|
+
# @param [Hash] props - hash of 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
|
+
else
|
45
|
+
campaign.send("#{key}=", value)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
campaign
|
50
|
+
end
|
51
51
|
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
53
|
+
# Factory method to create a Campaign object from an array
|
54
|
+
# @param [Hash] props - hash of initial properties to set
|
55
|
+
# @return [Campaign]
|
56
|
+
def self.create_summary(props)
|
57
|
+
campaign = Campaign.new
|
58
|
+
if props
|
59
|
+
props.each do |key, value|
|
60
|
+
campaign.send("#{key}=", value)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
campaign
|
64
|
+
end
|
65
65
|
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
67
|
+
# Add a contact list to set of lists associated with this email
|
68
|
+
# @param [Mixed] contact_list - Contact list id, or ContactList object
|
69
|
+
def add_list(contact_list)
|
70
|
+
if contact_list.instance_of?(ContactList)
|
71
|
+
list = contact_list
|
72
|
+
elsif contact_list.to_i.to_s == contact_list
|
73
|
+
list = ContactList.new(contact_list)
|
74
|
+
else
|
75
|
+
raise Exceptions::IllegalArgumentException, sprintf(Util::Config.get('errors.id_or_object'), 'ContactList')
|
76
|
+
end
|
77
77
|
|
78
|
-
|
79
|
-
|
78
|
+
@sent_to_contact_lists << list
|
79
|
+
end
|
80
80
|
|
81
|
-
|
82
|
-
|
81
|
+
end
|
82
|
+
end
|
83
83
|
end
|
@@ -5,24 +5,24 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Components
|
9
|
+
class ClickThroughDetails < Component
|
10
|
+
attr_accessor :url, :url_uid, :click_count
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
# Factory method to create an ClickThroughDetails object from an array
|
14
|
+
# @param [Hash] props - hash of properties to create object from
|
15
|
+
# @return [ClickThroughDetails]
|
16
|
+
def self.create(props)
|
17
|
+
click_through_details = ClickThroughDetails.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
click_through_details.send("#{key}=", value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
click_through_details
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
end
|
27
|
+
end
|
28
28
|
end
|
@@ -5,26 +5,26 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
8
|
+
module Components
|
9
|
+
class MessageFooter < Component
|
10
|
+
attr_accessor :city, :state, :country, :organization_name, :address_line_1,
|
11
|
+
:address_line_2, :address_line_3, :international_state,
|
12
|
+
:postal_code, :include_forward_email, :forward_email_link_text,
|
13
|
+
:include_subscribe_link, :subscribe_link_text
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
# Factory method to create a MessageFooter object from an array
|
16
|
+
# @param [Hash] props - hash of properties to create object from
|
17
|
+
# @return [MessageFooter]
|
18
|
+
def self.create(props)
|
19
|
+
message_footer = MessageFooter.new
|
20
|
+
if props
|
21
|
+
props.each do |key, value|
|
22
|
+
message_footer.send("#{key}=", value)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
message_footer
|
26
|
+
end
|
27
27
|
|
28
|
-
|
29
|
-
|
28
|
+
end
|
29
|
+
end
|
30
30
|
end
|
@@ -5,25 +5,25 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Components
|
9
|
+
class Schedule < Component
|
10
|
+
attr_accessor :id, :scheduled_date
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
13
|
+
# Factory method to create a Schedule object from an array
|
14
|
+
# @param [Hash] props - hash of properties to create object from
|
15
|
+
# @return [Schedule]
|
16
|
+
def self.create(props)
|
17
|
+
schedule = Schedule.new
|
18
|
+
if props
|
19
|
+
props = props.first if props.is_a?(Array)
|
20
|
+
props.each do |key, value|
|
21
|
+
schedule.send("#{key}=", value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
schedule
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|