mixmax 0.1.0 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -4
- data/Gemfile.lock +43 -0
- data/README.md +43 -8
- data/lib/mixmax.rb +58 -6
- data/lib/mixmax/version.rb +2 -2
- data/mixmax.gemspec +6 -8
- metadata +10 -10
- data/tags +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e142d54d7660249a543181266a988344a188d315d0aae84dc5ce83ae0fb0c58
|
4
|
+
data.tar.gz: d4c89f88caa45ad1fe80968c4d278669c502e4a9a72149e15498c74e98dbff38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5c0e233d03b4943e97508b928f2c57499bbef4ad51d9af4df9f609385299c3dfa0484c518ca7c9f83f73e86bcde4e526434d26d013bf013ec9d437f62c12b9c
|
7
|
+
data.tar.gz: ecd1a81f20887f9e81133ea466a91e16005312cceb39f3eb3a03bc0e8c6989e72dbbad8fc8476f8aed7373de577029b20503289d2ea79a8d513ba1016e2c4d73
|
data/.travis.yml
CHANGED
data/Gemfile.lock
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mixmax (0.1.5)
|
5
|
+
httparty (~> 0.16.4)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
diff-lcs (1.3)
|
11
|
+
httparty (0.16.4)
|
12
|
+
mime-types (~> 3.0)
|
13
|
+
multi_xml (>= 0.5.2)
|
14
|
+
mime-types (3.2.2)
|
15
|
+
mime-types-data (~> 3.2015)
|
16
|
+
mime-types-data (3.2019.0331)
|
17
|
+
multi_xml (0.6.0)
|
18
|
+
rake (10.5.0)
|
19
|
+
rspec (3.8.0)
|
20
|
+
rspec-core (~> 3.8.0)
|
21
|
+
rspec-expectations (~> 3.8.0)
|
22
|
+
rspec-mocks (~> 3.8.0)
|
23
|
+
rspec-core (3.8.0)
|
24
|
+
rspec-support (~> 3.8.0)
|
25
|
+
rspec-expectations (3.8.3)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.8.0)
|
28
|
+
rspec-mocks (3.8.0)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.8.0)
|
31
|
+
rspec-support (3.8.0)
|
32
|
+
|
33
|
+
PLATFORMS
|
34
|
+
ruby
|
35
|
+
|
36
|
+
DEPENDENCIES
|
37
|
+
bundler (~> 1.16)
|
38
|
+
mixmax!
|
39
|
+
rake (~> 10.0)
|
40
|
+
rspec (~> 3.0)
|
41
|
+
|
42
|
+
BUNDLED WITH
|
43
|
+
1.17.2
|
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
@@ -1,10 +1,62 @@
|
|
1
|
-
|
1
|
+
require_relative 'mixmax/version'
|
2
|
+
require 'httparty'
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
4
|
+
class Mixmax
|
5
|
+
include HTTParty
|
6
|
+
|
7
|
+
attr_reader :headers
|
8
|
+
|
9
|
+
def initialize(api_key)
|
10
|
+
@headers = {
|
11
|
+
'X-API-Token' => api_key, 'Content-Type' => 'application/json'
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
base_uri 'https://api.mixmax.com'
|
16
|
+
|
17
|
+
def sequences(query: {}, all: false)
|
18
|
+
sequences = []
|
19
|
+
next_param = ''
|
20
|
+
|
21
|
+
loop do
|
22
|
+
response = get "/v1/sequences/#{next_param}"
|
23
|
+
sequences += response['results']
|
24
|
+
return sequences unless response['hasNext'] && all
|
25
|
+
next_param = "?next=#{response['next']}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def sequence(sequence_id)
|
30
|
+
get "/v1/sequences/#{sequence_id}"
|
31
|
+
end
|
32
|
+
|
33
|
+
def sequence_recipients(sequence_id)
|
34
|
+
get "/v1/sequences/#{sequence_id}/recipients"
|
35
|
+
end
|
36
|
+
|
37
|
+
def add_to_sequence(sequence_id, recipients:)
|
38
|
+
post "/v1/sequences/#{sequence_id}/recipients", query: recipients
|
39
|
+
end
|
40
|
+
|
41
|
+
def user_preferences
|
42
|
+
get '/v1/userpreferences/me'
|
6
43
|
end
|
7
44
|
|
8
|
-
|
9
|
-
|
45
|
+
def change_user_preferences(query: {})
|
46
|
+
patch '/v1/userpreferences/me', body: query
|
47
|
+
end
|
48
|
+
|
49
|
+
def remove_recipient_from_sequence(sequence_id, emails:)
|
50
|
+
post "/v1/sequences/#{sequence_id}/cancel", query: { emails: Array(emails) }
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
def get(route, query: {})
|
56
|
+
self.class.get(route, headers: headers, body: query.to_json).parsed_response
|
57
|
+
end
|
58
|
+
|
59
|
+
def post(route, query: {})
|
60
|
+
self.class.post(route, headers: headers, body: query.to_json)
|
61
|
+
end
|
10
62
|
end
|
data/lib/mixmax/version.rb
CHANGED
@@ -1,3 +1,3 @@
|
|
1
|
-
|
2
|
-
VERSION = "0.1.
|
1
|
+
class Mixmax
|
2
|
+
VERSION = "0.1.9"
|
3
3
|
end
|
data/mixmax.gemspec
CHANGED
@@ -9,21 +9,19 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["Miguel Torres"]
|
10
10
|
spec.email = ["migueltg93@gmail.com"]
|
11
11
|
|
12
|
-
spec.summary = %q{
|
13
|
-
spec.
|
14
|
-
spec.homepage = "https://github.com/mickeytgl/mixmax2"
|
12
|
+
spec.summary = %q{A ruby wrapper around MixMax's API}
|
13
|
+
spec.homepage = "https://github.com/mickeytgl/mixmax"
|
15
14
|
spec.license = "MIT"
|
16
|
-
|
17
|
-
|
18
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
15
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
16
|
+
f.match(%r{^(test|spec|features)/})
|
19
17
|
end
|
20
18
|
spec.bindir = "exe"
|
21
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
20
|
spec.require_paths = ["lib"]
|
23
21
|
|
24
|
-
spec.add_development_dependency "bundler", "~> 1.
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.16"
|
25
23
|
spec.add_development_dependency "rake", "~> 10.0"
|
26
24
|
spec.add_development_dependency "rspec", "~> 3.0"
|
27
25
|
|
28
|
-
spec.add_dependency "httparty", "~> 0.
|
26
|
+
spec.add_dependency "httparty", "~> 0.16.4"
|
29
27
|
end
|
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.9
|
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-11
|
11
|
+
date: 2019-09-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1.
|
19
|
+
version: '1.16'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1.
|
26
|
+
version: '1.16'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -58,15 +58,15 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.16.4
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
69
|
-
description:
|
68
|
+
version: 0.16.4
|
69
|
+
description:
|
70
70
|
email:
|
71
71
|
- migueltg93@gmail.com
|
72
72
|
executables: []
|
@@ -77,6 +77,7 @@ files:
|
|
77
77
|
- ".rspec"
|
78
78
|
- ".travis.yml"
|
79
79
|
- Gemfile
|
80
|
+
- Gemfile.lock
|
80
81
|
- LICENSE.txt
|
81
82
|
- README.md
|
82
83
|
- Rakefile
|
@@ -85,8 +86,7 @@ files:
|
|
85
86
|
- lib/mixmax.rb
|
86
87
|
- lib/mixmax/version.rb
|
87
88
|
- mixmax.gemspec
|
88
|
-
|
89
|
-
homepage: https://github.com/mickeytgl/mixmax2
|
89
|
+
homepage: https://github.com/mickeytgl/mixmax
|
90
90
|
licenses:
|
91
91
|
- MIT
|
92
92
|
metadata: {}
|
@@ -108,5 +108,5 @@ requirements: []
|
|
108
108
|
rubygems_version: 3.0.3
|
109
109
|
signing_key:
|
110
110
|
specification_version: 4
|
111
|
-
summary:
|
111
|
+
summary: A ruby wrapper around MixMax's API
|
112
112
|
test_files: []
|
data/tags
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/
|
2
|
-
!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/
|
3
|
-
!_TAG_OUTPUT_MODE u-ctags /u-ctags or e-ctags/
|
4
|
-
!_TAG_PROGRAM_AUTHOR Universal Ctags Team //
|
5
|
-
!_TAG_PROGRAM_NAME Universal Ctags /Derived from Exuberant Ctags/
|
6
|
-
!_TAG_PROGRAM_URL https://ctags.io/ /official site/
|
7
|
-
!_TAG_PROGRAM_VERSION 0.0.0 /2614dbe/
|
8
|
-
Contributing README.md /^## Contributing$/;" s
|
9
|
-
Development README.md /^## Development$/;" s
|
10
|
-
Error lib/mixmax.rb /^ class Error < StandardError; end$/;" c module:Mixmax
|
11
|
-
Installation README.md /^## Installation$/;" s
|
12
|
-
License README.md /^## License$/;" s
|
13
|
-
Mixmax README.md /^# Mixmax$/;" c
|
14
|
-
Mixmax lib/mixmax.rb /^module Mixmax$/;" m
|
15
|
-
Mixmax lib/mixmax/version.rb /^module Mixmax$/;" m
|
16
|
-
Mixmax spec/mixmax_spec.rb /^RSpec.describe Mixmax do$/;" d
|
17
|
-
Usage README.md /^## Usage$/;" s
|
18
|
-
hello lib/mixmax.rb /^ def self.hello$/;" S module:Mixmax
|