constant-contact-ruby 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION.yml +2 -2
- data/constant-contact-ruby.gemspec +27 -30
- data/lib/constant_contact/contact_list.rb +34 -8
- metadata +19 -10
- data/.gitignore +0 -24
data/VERSION.yml
CHANGED
@@ -1,60 +1,57 @@
|
|
1
1
|
# Generated by jeweler
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{constant-contact-ruby}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Craig P Jolicoeur"]
|
12
|
-
s.date = %q{
|
12
|
+
s.date = %q{2011-03-26}
|
13
13
|
s.description = %q{Ruby wrapper around the Constant Contact REST API}
|
14
14
|
s.email = %q{cpjolicoeur@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE",
|
17
|
-
|
18
|
-
|
17
|
+
"README.rdoc",
|
18
|
+
"TODO"
|
19
19
|
]
|
20
20
|
s.files = [
|
21
21
|
".document",
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
"test/test_contacts.rb"
|
22
|
+
"CHANGELOG",
|
23
|
+
"LICENSE",
|
24
|
+
"README.rdoc",
|
25
|
+
"Rakefile",
|
26
|
+
"TODO",
|
27
|
+
"VERSION.yml",
|
28
|
+
"constant-contact-ruby.gemspec",
|
29
|
+
"lib/constant_contact.rb",
|
30
|
+
"lib/constant_contact/activity.rb",
|
31
|
+
"lib/constant_contact/base_resource.rb",
|
32
|
+
"lib/constant_contact/contact.rb",
|
33
|
+
"lib/constant_contact/contact_list.rb",
|
34
|
+
"test/fixtures/get_contact.xml",
|
35
|
+
"test/fixtures/get_contacts.xml",
|
36
|
+
"test/fixtures/post_contacts.xml",
|
37
|
+
"test/helper.rb",
|
38
|
+
"test/test_constant-contact-ruby.rb",
|
39
|
+
"test/test_contacts.rb"
|
41
40
|
]
|
42
41
|
s.homepage = %q{http://github.com/cpjolicoeur/constant-contact-ruby}
|
43
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
44
42
|
s.require_paths = ["lib"]
|
45
|
-
s.rubygems_version = %q{1.
|
43
|
+
s.rubygems_version = %q{1.5.0}
|
46
44
|
s.summary = %q{Constant Contact Ruby API Wrapper}
|
47
45
|
s.test_files = [
|
48
46
|
"test/helper.rb",
|
49
|
-
|
50
|
-
|
47
|
+
"test/test_constant-contact-ruby.rb",
|
48
|
+
"test/test_contacts.rb"
|
51
49
|
]
|
52
50
|
|
53
51
|
if s.respond_to? :specification_version then
|
54
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
55
52
|
s.specification_version = 3
|
56
53
|
|
57
|
-
if Gem::Version.new(Gem::
|
54
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
58
55
|
else
|
59
56
|
end
|
60
57
|
else
|
@@ -90,14 +90,7 @@ module ConstantContact
|
|
90
90
|
|
91
91
|
# Get a lists members
|
92
92
|
def self.members( id, options={} )
|
93
|
-
|
94
|
-
return nil if ( members.nil? or members.empty? )
|
95
|
-
|
96
|
-
if( members['feed']['entry'].is_a?(Array) )
|
97
|
-
members['feed']['entry'].collect { |entry| Contact.new( entry, '', true ) }
|
98
|
-
else
|
99
|
-
[Contact.new( members['feed']['entry'], '', true )]
|
100
|
-
end
|
93
|
+
fetch_members(id, options)
|
101
94
|
end
|
102
95
|
|
103
96
|
# Returns the objects API URI
|
@@ -125,6 +118,39 @@ module ConstantContact
|
|
125
118
|
EOF
|
126
119
|
xml
|
127
120
|
end
|
121
|
+
|
122
|
+
def self.fetch_members( id, options={} )
|
123
|
+
contacts = []
|
124
|
+
link = "/lists/#{id.to_s}/members"
|
125
|
+
if options['next_link']
|
126
|
+
full_link = options.delete('next_link')
|
127
|
+
link += "?#{full_link.split('?').last}"
|
128
|
+
end
|
129
|
+
|
130
|
+
members = ConstantContact.get( link, options )
|
131
|
+
return nil if ( members.nil? or members.empty? )
|
132
|
+
|
133
|
+
if( members['feed']['entry'].is_a?(Array) )
|
134
|
+
contacts = members['feed']['entry'].collect { |entry| Contact.new( entry, '', true ) }
|
135
|
+
else
|
136
|
+
contacts = [Contact.new( members['feed']['entry'], '', true )]
|
137
|
+
end
|
138
|
+
|
139
|
+
if feed_has_next_link?(members['feed'])
|
140
|
+
next_link = find_next_link members['feed']
|
141
|
+
contacts += fetch_members(id, options.merge!('next_link' => next_link))
|
142
|
+
end
|
143
|
+
|
144
|
+
contacts
|
145
|
+
end
|
146
|
+
|
147
|
+
def self.feed_has_next_link?(feed)
|
148
|
+
!find_next_link(feed).nil?
|
149
|
+
end
|
150
|
+
|
151
|
+
def self.find_next_link(feed)
|
152
|
+
feed['link'].collect { |link| link['href'] if link["rel"] && link["rel"] == 'next' }.compact.first
|
153
|
+
end
|
128
154
|
|
129
155
|
# Is this a full record or a summary record?
|
130
156
|
def full_record?
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: constant-contact-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 2
|
9
|
+
- 5
|
10
|
+
version: 0.2.5
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Craig P Jolicoeur
|
@@ -9,8 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
13
|
-
default_executable:
|
18
|
+
date: 2011-03-26 00:00:00 Z
|
14
19
|
dependencies: []
|
15
20
|
|
16
21
|
description: Ruby wrapper around the Constant Contact REST API
|
@@ -25,7 +30,6 @@ extra_rdoc_files:
|
|
25
30
|
- TODO
|
26
31
|
files:
|
27
32
|
- .document
|
28
|
-
- .gitignore
|
29
33
|
- CHANGELOG
|
30
34
|
- LICENSE
|
31
35
|
- README.rdoc
|
@@ -44,31 +48,36 @@ files:
|
|
44
48
|
- test/helper.rb
|
45
49
|
- test/test_constant-contact-ruby.rb
|
46
50
|
- test/test_contacts.rb
|
47
|
-
has_rdoc: true
|
48
51
|
homepage: http://github.com/cpjolicoeur/constant-contact-ruby
|
49
52
|
licenses: []
|
50
53
|
|
51
54
|
post_install_message:
|
52
|
-
rdoc_options:
|
53
|
-
|
55
|
+
rdoc_options: []
|
56
|
+
|
54
57
|
require_paths:
|
55
58
|
- lib
|
56
59
|
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
57
61
|
requirements:
|
58
62
|
- - ">="
|
59
63
|
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
60
67
|
version: "0"
|
61
|
-
version:
|
62
68
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
63
70
|
requirements:
|
64
71
|
- - ">="
|
65
72
|
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
66
76
|
version: "0"
|
67
|
-
version:
|
68
77
|
requirements: []
|
69
78
|
|
70
79
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.
|
80
|
+
rubygems_version: 1.7.1
|
72
81
|
signing_key:
|
73
82
|
specification_version: 3
|
74
83
|
summary: Constant Contact Ruby API Wrapper
|
data/.gitignore
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
## MAC OS
|
2
|
-
.DS_Store
|
3
|
-
|
4
|
-
## TEXTMATE
|
5
|
-
*.tmproj
|
6
|
-
tmtags
|
7
|
-
|
8
|
-
## EMACS
|
9
|
-
*~
|
10
|
-
\#*
|
11
|
-
.\#*
|
12
|
-
|
13
|
-
## VIM
|
14
|
-
*.swp
|
15
|
-
|
16
|
-
## PROJECT::GENERAL
|
17
|
-
coverage
|
18
|
-
rdoc
|
19
|
-
pkg
|
20
|
-
|
21
|
-
## PROJECT::SPECIFIC
|
22
|
-
doc
|
23
|
-
.yardoc
|
24
|
-
constant-contact-ruby.rb
|