active_campaign 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +82 -6
- data/lib/active_campaign/request.rb +0 -1
- data/lib/active_campaign/version.rb +1 -1
- data/lib/active_campaign.rb +1 -1
- data/spec/client/lists_spec.rb +0 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8374196fd92155a286e77b4fe506b6501d9139c9
|
4
|
+
data.tar.gz: ec32eb1ed1f4a16715aeab31a79f9185eda64820
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 08fcb77345cb64d5de8b86387e29f592c6135d41cc0b4ab47528ec3811a5a8ba88685005f0b856766275c850c45d0ea3ee2abbe9a0ea5be4f95bc809179fcc9a
|
7
|
+
data.tar.gz: 48be9985590a1604bc00ef3817153bb5a8b98131e6851b5d4e665bc67811c8184cd1482045b5550ad3b4f1cc22b8fd6f36d8dfbeedd73f2e179e6068ef9cfa9b
|
data/README.md
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
# Active::Campaign::Ruby
|
2
2
|
|
3
|
-
|
3
|
+
A simple wrapper for the ActiveCampaign API. Since their API seems to be
|
4
|
+
basically just form posts to their server don't complain here about the way it
|
5
|
+
works. The only thing we really changed was how results are wrapped and
|
6
|
+
returned and you can read more about that here.
|
4
7
|
|
5
8
|
## Installation
|
6
9
|
|
7
10
|
Add this line to your application's Gemfile:
|
8
11
|
|
9
|
-
gem '
|
12
|
+
gem 'active_campaign'
|
10
13
|
|
11
14
|
And then execute:
|
12
15
|
|
@@ -14,16 +17,89 @@ And then execute:
|
|
14
17
|
|
15
18
|
Or install it yourself as:
|
16
19
|
|
17
|
-
$ gem install
|
20
|
+
$ gem install active_campaign
|
18
21
|
|
19
22
|
## Usage
|
20
23
|
|
21
|
-
|
24
|
+
Read their [API documentation](http://www.activecampaign.com/api/overview.php)for how to use this gem.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
# To fetch all lists
|
28
|
+
ActiveCampaign.list_list ids: 'all'
|
29
|
+
```
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# To sync a contact (create if doesn't exist or update if matching email)
|
33
|
+
# you have to resort to some really ugly hacks. Due to the form serialization # type of API (read not a object oriented REST API) you need to translate
|
34
|
+
# something pretty into something horrific when it comes to the parameters.
|
35
|
+
ActiveCampaign.contact_sync({
|
36
|
+
"id" => user.active_campaign_contact_id,
|
37
|
+
"email" => user.email,
|
38
|
+
"first_name" => user.first,
|
39
|
+
"last_name" => user.last,
|
40
|
+
"p[#{user.active_campaign_list_id}]" => user.active_campaign_list_id,
|
41
|
+
"status[#{user.active_campaign_list_id}" => user.receive_emails ? 1 : 2
|
42
|
+
})
|
43
|
+
|
44
|
+
# Another example of syncing a contact:
|
45
|
+
|
46
|
+
list_params = {
|
47
|
+
"#{user.active_campaign_list_id}" => user.active_campaign_list_id,
|
48
|
+
"#{user.other_list_id}" => user.other_list_id,
|
49
|
+
}
|
50
|
+
|
51
|
+
status_params = {
|
52
|
+
"#{user.active_campaign_list_id}" => user.receive_emails ? 1 : 2,
|
53
|
+
"#{user.other_list_id}" => true ? 1 : 2,
|
54
|
+
}
|
55
|
+
|
56
|
+
ActiveCampaign.contact_sync({
|
57
|
+
"id" => user.active_campaign_contact_id,
|
58
|
+
"email" => user.email,
|
59
|
+
"first_name" => user.first,
|
60
|
+
"last_name" => user.last,
|
61
|
+
"p" => list_params
|
62
|
+
"status" => status_params
|
63
|
+
})
|
64
|
+
```
|
65
|
+
|
66
|
+
## Response
|
67
|
+
|
68
|
+
All responses are wrapped under `results` so
|
69
|
+
`ActiveCampaign.list_list ids: 'all'` returns
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
{
|
73
|
+
"result_code" => 1,
|
74
|
+
"result_message" => "Success: Something is returned",
|
75
|
+
"result_output" => "json",
|
76
|
+
"results" => [
|
77
|
+
{
|
78
|
+
"id" => "1",
|
79
|
+
"name" => "One list",
|
80
|
+
"cdate" => "2013-05-22 10:07:36",
|
81
|
+
"private" => "0",
|
82
|
+
"userid" => "1",
|
83
|
+
"subscriber_count" => 2
|
84
|
+
},
|
85
|
+
{
|
86
|
+
"id" => "2",
|
87
|
+
"name" => "Another List",
|
88
|
+
"cdate" => "2013-05-22 10:09:15",
|
89
|
+
"private" => "0",
|
90
|
+
"userid" => "1",
|
91
|
+
"subscriber_count" => 0
|
92
|
+
}
|
93
|
+
]
|
94
|
+
}
|
95
|
+
```
|
96
|
+
|
22
97
|
|
23
98
|
## Contributing
|
24
99
|
|
25
100
|
1. Fork it
|
26
101
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
102
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
-
4.
|
29
|
-
5.
|
103
|
+
4. Rebase against master we want 1 commit per feature please
|
104
|
+
5. Push to the branch (`git push origin my-new-feature`)
|
105
|
+
6. Create new Pull Request
|
data/lib/active_campaign.rb
CHANGED
data/spec/client/lists_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_campaign
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|