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,41 +5,41 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
module Components
|
9
|
+
class TestSend < Component
|
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 - hash of properties to create object from
|
15
|
+
# @return [TestSend]
|
16
|
+
def self.create(props)
|
17
|
+
test_send = TestSend.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
if key == 'email_addresses'
|
21
|
+
if value
|
22
|
+
test_send.email_addresses = []
|
23
|
+
value.each do |email_address|
|
24
|
+
test_send.email_addresses << email_address
|
25
|
+
end
|
26
|
+
end
|
27
|
+
else
|
28
|
+
test_send.send("#{key}=", value)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
test_send
|
33
|
+
end
|
34
34
|
|
35
35
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
36
|
+
# Add an email address to the set of addresses to send the test send too
|
37
|
+
# @param [String] email_address
|
38
|
+
def add_email(email_address)
|
39
|
+
@email_addresses = [] if @email_addresses.nil?
|
40
|
+
@email_addresses << email_address
|
41
|
+
end
|
42
42
|
|
43
|
-
|
44
|
-
|
43
|
+
end
|
44
|
+
end
|
45
45
|
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 ResultSet
|
10
|
+
attr_accessor :results, :next
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
# Constructor to create a ResultSet from the results/meta response when performing a get on a collection
|
14
|
+
# @param [Array<Hash>] results - results array from request
|
15
|
+
# @param [Hash] meta - meta hash from request
|
16
|
+
def initialize(results, meta)
|
17
|
+
@results = results
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
if meta.has_key?('pagination') and meta['pagination'].has_key?('next_link')
|
20
|
+
next_link = meta['pagination']['next_link']
|
21
|
+
@next = next_link[next_link.index('?'), next_link.length]
|
22
|
+
end
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
end
|
26
|
+
end
|
27
27
|
end
|
@@ -5,25 +5,25 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
module Components
|
9
|
+
class BounceActivity < Component
|
10
|
+
attr_accessor :activity_type, :bounce_code, :bounce_description, :bounce_message, :bounce_date,
|
11
|
+
:contact_id, :email_address, :campaign_id
|
12
12
|
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
# Factory method to create a BounceActivity object from an array
|
15
|
+
# @param [Hash] props - hash of properties to create object from
|
16
|
+
# @return [BounceActivity]
|
17
|
+
def self.create(props)
|
18
|
+
bounce_activity = BounceActivity.new
|
19
|
+
if props
|
20
|
+
props.each do |key, value|
|
21
|
+
bounce_activity.send("#{key}=", value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
bounce_activity
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
end
|
28
|
+
end
|
29
29
|
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 ClickActivity < Component
|
10
|
+
attr_accessor :activity_type, :campaign_id, :contact_id, :email_address, :link_id, :click_date
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
# Factory method to create a ClickActivity object from an array
|
14
|
+
# @param [Hash] props - hash of properties to create object from
|
15
|
+
# @return [ClickActivity]
|
16
|
+
def self.create(props)
|
17
|
+
click_activity = ClickActivity.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
click_activity.send("#{key}=", value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
click_activity
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
end
|
27
|
+
end
|
28
28
|
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 ForwardActivity < Component
|
10
|
+
attr_accessor :activity_type, :campaign_id, :contact_id, :email_address, :forward_date
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
# Factory method to create a ForwardActivity object from an array
|
14
|
+
# @param [Hash] props - hash of properties to create object from
|
15
|
+
# @return [ForwardActivity]
|
16
|
+
def self.create(props)
|
17
|
+
forward_activity = ForwardActivity.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
forward_activity.send("#{key}=", value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
forward_activity
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
end
|
27
|
+
end
|
28
28
|
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 OpenActivity < Component
|
10
|
+
attr_accessor :activity_type, :campaign_id, :email_address, :open_date, :contact_id
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
# Factory method to create an OpenActivity object from an array
|
14
|
+
# @param [Hash] props - hash of properties to create object from
|
15
|
+
# @return [OpenActivity]
|
16
|
+
def self.create(props)
|
17
|
+
open_activity = OpenActivity.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
open_activity.send("#{key}=", value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
open_activity
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
end
|
27
|
+
end
|
28
28
|
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 SendActivity < Component
|
10
|
+
attr_accessor :activity_type, :campaign_id, :email_address, :contact_id, :send_date
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
# Factory method to create a SendActivity object from an array
|
14
|
+
# @param [Hash] props - hash of properties to create object from
|
15
|
+
# @return [SendActivity]
|
16
|
+
def self.create(props)
|
17
|
+
send_activity = SendActivity.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
send_activity.send("#{key}=", value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
send_activity
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
end
|
27
|
+
end
|
28
28
|
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 TrackingActivity < Component
|
10
|
+
attr_accessor :results, :next
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
13
|
+
# Constructor to create a TrackingActivity from the results/pagination response from getting a set of activities
|
14
|
+
# @param [Array] results - results array from a tracking endpoint
|
15
|
+
# @param [Hash] pagination - pagination hash returned from a tracking endpoint
|
16
|
+
# @return [TrackingActivity]
|
17
|
+
def initialize(results, pagination)
|
18
|
+
@results = results
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
if (pagination.has_key?('next'))
|
21
|
+
@next = pagination['next'][pagination['next'].index('&next=') + 6, pagination['next'].length]
|
22
|
+
end
|
23
|
+
end
|
24
24
|
|
25
|
-
|
26
|
-
|
25
|
+
end
|
26
|
+
end
|
27
27
|
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 TrackingSummary < Component
|
10
|
+
attr_accessor :sends, :opens, :clicks, :forwards, :unsubscribes, :bounces, :contact_id
|
11
11
|
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
# Factory method to create a TrackingSummary object from an array
|
14
|
+
# @param [Hash] props - array of properties to create object from
|
15
|
+
# @return [TrackingSummary]
|
16
|
+
def self.create(props)
|
17
|
+
tracking_summary = TrackingSummary.new
|
18
|
+
if props
|
19
|
+
props.each do |key, value|
|
20
|
+
tracking_summary.send("#{key}=", value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
tracking_summary
|
24
|
+
end
|
25
25
|
|
26
|
-
|
27
|
-
|
26
|
+
end
|
27
|
+
end
|
28
28
|
end
|
@@ -5,25 +5,25 @@
|
|
5
5
|
# Copyright (c) 2013 Constant Contact. All rights reserved.
|
6
6
|
|
7
7
|
module ConstantContact
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
8
|
+
module Components
|
9
|
+
class UnsubscribeActivity < Component
|
10
|
+
attr_accessor :activity_type, :campaign_id, :contact_id, :email_address, :unsubscribe_date,
|
11
|
+
:unsubscribe_source, :unsubscribe_reason
|
12
12
|
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
14
|
+
# Factory method to create an UnsubscribeActivity object from an array
|
15
|
+
# @param [Hash] props - hash of properties to create object from
|
16
|
+
# @return [UnsubscribeActivity]
|
17
|
+
def self.create(props)
|
18
|
+
unsubscribe_activity = UnsubscribeActivity.new
|
19
|
+
if props
|
20
|
+
props.each do |key, value|
|
21
|
+
unsubscribe_activity.send("#{key}=", value)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
unsubscribe_activity
|
25
|
+
end
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
end
|
28
|
+
end
|
29
29
|
end
|