mixmax 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '09fc31d21d16cc4adbde40eca71dd32dd11111aec293ea111381de2862defead'
4
- data.tar.gz: aa69a44cb95b91a49c608c53caadf98b5dcfd747e29ea5c7f0bdaf768cc1bcac
3
+ metadata.gz: 35620c083cb524d5d57c0605b0ef100077d65f3d2a7cdfa03a2f6b97c6881299
4
+ data.tar.gz: 2c0c7c7d472a69177739f8fa52826f0c978b64a9773b9313bdf9b87e892e6650
5
5
  SHA512:
6
- metadata.gz: fe1086d68b59cacacee50f972fa470365a61f3ca76c7172e8b9696df23957cd8c9d2f9dc3f1b88fc9a51958d86fa42b718d851874855393ff57cdf1eb72ff753
7
- data.tar.gz: 98ed08df556f8e068d2ff0b57a3727689709549e66b7ebf3c375493ee0789b13272b26ba6a33180eb54f4dcb94322116d39716e67fa90f168d463128452fc6bd
6
+ metadata.gz: b031431be57900a60c2bdf0b9a0ce2de18ea834732cdccb60e05d2af2ff98751a6fe93de53eba0ec333887adbad193afa75004ba5d510efcc8317bebbb3cc327
7
+ data.tar.gz: 82a26897e4c305d517f0461cf309892c47575fab6f643986e2c64fed582b0cc1153d5b588948c758012d4fa65dc866a522d46456ebb7f5fcf8211219c2507740
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mixmax (0.1.0)
4
+ mixmax (0.1.1)
5
5
  httparty (~> 0.16.4)
6
6
 
7
7
  GEM
data/lib/mixmax.rb CHANGED
@@ -1,20 +1,53 @@
1
- require "mixmax/version"
1
+ require_relative "mixmax/version"
2
2
  require "httparty"
3
3
 
4
- module Mixmax
4
+ class Mixmax
5
5
  include HTTParty
6
+
7
+ def initialize(api_key)
8
+ @headers = { "X-API-Token" => api_key}
9
+ end
10
+
6
11
  base_uri "api.mixmax.com"
7
- # api_key = '90aa4d9c-53a0-41a8-860e-7a995a9a2f4e'
8
- # headers = {
9
- # "X-API-Token" => api_key
10
- # }
11
12
 
13
+ def sequences
14
+ self.class.get("/v1/sequences", headers: @headers).parsed_response["results"]
15
+ end
12
16
 
13
- def self.sequences
14
- get("/v1/sequences", :headers => { "X-API-Token" => "90aa4d9c-53a0-41a8-860e-7a995a9a2f4e"})
17
+ def sequence_recipients(id)
18
+ self.class.get("/v1/sequences/#{id}", headers: @headers)
19
+ end
20
+
21
+ def add_to_sequence(id, recipients)
22
+ self.class.post("/v1/sequences/#{id}/recipients", headers: @headers, body: recipients)
15
23
  end
16
24
  end
17
25
 
18
26
 
19
27
  # Mixmax.add_to_sequence(id, recipients)
20
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 }'
@@ -1,3 +1,3 @@
1
- module Mixmax
2
- VERSION = "0.1.1"
1
+ class Mixmax
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixmax
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miguel Torres