Class: Mautic::Campaign

Inherits:
Model
  • Object
show all
Defined in:
app/models/mautic/campaign.rb

Instance Attribute Summary

Attributes inherited from Model

#changed, #connection, #errors

Instance Method Summary collapse

Methods inherited from Model

#attributes, #attributes=, #changed?, #changes, #create, #destroy, endpoint, in, #initialize, #mautic_id, #save, #to_mautic, #update, #update_columns

Constructor Details

This class inherits a constructor from Mautic::Model

Instance Method Details

#add_contact!(id) ⇒ Object

Parameters:

  • id (Integer)

    of Mautic::Contact

See Also:



6
7
8
9
10
11
# File 'app/models/mautic/campaign.rb', line 6

def add_contact!(id)
  json = @connection.request(:post, "api/campaigns/#{self.id}/contact/#{id}/add")
  json["success"]
rescue RequestError => _e
  false
end

#remove_contact!(id) ⇒ Object

Parameters:

  • id (Integer)

    of Mautic::Contact

See Also:



15
16
17
18
19
20
# File 'app/models/mautic/campaign.rb', line 15

def remove_contact!(id)
  json = @connection.request(:post, "api/campaigns/#{self.id}/contact/#{id}/remove")
  json["success"]
rescue RequestError => _e
  false
end