mixmax 0.1.4 → 0.1.5

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: f6b31fb0624f540f9dfaa1b85082f9fa64b96ce07bbd9a7e7a95f7ec4b313f3f
4
- data.tar.gz: ee9a22950e92e99f1b9875db118adbbb6747b7be16ce989a748735b81c16ff1a
3
+ metadata.gz: 790cdc7140054c7aa0ea3411812e7ee37d24e9a1495b5a8dcf64cf52308d81c3
4
+ data.tar.gz: 594dd97027264668157c4b30b5f9e8021d4a2927b4dbb8228c49bbb33ac48183
5
5
  SHA512:
6
- metadata.gz: 5970d375b098415f1ba04dada9f97023ecaa5e6ac2e2602298bc3c6861cc0aaf2062dc80182fb2b99b0bf3e0e3e87a7141094986ce7899fb91796d14748d48c5
7
- data.tar.gz: 4117797998f7991c6b501e8d15b0d8c694e1738a90288c75dce695a7b4753d732ed7edfbf1878e44bf2ce429e1de09db47ce1a6b05cea438856a097718fffa23
6
+ metadata.gz: 60db9bdee532684576951ead08e12a14b472e411e1a1891d0497754c618dcc3686dc4a58dcfb3869fd3102664a4de325471b307def642328693983c84cca6e91
7
+ data.tar.gz: 99acf7e9ae75adc3fc2fa119ccbb7c3acabc22dedf4b18dbcb66b96402703b7b4cf43ae77d3dd65fdcb8bbbacaaa925a246200e7b1d33c75992cc2333c450d47
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- mixmax (0.1.3)
4
+ mixmax (0.1.4)
5
5
  httparty (~> 0.16.4)
6
6
 
7
7
  GEM
@@ -1,28 +1,54 @@
1
- require_relative "mixmax/version"
2
- require "httparty"
1
+ require_relative 'mixmax/version'
2
+ require 'httparty'
3
3
 
4
4
  class Mixmax
5
5
  include HTTParty
6
6
 
7
+ attr_reader :headers
8
+
7
9
  def initialize(api_key)
8
- @headers = { "X-API-Token" => api_key, "Content-Type" => "application/json"}
10
+ @headers = {
11
+ 'X-API-Token' => api_key, 'Content-Type' => 'application/json'
12
+ }
9
13
  end
10
14
 
11
- base_uri "https://api.mixmax.com"
15
+ base_uri 'https://api.mixmax.com'
12
16
 
13
- def sequences(query = {})
14
- self.class.get("/v1/sequences", headers: @headers, query: query).parsed_response["results"]
17
+ def sequences(query: {})
18
+ get('/v1/sequences', query: query)['results']
15
19
  end
16
20
 
17
21
  def sequence(id)
18
- self.class.get("/v1/sequences/#{id}", headers: @headers).parsed_response
22
+ get "/v1/sequences/#{id}"
19
23
  end
20
24
 
21
25
  def sequence_recipients(id)
22
- self.class.get("/v1/sequences/#{id}/recipients", headers: @headers)
26
+ get "/v1/sequences/#{id}/recipients"
27
+ end
28
+
29
+ def add_to_sequence(id, recipients:)
30
+ post "/v1/sequences/#{id}/recipients", query: recipients
31
+ end
32
+
33
+ def user_preferences
34
+ get '/v1/userpreferences/me'
35
+ end
36
+
37
+ def change_user_preferences(query: {})
38
+ patch '/v1/userpreferences/me', body: query
39
+ end
40
+
41
+ def remove_recipient_from_sequence(sequence_id:, recipient_id:)
42
+ post "/sequences/#{sequence_id}/recipients/#{recipient_id}/cancel"
43
+ end
44
+
45
+ private
46
+
47
+ def get(route, query: {})
48
+ self.class.get(route, headers: headers, body: query).parsed_response
23
49
  end
24
50
 
25
- def add_to_sequence(id, recipients)
26
- self.class.post("/v1/sequences/#{id}/recipients", headers: @headers, body: recipients)
51
+ def post(route, query: {})
52
+ self.class.post(route, headers: headers, body: query)
27
53
  end
28
54
  end
@@ -1,3 +1,3 @@
1
1
  class Mixmax
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  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
4
+ version: 0.1.5
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-05-16 00:00:00.000000000 Z
11
+ date: 2019-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -105,8 +105,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
105
  - !ruby/object:Gem::Version
106
106
  version: '0'
107
107
  requirements: []
108
- rubyforge_project:
109
- rubygems_version: 2.7.6
108
+ rubygems_version: 3.0.3
110
109
  signing_key:
111
110
  specification_version: 4
112
111
  summary: A ruby wrapper around MixMax's API