mixmax 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +43 -8
- data/lib/mixmax.rb +2 -31
- data/lib/mixmax/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c3c49b9fde89101939ce659ea756833b112502ba0924f27dc5ffff6ae0f227b
|
4
|
+
data.tar.gz: 990e2227343e8c42ca8580f7a8d5f82505f4f909cc74034599bc339071f105ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f9dbbdf10cd61353102c8a50ccf280c2bf7ed4dce94aa699d8aca79fe163b5de2fcfd9a6209a1d6cf0b012ecd52de989a18b06d40b484bc214809e863404ffcc
|
7
|
+
data.tar.gz: e7baca13ad01c517bf194278e545497741a8ee84c779c4bd5522ca9da6155b0a6cd9bbb5d3c95226910137b4cf807351a3c7ae90aad712a97c55869fab5ba1d5
|
data/README.md
CHANGED
@@ -1,9 +1,3 @@
|
|
1
|
-
# Mixmax
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/mixmax`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
6
|
-
|
7
1
|
## Installation
|
8
2
|
|
9
3
|
Add this line to your application's Gemfile:
|
@@ -22,7 +16,48 @@ Or install it yourself as:
|
|
22
16
|
|
23
17
|
## Usage
|
24
18
|
|
25
|
-
|
19
|
+
First you need to initialize a new instance of Mixmax and pass in your API key
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
mixmax = Mixmax.new 'API_KEY'
|
23
|
+
```
|
24
|
+
|
25
|
+
If you're using rails, then you probably want to put it in your initializers:
|
26
|
+
|
27
|
+
**config/initializers/mixmax.rb**
|
28
|
+
```ruby
|
29
|
+
MixmaxApi = Mixmax.new Rails.applications.credentials.mixmax_secret_key
|
30
|
+
```
|
31
|
+
|
32
|
+
Now you can do stuff like:
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
mixmax.sequences
|
36
|
+
# => [{"_id"=>"5ca6452dbf0cjs0jdf35800d7ed", "userId"=>"5ca50420262cdj2ie9361d39", "createdAt"=>"2019-04-04T17:55:57.201Z", "variables"=>["Email"], "linkTrackingEnabled"=>false, "fileTrackingEnabled"=>false, "notificationsEnabled"=>false, "name"=>"Mickey Mouse", "timezone"=>"America/Mexico_City", "stages"=>["5ca6452d9353js03kgfh20e5b8c2", "5ca64560cfj30dnwl5eef0ffa"], "bcc"=>nil, "cc"=>nil, "teamIds"=>nil}]
|
37
|
+
```
|
38
|
+
```ruby
|
39
|
+
mixmax.sequence_recipients 'SEQUENCE_ID'
|
40
|
+
|
41
|
+
recipients = '{
|
42
|
+
"recipients": [{
|
43
|
+
"email": "hello@mixmax.com",
|
44
|
+
"variables": {
|
45
|
+
"name": "Hugo Brockman",
|
46
|
+
"email": "hello@mixmax.com"
|
47
|
+
}
|
48
|
+
},
|
49
|
+
{
|
50
|
+
"email": "careers@mixmax.com",
|
51
|
+
"variables": {
|
52
|
+
"name": "Mixmax hello",
|
53
|
+
"email": "careers@mixmax.com"
|
54
|
+
}
|
55
|
+
}],
|
56
|
+
"scheduledAt": 1490300970312
|
57
|
+
}'
|
58
|
+
|
59
|
+
mixmax.add_to_sequence('SEQUENCE_ID', recipients)
|
60
|
+
```
|
26
61
|
|
27
62
|
## Development
|
28
63
|
|
@@ -32,7 +67,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
32
67
|
|
33
68
|
## Contributing
|
34
69
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
70
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mickeytgl/mixmax.
|
36
71
|
|
37
72
|
## License
|
38
73
|
|
data/lib/mixmax.rb
CHANGED
@@ -5,7 +5,7 @@ class Mixmax
|
|
5
5
|
include HTTParty
|
6
6
|
|
7
7
|
def initialize(api_key)
|
8
|
-
@headers = { "X-API-Token" => api_key}
|
8
|
+
@headers = { "X-API-Token" => api_key, "Content-Type" => "application/json"}
|
9
9
|
end
|
10
10
|
|
11
11
|
base_uri "api.mixmax.com"
|
@@ -15,39 +15,10 @@ class Mixmax
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def sequence_recipients(id)
|
18
|
-
self.class.get("/v1/sequences/#{id}", headers: @headers)
|
18
|
+
self.class.get("/v1/sequences/#{id}/recipients", headers: @headers)
|
19
19
|
end
|
20
20
|
|
21
21
|
def add_to_sequence(id, recipients)
|
22
22
|
self.class.post("/v1/sequences/#{id}/recipients", headers: @headers, body: recipients)
|
23
23
|
end
|
24
24
|
end
|
25
|
-
|
26
|
-
|
27
|
-
# Mixmax.add_to_sequence(id, recipients)
|
28
|
-
# Mixmax.sequences
|
29
|
-
#
|
30
|
-
# curl -XPOST \
|
31
|
-
# --header 'Content-Type: application/json' \
|
32
|
-
# --header "X-API-Token: <your token>" \
|
33
|
-
# https://api.mixmax.com/v1/sequences/593HF9J3IJ4JF30IF/recipients \
|
34
|
-
# -d '{
|
35
|
-
# "recipients": [{
|
36
|
-
# "email": "hello@mixmax.com",
|
37
|
-
# "variables": {
|
38
|
-
# "name": "Hugo Brockman",
|
39
|
-
# "email": "hello@mixmax.com"
|
40
|
-
# }
|
41
|
-
# },
|
42
|
-
# {
|
43
|
-
# "email": "careers@mixmax.com",
|
44
|
-
# "variables": {
|
45
|
-
# "name": "Mixmax hello",
|
46
|
-
# "email": "careers@mixmax.com"
|
47
|
-
# }
|
48
|
-
# }],
|
49
|
-
# "scheduledAt": 1490300970312
|
50
|
-
# }'
|
51
|
-
#
|
52
|
-
|
53
|
-
# '{ "recipients": [{ "email": "migueltg93@gmail.com", "variables": { "name": "Mickey Mouse", "email": "mickeymouse@mailinator.com" }}], "scheduledAt": 1554404018 }'
|
data/lib/mixmax/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mixmax
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Torres
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|