Class: Mixmax
- Inherits:
-
Object
- Object
- Mixmax
- Includes:
- HTTParty
- Defined in:
- lib/mixmax.rb,
lib/mixmax/version.rb
Constant Summary collapse
- VERSION =
"0.1.6"
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Instance Method Summary collapse
- #add_to_sequence(id, recipients:) ⇒ Object
- #change_user_preferences(query: {}) ⇒ Object
-
#initialize(api_key) ⇒ Mixmax
constructor
A new instance of Mixmax.
- #remove_recipient_from_sequence(sequence_id:, emails:) ⇒ Object
- #sequence(id) ⇒ Object
- #sequence_recipients(id) ⇒ Object
- #sequences(query: {}) ⇒ Object
- #user_preferences ⇒ Object
Constructor Details
#initialize(api_key) ⇒ Mixmax
Returns a new instance of Mixmax.
9 10 11 12 13 |
# File 'lib/mixmax.rb', line 9 def initialize(api_key) @headers = { 'X-API-Token' => api_key, 'Content-Type' => 'application/json' } end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
7 8 9 |
# File 'lib/mixmax.rb', line 7 def headers @headers end |
Instance Method Details
#add_to_sequence(id, recipients:) ⇒ Object
29 30 31 |
# File 'lib/mixmax.rb', line 29 def add_to_sequence(id, recipients:) post "/v1/sequences/#{id}/recipients", query: recipients end |
#change_user_preferences(query: {}) ⇒ Object
37 38 39 |
# File 'lib/mixmax.rb', line 37 def change_user_preferences(query: {}) patch '/v1/userpreferences/me', body: query end |
#remove_recipient_from_sequence(sequence_id:, emails:) ⇒ Object
41 42 43 |
# File 'lib/mixmax.rb', line 41 def remove_recipient_from_sequence(sequence_id:, emails:) post "/v1/sequences/#{sequence_id}/cancel", query: { emails: Array(emails) } end |
#sequence(id) ⇒ Object
21 22 23 |
# File 'lib/mixmax.rb', line 21 def sequence(id) get "/v1/sequences/#{id}" end |
#sequence_recipients(id) ⇒ Object
25 26 27 |
# File 'lib/mixmax.rb', line 25 def sequence_recipients(id) get "/v1/sequences/#{id}/recipients" end |
#sequences(query: {}) ⇒ Object
17 18 19 |
# File 'lib/mixmax.rb', line 17 def sequences(query: {}) get('/v1/sequences', query: query)['results'] end |
#user_preferences ⇒ Object
33 34 35 |
# File 'lib/mixmax.rb', line 33 def user_preferences get '/v1/userpreferences/me' end |