Class: Mixmax

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/mixmax.rb,
lib/mixmax/version.rb

Constant Summary collapse

VERSION =
"0.1.6"

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#headersObject (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_preferencesObject



33
34
35
# File 'lib/mixmax.rb', line 33

def user_preferences
  get '/v1/userpreferences/me'
end