Class: Infusionsoft::Api::Model::ContactGroupAssign
- Inherits:
-
Base
- Object
- Base
- Infusionsoft::Api::Model::ContactGroupAssign
show all
- Defined in:
- lib/infusionsoft/api/models/contact_group_assign.rb
Instance Method Summary
collapse
Methods inherited from Base
#first, #initialize, #table_name
Instance Method Details
#all(query = {}, paginate = true, page_number = 0) ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/infusionsoft/api/models/contact_group_assign.rb', line 6
def all(query = {}, paginate = true, page_number = 0)
results = super(query, paginate, page_number)
results.map{|x|{
'Id' => x['ContactId'],
'GroupId' => x['GroupId'],
'FirstName' => x['Contact.FirstName'],
'LastName' => x['Contact.LastName'],
'Company' => x['Contact.Company'],
'Email' => x['Contact.Email'],
'ContactGroup' => x['ContactGroup'],
}}
end
|
#create(data = {}) ⇒ Object
19
20
21
22
|
# File 'lib/infusionsoft/api/models/contact_group_assign.rb', line 19
def create(data = {})
data = standardise_query(data)
@client.connection.call('ContactService.addToGroup', @client.api_key, data[:ContactId], data[:GroupId])
end
|
#delete(query = {}) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/infusionsoft/api/models/contact_group_assign.rb', line 24
def delete(query = {})
query = standardise_query(query)
if query[:ContactId] && query[:GroupId]
@client.connection.call('ContactService.removeFromGroup', @client.api_key, query[:ContactId], query[:GroupId])
else
self.all(query).each do |data|
self.delete({
:ContactId => data['Id'],
:GroupId => data['GroupId'],
})
end
end
end
|
#fields ⇒ Object
38
39
40
|
# File 'lib/infusionsoft/api/models/contact_group_assign.rb', line 38
def fields
[:'ContactGroup', :'ContactId', :'GroupId', :'Contact.FirstName', :'Contact.LastName', :'Contact.Company', :'Contact.Email']
end
|