acts_as_icontact 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +6 -0
- data/LICENSE +20 -0
- data/README.markdown +196 -0
- data/Rakefile +57 -0
- data/VERSION +1 -0
- data/acts_as_icontact.gemspec +74 -0
- data/lib/acts_as_icontact.rb +19 -0
- data/lib/acts_as_icontact/config.rb +106 -0
- data/lib/acts_as_icontact/connection.rb +32 -0
- data/lib/acts_as_icontact/exceptions.rb +19 -0
- data/lib/acts_as_icontact/resource.rb +204 -0
- data/lib/acts_as_icontact/resource_collection.rb +27 -0
- data/lib/acts_as_icontact/resources/account.rb +38 -0
- data/lib/acts_as_icontact/resources/client.rb +45 -0
- data/lib/acts_as_icontact/resources/contact.rb +7 -0
- data/spec/config_spec.rb +181 -0
- data/spec/connection_spec.rb +36 -0
- data/spec/resource_collection_spec.rb +23 -0
- data/spec/resource_spec.rb +301 -0
- data/spec/resources/account_spec.rb +52 -0
- data/spec/resources/client_spec.rb +52 -0
- data/spec/resources/contact_spec.rb +8 -0
- data/spec/spec.opts +4 -0
- data/spec/spec_fakeweb.rb +23 -0
- data/spec/spec_helper.rb +18 -0
- metadata +93 -0
@@ -0,0 +1,8 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
describe ActsAsIcontact::Contact do
|
4
|
+
it "defaults to a limit of 500"
|
5
|
+
it "defaults to searching on all contacts regardless of list status"
|
6
|
+
it "throws an exception if a limit higher than 500 is attempted"
|
7
|
+
|
8
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'fakeweb'
|
3
|
+
|
4
|
+
FakeWeb.allow_net_connect = false
|
5
|
+
|
6
|
+
# Resources (this one's a fake stub for pure testing)
|
7
|
+
FakeWeb.register_uri(:get, "https://app.beta.icontact.com/icp/resources", :body => %q<{"resources":[{"foo":"bar","resourceId":"1","too":"bar"},{"foo":"aar","resourceId":"2"},{"foo":"far","resourceId":"3"},{"foo":"car","resourceId":"4"},{"foo":"dar","resourceId":"5"},{"foo":"ear","resourceId":"6"},{"foo":"gar","resourceId":"7"},{"foo":"har","resourceId":"8"},{"foo":"iar","resourceId":"9"},{"foo":"jar","resourceId":"10"},{"foo":"kar","resourceId":"11"},{"foo":"yar","resourceId":"12"}],"total":12,"limit":20,"offset":0}>)
|
8
|
+
FakeWeb.register_uri(:get, "https://app.beta.icontact.com/icp/resources?limit=5", :body => %q<{"resources":[{"foo":"bar","resourceId":"1"},{"foo":"aar","resourceId":"2"},{"foo":"far","resourceId":"3"},{"foo":"car","resourceId":"4"},{"foo":"dar","resourceId":"5"}],"total":12,"limit":5,"offset":0}>)
|
9
|
+
FakeWeb.register_uri(:get, "https://app.beta.icontact.com/icp/resources?offset=5", :body => %q<{"resources":[{"foo":"ear","resourceId":"6"},{"foo":"gar","resourceId":"7"},{"foo":"har","resourceId":"8"},{"foo":"iar","resourceId":"9"},{"foo":"jar","resourceId":"10"},{"foo":"kar","resourceId":"11"},{"foo":"yar","resourceId":"12"}],"total":12,"limit":20,"offset":5}>)
|
10
|
+
FakeWeb.register_uri(:get, "https://app.beta.icontact.com/icp/resources?offset=5&limit=5", :body => %q<{"resources":[{"foo":"ear","resourceId":"6"},{"foo":"gar","resourceId":"7"},{"foo":"har","resourceId":"8"},{"foo":"iar","resourceId":"9"},{"foo":"jar","resourceId":"10"}],"total":12,"limit":5,"offset":5}>)
|
11
|
+
FakeWeb.register_uri(:get, "https://app.beta.icontact.com/icp/resources?offset=10&limit=5", :body => %q<{"resources":[{"foo":"kar","resourceId":"11"},{"foo":"yar","resourceId":"12"}],"total":12,"limit":5,"offset":10}>)
|
12
|
+
FakeWeb.register_uri(:post, "https://app.beta.icontact.com/icp/resources/1", :body => %q<{"resource":{"foo":"bar","resourceId":"1","too":"sar"}}>)
|
13
|
+
FakeWeb.register_uri(:post, "https://app.beta.icontact.com/icp/resources/2", :body => %q<{"resource":{},"warnings":["You did not provide a foo. foo is a required field. Please provide a foo","This was not a good record"]}>)
|
14
|
+
FakeWeb.register_uri(:post, "https://app.beta.icontact.com/icp/resources/3", :status => ["400","Bad Request"], :body => %q<{"errors":["You did not provide a clue. Clue is a required field. Please provide a clue"]}>)
|
15
|
+
|
16
|
+
# Time
|
17
|
+
FakeWeb.register_uri(:get, "https://app.beta.icontact.com/icp/time", :body => %q<{"time":"2009-07-13T01:28:18-04:00","timestamp":1247462898}>)
|
18
|
+
|
19
|
+
# Accounts
|
20
|
+
FakeWeb.register_uri(:get, "https://app.beta.icontact.com/icp/a", :body => %q<{"accounts":[{"billingStreet":"","billingCity":"","billingState":"","billingPostalCode":"","billingCountry":"","city":"Testville","accountId":"111111","companyName":"","country":"United States","email":"bob@example.org","enabled":1,"fax":"","firstName":"Bob","lastName":"Tester","multiClientFolder":"0","multiUser":"0","phone":"","postalCode":"12345","state":"TN","street":"123 Test Street","title":"","accountType":"0","subscriberLimit":"250000"}],"total":1,"limit":20,"offset":0}>)
|
21
|
+
|
22
|
+
# Clients
|
23
|
+
FakeWeb.register_uri(:get, "https://app.beta.icontact.com/icp/a/111111/c", :body => %q<{"clientfolders":[{"clientFolderId":"222222","logoId":null,"emailRecipient":"bob@example.org"}],"total":1}>)
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec'
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
4
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
5
|
+
require 'acts_as_icontact'
|
6
|
+
|
7
|
+
require 'spec_fakeweb'
|
8
|
+
|
9
|
+
Spec::Runner.configure do |config|
|
10
|
+
# config.after(:each) do
|
11
|
+
# # Make sure we don't run afoul of iContact's rate limiting
|
12
|
+
# sleep 1
|
13
|
+
# end
|
14
|
+
config.mock_with :mocha
|
15
|
+
|
16
|
+
# Set up some reasonable testing variables
|
17
|
+
ActsAsIcontact::Config.mode = :beta
|
18
|
+
end
|
metadata
ADDED
@@ -0,0 +1,93 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: acts_as_icontact
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephen Eley
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-07-24 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: |
|
17
|
+
ActsAsIcontact connects Ruby applications with the iContact e-mail marketing service using the iContact API v2.0. Building on the RestClient gem, it offers two significant feature sets:
|
18
|
+
|
19
|
+
* Simple, consistent access to all resources in the iContact API; and
|
20
|
+
* Automatic synchronizing between ActiveRecord models and iContact contact lists for Rails applications.
|
21
|
+
|
22
|
+
email: sfeley@gmail.com
|
23
|
+
executables: []
|
24
|
+
|
25
|
+
extensions: []
|
26
|
+
|
27
|
+
extra_rdoc_files:
|
28
|
+
- README.markdown
|
29
|
+
files:
|
30
|
+
- .document
|
31
|
+
- .gitignore
|
32
|
+
- LICENSE
|
33
|
+
- README.markdown
|
34
|
+
- Rakefile
|
35
|
+
- VERSION
|
36
|
+
- acts_as_icontact.gemspec
|
37
|
+
- lib/acts_as_icontact.rb
|
38
|
+
- lib/acts_as_icontact/config.rb
|
39
|
+
- lib/acts_as_icontact/connection.rb
|
40
|
+
- lib/acts_as_icontact/exceptions.rb
|
41
|
+
- lib/acts_as_icontact/resource.rb
|
42
|
+
- lib/acts_as_icontact/resource_collection.rb
|
43
|
+
- lib/acts_as_icontact/resources/account.rb
|
44
|
+
- lib/acts_as_icontact/resources/client.rb
|
45
|
+
- lib/acts_as_icontact/resources/contact.rb
|
46
|
+
- spec/config_spec.rb
|
47
|
+
- spec/connection_spec.rb
|
48
|
+
- spec/resource_collection_spec.rb
|
49
|
+
- spec/resource_spec.rb
|
50
|
+
- spec/resources/account_spec.rb
|
51
|
+
- spec/resources/client_spec.rb
|
52
|
+
- spec/resources/contact_spec.rb
|
53
|
+
- spec/spec.opts
|
54
|
+
- spec/spec_fakeweb.rb
|
55
|
+
- spec/spec_helper.rb
|
56
|
+
has_rdoc: true
|
57
|
+
homepage: http://github.com/SFEley/acts_as_icontact
|
58
|
+
licenses: []
|
59
|
+
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options:
|
62
|
+
- --charset=UTF-8
|
63
|
+
require_paths:
|
64
|
+
- lib
|
65
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: "0"
|
76
|
+
version:
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project: actsasicontact
|
80
|
+
rubygems_version: 1.3.4
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: Automatic bridge between iContact e-mail marketing service and Rails ActiveRecord
|
84
|
+
test_files:
|
85
|
+
- spec/config_spec.rb
|
86
|
+
- spec/connection_spec.rb
|
87
|
+
- spec/resource_collection_spec.rb
|
88
|
+
- spec/resource_spec.rb
|
89
|
+
- spec/resources/account_spec.rb
|
90
|
+
- spec/resources/client_spec.rb
|
91
|
+
- spec/resources/contact_spec.rb
|
92
|
+
- spec/spec_fakeweb.rb
|
93
|
+
- spec/spec_helper.rb
|