email-opened 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +26 -8
- data/lib/email-opened.rb +9 -21
- data/lib/email-opened/version.rb +1 -1
- metadata +2 -2
data/README.md
CHANGED
@@ -25,18 +25,36 @@ eo = EmailOpened.new(CONFIG["eo_api_key"])
|
|
25
25
|
response = eo.send(
|
26
26
|
to: [
|
27
27
|
{
|
28
|
-
email: "
|
29
|
-
name: "
|
28
|
+
email: "another@emailopened.ca",
|
29
|
+
name: "Another Person",
|
30
|
+
url: "http://another.com"
|
30
31
|
},
|
32
|
+
{
|
33
|
+
email: "sweet@emailopened.ca",
|
34
|
+
name: "Sweet Person",
|
35
|
+
url: "http://sweet.com"
|
36
|
+
}
|
37
|
+
],
|
38
|
+
message_token: "3k4jk3jf"
|
39
|
+
)
|
40
|
+
puts response
|
41
|
+
```
|
42
|
+
|
43
|
+
To add a contact to a list:
|
44
|
+
|
45
|
+
```
|
46
|
+
eo = EmailOpened.new(CONFIG["eo_api_key"])
|
47
|
+
response = eo.add_contact(
|
48
|
+
contacts: [
|
31
49
|
{
|
32
|
-
email: "
|
33
|
-
name: "
|
50
|
+
email: "api@emailopened.ca",
|
51
|
+
name: "API Person",
|
52
|
+
url: "http://api.com",
|
53
|
+
list_ids: [1, 2]
|
34
54
|
}
|
35
|
-
]
|
36
|
-
list_ids: [1],
|
37
|
-
from: "Just Me <me@example.com>", // OR from: "me@example.com"
|
38
|
-
template_id: 19
|
55
|
+
]
|
39
56
|
)
|
57
|
+
puts response
|
40
58
|
```
|
41
59
|
|
42
60
|
## Contributing
|
data/lib/email-opened.rb
CHANGED
@@ -7,25 +7,6 @@ class EmailOpened
|
|
7
7
|
@eo_version = version
|
8
8
|
@eo_sandbox = sandbox
|
9
9
|
end
|
10
|
-
|
11
|
-
# To send a message:
|
12
|
-
#
|
13
|
-
# eo = EmailOpened.new(CONFIG["eo_api_key"])
|
14
|
-
# response = eo.send(
|
15
|
-
# to: [
|
16
|
-
# {
|
17
|
-
# email: "person@example.co",
|
18
|
-
# name: "One Person"
|
19
|
-
# shoe-size: 10
|
20
|
-
# },
|
21
|
-
# {
|
22
|
-
# email: "another@example.com",
|
23
|
-
# name: "Another Person",
|
24
|
-
# url: "http://awesome.com"
|
25
|
-
# }
|
26
|
-
# ],
|
27
|
-
# message_token: "dz5t0r"
|
28
|
-
# )
|
29
10
|
|
30
11
|
def headers
|
31
12
|
{
|
@@ -37,14 +18,21 @@ class EmailOpened
|
|
37
18
|
|
38
19
|
def send(message = {})
|
39
20
|
to = message[:to]
|
40
|
-
token = message[:
|
21
|
+
token = message[:message_token]
|
41
22
|
|
42
23
|
response = RestClient.post api_path + "messages", { "to[]" => to, token: token }, headers
|
43
24
|
puts response
|
44
25
|
end
|
45
26
|
|
46
27
|
def messages
|
47
|
-
response = RestClient.get api_path + "messages",
|
28
|
+
response = RestClient.get api_path + "messages", headers
|
29
|
+
puts response
|
30
|
+
end
|
31
|
+
|
32
|
+
def add_contact(contact = {})
|
33
|
+
contacts = contacts[:contacts]
|
34
|
+
|
35
|
+
response = RestClient.post api_path + "contacts", { "contacts[]" => contacts }, headers
|
48
36
|
puts response
|
49
37
|
end
|
50
38
|
|
data/lib/email-opened/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email-opened
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|