infusionsoft 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +7 -2
- data/lib/infusionsoft.rb +0 -1
- data/lib/infusionsoft/client.rb +4 -2
- data/lib/infusionsoft/client/affiliate.rb +37 -27
- data/lib/infusionsoft/client/contact.rb +131 -87
- data/lib/infusionsoft/client/data.rb +98 -56
- data/lib/infusionsoft/client/email.rb +111 -61
- data/lib/infusionsoft/client/file.rb +0 -3
- data/lib/infusionsoft/client/invoice.rb +211 -85
- data/lib/infusionsoft/client/search.rb +64 -0
- data/lib/infusionsoft/client/ticket.rb +6 -6
- data/lib/infusionsoft/version.rb +1 -1
- metadata +5 -4
data/README.md
CHANGED
@@ -1,14 +1,19 @@
|
|
1
1
|
# The Infusionsoft Ruby Gem
|
2
2
|
A Ruby wrapper for the Infusionsoft API
|
3
3
|
|
4
|
+
**This is a complete rewrite and has been implemented as a RubyGem**
|
5
|
+
All previous versions will need to update their calls to follow the new schema
|
6
|
+
|
4
7
|
## <a name="installation">Installation</a>
|
5
8
|
gem install infusionsoft
|
6
9
|
|
7
10
|
## <a name="documentation">Documentation</a>
|
8
|
-
|
11
|
+
[http://rubydoc.info/gems/infusionsoft/1.0.2/frames](http://rubydoc.info/gems/infusionsoft/1.0.2/frames)
|
9
12
|
|
10
13
|
## <a name="setup">Setup & Configuration</a>
|
11
|
-
For Rails
|
14
|
+
For Rails 2.3 add `config.gem 'infusionsoft'` or for Rails 3 add it to Bundler
|
15
|
+
|
16
|
+
Then create an initilizer in `config\initilizers` called infusionsoft.rb and the following
|
12
17
|
|
13
18
|
Infusionsoft.configure do |config|
|
14
19
|
config.api_url = 'YOUR_INFUSIONSOFT_URL' # example infused.infusionsoft.com
|
data/lib/infusionsoft.rb
CHANGED
data/lib/infusionsoft/client.rb
CHANGED
@@ -12,7 +12,8 @@ module Infusionsoft
|
|
12
12
|
require 'infusionsoft/client/data'
|
13
13
|
require 'infusionsoft/client/affiliate'
|
14
14
|
require 'infusionsoft/client/file'
|
15
|
-
require 'infusionsoft/client/ticket'
|
15
|
+
require 'infusionsoft/client/ticket' # Deprecated by Infusionsoft
|
16
|
+
require 'infusionsoft/client/search'
|
16
17
|
|
17
18
|
include Infusionsoft::Client::Contact
|
18
19
|
include Infusionsoft::Client::Email
|
@@ -20,6 +21,7 @@ module Infusionsoft
|
|
20
21
|
include Infusionsoft::Client::Data
|
21
22
|
include Infusionsoft::Client::Affiliate
|
22
23
|
include Infusionsoft::Client::File
|
23
|
-
include Infusionsoft::Client::Ticket
|
24
|
+
include Infusionsoft::Client::Ticket # Deprecated by Infusionsoft
|
25
|
+
include Infusionsoft::Client::Search
|
24
26
|
end
|
25
27
|
end
|
@@ -1,51 +1,61 @@
|
|
1
1
|
module Infusionsoft
|
2
2
|
class Client
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
# The Affiliate service is used to pull commission data and activities for affiliates.
|
4
|
+
# With this service, you have access to Clawbacks, Commissions, Payouts, Running Totals,
|
5
|
+
# and the Activity Summary. The methods in the Affiliate service mirror the reports
|
6
|
+
# produced inside Infusionsoft.
|
7
|
+
#
|
8
|
+
# @note To manage affiliate information (ie Name, Phone, etc.) you will need to use the Data service.
|
6
9
|
module Affiliate
|
7
|
-
#
|
10
|
+
# Used when you need to retrieve all clawed back commissions for a particular affiliate.
|
8
11
|
#
|
9
|
-
# @
|
10
|
-
# @
|
11
|
-
# @end_date [Date]
|
12
|
+
# @param [Integer] affiliate_id
|
13
|
+
# @params [Date] start_date
|
14
|
+
# @end_date [Date] end_date
|
15
|
+
# @return [Array] all claw backs for the given affiliate that have occurred within the date
|
16
|
+
# range specified
|
12
17
|
def affiliate_clawbacks(affiliate_id, start_date, end_date)
|
13
|
-
response = get('APIAffiliateService
|
18
|
+
response = get('APIAffiliateService.affClawbacks', affiliate_id, start_date, end_date)
|
14
19
|
end
|
15
20
|
|
16
|
-
#
|
21
|
+
# Used to retrieve all commissions for a specific affiliate within a date range.
|
17
22
|
#
|
18
|
-
# @
|
19
|
-
# @
|
20
|
-
# @
|
23
|
+
# @param [Integer] affiliate_id
|
24
|
+
# @param [Date] start_date
|
25
|
+
# @param [Date] end_date
|
26
|
+
# @return [Array] all sales commissions for the given affiliate earned within the date range
|
27
|
+
# specified
|
21
28
|
def affiliate_commissions(affiliate_id, start_date, end_date)
|
22
|
-
response = get('APIAffiliateService
|
29
|
+
response = get('APIAffiliateService.affCommissions', affiliate_id, start_date, end_date)
|
23
30
|
end
|
24
31
|
|
25
|
-
#
|
32
|
+
# Used to retrieve all payments for a specific affiliate within a date range.
|
26
33
|
#
|
27
|
-
# @
|
28
|
-
# @
|
29
|
-
# @
|
34
|
+
# @param [Integer] affiliate_id
|
35
|
+
# @param [Date] start_date
|
36
|
+
# @param [Date] end_date
|
37
|
+
# @return [Array] a list of rows, each row is a single payout
|
30
38
|
def affiliate_payouts(affiliate_id, start_date, end_date)
|
31
|
-
response = get('APIAffiliateService
|
39
|
+
response = get('APIAffiliateService.affPayouts', affiliate_id, start_date, end_date)
|
32
40
|
end
|
33
41
|
|
34
|
-
#
|
35
|
-
# one of the names above, and value being the total for the variable
|
42
|
+
# This method is used to retrieve all commissions for a specific affiliate within a date range.
|
36
43
|
#
|
37
|
-
# @
|
44
|
+
# @param [Array] affiliate_list
|
45
|
+
# @return [Array] all sales commissions for the given affiliate earned within the date range
|
46
|
+
# specified
|
38
47
|
def affiliate_running_totals(affiliate_list)
|
39
|
-
response = get('APIAffiliateService
|
48
|
+
response = get('APIAffiliateService.affRunningTotals', affiliate_list)
|
40
49
|
end
|
41
50
|
|
42
|
-
#
|
51
|
+
# Used to retrieve a summary of statistics for a list of affiliates.
|
43
52
|
#
|
44
|
-
# @
|
45
|
-
# @
|
46
|
-
# @
|
53
|
+
# @param [Array] affiliate_list
|
54
|
+
# @param [Date] start_date
|
55
|
+
# @param [Date] end_date
|
56
|
+
# @return [Array<Hash>] a summary of the affiliates information for a specified date range
|
47
57
|
def affiliate_summary(affiliate_list, start_date, end_date)
|
48
|
-
response = get('APIAffiliateService
|
58
|
+
response = get('APIAffiliateService.affSummary', affiliate_list, start_date, end_date)
|
49
59
|
end
|
50
60
|
end
|
51
61
|
end
|
@@ -1,143 +1,187 @@
|
|
1
1
|
module Infusionsoft
|
2
2
|
class Client
|
3
|
-
|
4
|
-
|
5
|
-
########################
|
3
|
+
# Contact service is used to manage contacts. You can add, update and find contacts in
|
4
|
+
# addition to managing follow up sequences, tags and action sets.
|
6
5
|
module Contact
|
7
|
-
#
|
6
|
+
# Creates a new contact record from the data passed in the associative array.
|
8
7
|
#
|
9
|
-
# @
|
10
|
-
# @
|
11
|
-
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
# Adds a contact to the database, then opts in the email address
|
16
|
-
#
|
17
|
-
# @data = [Hash]
|
18
|
-
# @example data = {:EmailAddress1 => 'test@test.com', :FirstName => 'first_name', :LastName => 'last_name'}
|
19
|
-
# @returns [Integer] This is the id of the newly added contact
|
8
|
+
# @param [Hash] data contains the mappable contact fields and it's data
|
9
|
+
# @return [Integer] the id of the newly added contact
|
10
|
+
# @example
|
11
|
+
# { :Email => 'test@test.com', :FirstName => 'first_name', :LastName => 'last_name' }
|
20
12
|
def contact_add(data)
|
21
13
|
contact_id = get('ContactService.add', data)
|
22
|
-
if data.has_key?("Email");
|
14
|
+
if data.has_key?("Email"); email_optin(data["Email"], "requested information"); end
|
23
15
|
return contact_id
|
24
16
|
end
|
25
17
|
|
26
|
-
#
|
18
|
+
# Adds or updates a contact record based on matching data
|
27
19
|
#
|
28
|
-
# @
|
29
|
-
# @
|
30
|
-
#
|
31
|
-
# @
|
32
|
-
|
33
|
-
|
34
|
-
def contact_add_recurring_order(contact_id, allow_duplicate, cprogram_id, merchant_account_id, credit_card_id, affiliate_id,
|
35
|
-
days_till_charge)
|
36
|
-
response = get('ContactService','addRecurringOrder', contact_id, allow_duplicate, cprogram_id,
|
37
|
-
merchant_account_id, credit_card_id, affiliate_id, days_till_charge)
|
20
|
+
# @param [Array<Hash>] data the contact data you want added
|
21
|
+
# @param [String] check_type available options are 'Email', 'EmailAndName',
|
22
|
+
# 'EmailAndNameAndCompany'
|
23
|
+
# @return [Integer] id of the contact added or updated
|
24
|
+
def contact_add_with_dup_check(data, check_type)
|
25
|
+
response = get('ContactService.addWithDupCheck', data, check_type)
|
38
26
|
end
|
39
27
|
|
40
|
-
#
|
28
|
+
# Updates a contact in the database.
|
41
29
|
#
|
42
|
-
# @
|
43
|
-
# @
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
30
|
+
# @param [Integer] contact_id
|
31
|
+
# @param [Hash] data contains the mappable contact fields and it's data
|
32
|
+
# @return [Integer] the id of the contact updated
|
33
|
+
# @example
|
34
|
+
# { :FirstName => 'first_name', :StreetAddress1 => '123 N Street' }
|
35
|
+
def contact_update(contact_id, data)
|
36
|
+
bool = get('ContactService.update', contact_id, data)
|
37
|
+
if data.has_key?("Email"); email_optin(data["Email"], "requested information"); end
|
38
|
+
return bool
|
50
39
|
end
|
51
40
|
|
52
41
|
# Loads a contact from the database
|
53
42
|
#
|
54
|
-
# @
|
55
|
-
# @
|
43
|
+
# @param [Integer] id
|
44
|
+
# @param [Array] selected_fields the list of fields you want back
|
45
|
+
# @return [Array] the fields returned back with it's data
|
46
|
+
# @example this is what you would get back
|
47
|
+
# { "FirstName" => "John", "LastName" => "Doe" }
|
56
48
|
def contact_load(id, selected_fields)
|
57
|
-
response = get('ContactService
|
49
|
+
response = get('ContactService.load', id, selected_fields)
|
58
50
|
end
|
59
51
|
|
60
|
-
|
61
|
-
|
52
|
+
# Finds all contacts with the supplied email address in any of the three contact record email
|
53
|
+
# addresses.
|
54
|
+
#
|
55
|
+
# @param [String] email
|
56
|
+
# @param [Array] selected_fields the list of fields you want with it's data
|
57
|
+
# @return [Array<Hash>] the list of contacts with it's fields and data
|
58
|
+
def contact_find_by_email(email, selected_fields)
|
59
|
+
response = get('ContactService.findByEmail', email, selected_fields)
|
62
60
|
end
|
63
61
|
|
64
|
-
|
65
|
-
|
62
|
+
# Adds a contact to a follow-up sequence (campaigns were the original name of follow-up sequences).
|
63
|
+
#
|
64
|
+
# @param [Integer] contact_id
|
65
|
+
# @param [Integer] campaign_id
|
66
|
+
# @return [Boolean] returns true/false if the contact was added to the follow-up sequence
|
67
|
+
# successfully
|
68
|
+
def contact_add_to_campaign(contact_id, campaign_id)
|
69
|
+
response = get('ContactService.addToCampaign', contact_id, campaign_id)
|
66
70
|
end
|
67
71
|
|
68
|
-
#
|
72
|
+
# Returns the Id number of the next follow-up sequence step for the given contact.
|
69
73
|
#
|
70
|
-
# @
|
71
|
-
# @
|
72
|
-
|
73
|
-
|
74
|
+
# @param [Integer] contact_id
|
75
|
+
# @param [Integer] campaign_id
|
76
|
+
# @return [Integer] id number of the next unfishished step in the given follow up sequence
|
77
|
+
# for the given contact
|
78
|
+
def contact_get_next_campaign_step(contact_id, campaign_id)
|
79
|
+
response = get('ContactService.getNextCampaignStep', contact_id, campaign_id)
|
74
80
|
end
|
75
81
|
|
76
|
-
# Pauses a
|
82
|
+
# Pauses a follow-up sequence for the given contact record
|
77
83
|
#
|
78
|
-
# @
|
79
|
-
# @
|
84
|
+
# @param [Integer] contact_id
|
85
|
+
# @param [Integer] campaign_id
|
86
|
+
# @return [Boolean] returns true/false if the sequence was paused
|
80
87
|
def contact_pause_campaign(contact_id, campaign_id)
|
81
|
-
response = get('ContactService
|
88
|
+
response = get('ContactService.pauseCampaign', contact_id, campaign_id)
|
82
89
|
end
|
83
90
|
|
84
|
-
# Removes a
|
91
|
+
# Removes a follow-up sequence from a contact record
|
85
92
|
#
|
86
|
-
# @
|
87
|
-
# @
|
93
|
+
# @param [Integer] contact_id
|
94
|
+
# @param [Integer] campaign_id
|
95
|
+
# @return [Boolean] returns true/false if removed
|
88
96
|
def contact_remove_from_campaign(contact_id, campaign_id)
|
89
|
-
response = get('ContactService
|
97
|
+
response = get('ContactService.removeFromCampaign', contact_id, campaign_id)
|
90
98
|
end
|
91
99
|
|
92
|
-
#
|
100
|
+
# Resumes a follow-up sequence that has been stopped/paused for a given contact.
|
93
101
|
#
|
94
|
-
# @
|
95
|
-
# @
|
96
|
-
|
97
|
-
|
102
|
+
# @param [Integer] contact_id
|
103
|
+
# @param [Ingeger] campaign_id
|
104
|
+
# @return [Boolean] returns true/false if sequence was resumed
|
105
|
+
def contact_resume_campaign(contact_id, campaign_id)
|
106
|
+
response = get('ConactService.resumeCampaignForContact', contact_id, campaign_id)
|
98
107
|
end
|
99
108
|
|
100
|
-
#
|
109
|
+
# Immediately performs the given follow-up sequence step_id for the given contacts.
|
101
110
|
#
|
102
|
-
# @
|
103
|
-
# @
|
104
|
-
|
105
|
-
|
111
|
+
# @param [Array<Integer>] list_of_contacts
|
112
|
+
# @param [Integer] ) step_id
|
113
|
+
# @return [Boolean] returns true/false if the step was rescheduled
|
114
|
+
def contact_reschedule_campaign_step(list_of_contacts, step_id)
|
115
|
+
response = get('ContactService.reschedulteCampaignStep', list_of_contacts, step_id)
|
106
116
|
end
|
107
117
|
|
108
|
-
# Removes a
|
118
|
+
# Removes a tag from a contact (groups were the original name of tags).
|
109
119
|
#
|
110
|
-
# @
|
111
|
-
# @
|
120
|
+
# @param [Integer] contact_id
|
121
|
+
# @param [Integer] group_id
|
122
|
+
# @return [Boolean] returns true/false if tag was removed successfully
|
112
123
|
def contact_remove_from_group(contact_id, group_id)
|
113
|
-
response = get('ContactService
|
124
|
+
response = get('ContactService.removeFromGroup', contact_id, group_id)
|
125
|
+
end
|
126
|
+
|
127
|
+
# Adds a tag to a contact
|
128
|
+
#
|
129
|
+
# @param [Integer] contact_id
|
130
|
+
# @param [Integer] group_id
|
131
|
+
# @return [Boolean] returns true/false if the tag was added successfully
|
132
|
+
def contact_add_to_group(contact_id, group_id)
|
133
|
+
response = get('ContactService.addToGroup', contact_id, group_id)
|
114
134
|
end
|
115
135
|
|
116
|
-
#
|
136
|
+
# Runs an action set on a given contact record
|
137
|
+
#
|
138
|
+
# @param [Integer] contact_id
|
139
|
+
# @param [Integer] action_set_id
|
140
|
+
# @return [Array<Hash>] A list of details on each action run
|
141
|
+
# @example here is a list of what you get back
|
142
|
+
# [{ 'Action' => 'Create Task', 'Message' => 'task1 (Task) sent successfully', 'isError' =>
|
143
|
+
# nil }]
|
117
144
|
def contact_run_action_set(contact_id, action_set_id)
|
118
|
-
response = get('ContactService
|
145
|
+
response = get('ContactService.runActionSequence', contact_id, action_set_id)
|
146
|
+
end
|
147
|
+
|
148
|
+
def contact_link_contact(remoteApp, remoteId, localId)
|
149
|
+
response = get('ContactService.linkContact', remoteApp, remoteId, localId)
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
def contact_locate_contact_link(locate_map_id)
|
154
|
+
response = get('ContactService.locateContactLink', locate_map_id)
|
155
|
+
end
|
156
|
+
|
157
|
+
def contact_mark_link_updated(locate_map_id)
|
158
|
+
response = get('ContactService.markLinkUpdated', locate_map_id)
|
119
159
|
end
|
120
160
|
|
121
|
-
#
|
122
|
-
# runtime params for running affiliate signup actions, etc
|
161
|
+
# Creates a new recurring order for a contact.
|
123
162
|
#
|
124
|
-
# @
|
125
|
-
# @
|
126
|
-
# @
|
127
|
-
|
128
|
-
|
163
|
+
# @param [Integer] contact_id
|
164
|
+
# @param [Boolean] allow_duplicate
|
165
|
+
# @param [Integer] cprogram_id
|
166
|
+
# @param [Integer] merchant_account_id
|
167
|
+
# @param [Integer] credit_card_id
|
168
|
+
# @param [Integer] affiliate_id
|
169
|
+
def contact_add_recurring_order(contact_id, allow_duplicate, cprogram_id, merchant_account_id,
|
170
|
+
credit_card_id, affiliate_id, days_till_charge)
|
171
|
+
response = get('ContactService.addRecurringOrder', contact_id, allow_duplicate, cprogram_id,
|
172
|
+
merchant_account_id, credit_card_id, affiliate_id, days_till_charge)
|
129
173
|
end
|
130
174
|
|
131
|
-
#
|
175
|
+
# Executes an action sequence for a given contact, passing in runtime params
|
176
|
+
# for running affiliate signup actions, etc
|
132
177
|
#
|
133
|
-
# @
|
134
|
-
# @
|
135
|
-
# @
|
136
|
-
def
|
137
|
-
|
138
|
-
if data.has_key?("Email"); api_email_optin(data["Email"], "requested information"); end
|
139
|
-
return bool
|
178
|
+
# @param [Integer] contact_id
|
179
|
+
# @param [Integer] action_set_id
|
180
|
+
# @param [Hash] data
|
181
|
+
def contact_run_action_set_with_params(contact_id, action_set_id, data)
|
182
|
+
response = get('ContactService.runActionSequence', contact_id, action_set_id, data)
|
140
183
|
end
|
184
|
+
|
141
185
|
end
|
142
186
|
end
|
143
187
|
end
|
@@ -1,89 +1,131 @@
|
|
1
1
|
module Infusionsoft
|
2
2
|
class Client
|
3
|
-
|
4
|
-
|
5
|
-
########################
|
3
|
+
# The Data service is used to manipulate most data in Infusionsoft. It permits you to
|
4
|
+
# work on any available tables and has a wide range of uses.
|
6
5
|
module Data
|
7
|
-
# Adds a record
|
8
|
-
# by the Data Spec, this operation will simply ignore those fields - not throw an error
|
6
|
+
# Adds a record with the data provided.
|
9
7
|
#
|
10
|
-
# @
|
11
|
-
# @
|
12
|
-
|
13
|
-
|
8
|
+
# @param [String] table the name of the Infusiosoft database table
|
9
|
+
# @param [Hash] data the fields and it's data
|
10
|
+
# @return [Integer] returns the id of the record added
|
11
|
+
def data_add(table, data)
|
12
|
+
response = get('DataService.add', table, data)
|
13
|
+
end
|
14
|
+
|
15
|
+
# This method will load a record from the database given the primary key.
|
16
|
+
#
|
17
|
+
# @param [String] table
|
18
|
+
# @param [Integer] id
|
19
|
+
# @param [Array] selected_fields
|
20
|
+
# @return [Hash] the field names and their data
|
21
|
+
# @example
|
22
|
+
# { "FirstName" => "John", "LastName" => "Doe" }
|
23
|
+
def data_load(table, id, selected_fields)
|
24
|
+
response = get('DataService.load', table, id, selected_fields)
|
25
|
+
end
|
26
|
+
|
27
|
+
# Updates the specified record (indicated by ID) with the data provided.
|
28
|
+
#
|
29
|
+
# @param [String] table
|
30
|
+
# @param [Integer] id
|
31
|
+
# @param [Hash] data this is the fields and values you would like to update
|
32
|
+
# @return [Integer] id of the record updated
|
33
|
+
# @example
|
34
|
+
# { :FirstName => 'John', :Email => 'test@test.com' }
|
35
|
+
def data_update(table, id, data)
|
36
|
+
response = get('DataService.update', table, id, data)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Deletes the record (specified by id) in the given table from the database.
|
40
|
+
#
|
41
|
+
# @param [String] table
|
42
|
+
# @param [Integer] id
|
43
|
+
# @return [Boolean] returns true/false if the record was successfully deleted
|
44
|
+
def data_delete(table, id)
|
45
|
+
response = get('DataService.delete', table, id)
|
14
46
|
end
|
15
47
|
|
16
48
|
# This will locate all records in a given table that match the criteria for a given field.
|
17
49
|
#
|
18
|
-
# @
|
19
|
-
# @
|
20
|
-
# @
|
21
|
-
# @
|
22
|
-
# @
|
23
|
-
# @
|
50
|
+
# @param [String] table
|
51
|
+
# @param [Integer] limit how many records you would like to return (max is 1000)
|
52
|
+
# @param [Integer] page the page of results (each page is max 1000 records)
|
53
|
+
# @param [String] field_name
|
54
|
+
# @param [String, Integer, Date] field_value
|
55
|
+
# @param [Array] selected_fields
|
56
|
+
# @return [Array<Hash>] returns the array of records with a hash of the fields and values
|
24
57
|
def data_find_by_field(table, limit, page, field_name, field_value, selected_fields)
|
25
58
|
response = get('DataService.findByField', table, limit, page, field_name,
|
26
59
|
field_value, selected_fields)
|
27
60
|
end
|
28
61
|
|
29
|
-
#
|
62
|
+
# Queries records in a given table to find matches on certain fields.
|
30
63
|
#
|
31
|
-
# @
|
32
|
-
# @
|
33
|
-
# @
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
# Queries records in a given table to find matches on certain fields
|
39
|
-
#
|
40
|
-
# @table [String]
|
41
|
-
# @limit [Integer]
|
42
|
-
# @page [Integer]
|
43
|
-
# @data [Hash] The data you would like to query on. { :FirstName => 'first_name' }
|
44
|
-
# @selected_fields [Array]
|
64
|
+
# @param [String] table
|
65
|
+
# @param [Integer] limit
|
66
|
+
# @param [Integer] page
|
67
|
+
# @param [Hash] data the data you would like to query on. { :FirstName => 'first_name' }
|
68
|
+
# @param [Array] selected_fields the fields and values you want back
|
69
|
+
# @return [Array<Hash>] the fields and associated values
|
45
70
|
def data_query(table, limit, page, data, selected_fields)
|
46
71
|
response = get('DataService.query', table, limit, page, data, selected_fields)
|
47
72
|
end
|
48
73
|
|
49
|
-
#
|
74
|
+
# Adds a custom field to Infusionsoft
|
50
75
|
#
|
51
|
-
# @
|
52
|
-
#
|
53
|
-
# @
|
54
|
-
# @
|
55
|
-
|
56
|
-
|
76
|
+
# @param [String] field_type options include Person, Company, Affiliate, Task/Appt/Note,
|
77
|
+
# Order, Subscription, or Opportunity
|
78
|
+
# @param [String] name
|
79
|
+
# @param [String] data_type the type of field Text, Dropdown, TextArea
|
80
|
+
# @param [Integer] header_id see notes here
|
81
|
+
# http://help.infusionsoft.com/developers/services-methods/data/addCustomField
|
82
|
+
def data_add_custom_field(field_type, name, data_type, header_id)
|
83
|
+
response = get('DataService.addCustomField', field_type, name, data_type, header_id)
|
57
84
|
end
|
58
85
|
|
59
|
-
#
|
86
|
+
# Authenticate an Infusionsoft username and password(md5 hash). If the credentials match
|
87
|
+
# it will return back a User ID, if the credentials do not match it will send back an
|
88
|
+
# error message
|
60
89
|
#
|
61
|
-
# @
|
62
|
-
# @
|
63
|
-
# @
|
64
|
-
|
65
|
-
|
66
|
-
response = get('DataService.addCustomField', context, label, data_type, group_id)
|
90
|
+
# @param [String] username
|
91
|
+
# @param [String] password
|
92
|
+
# @return [Integer] id of the authenticated user
|
93
|
+
def data_authenticate_user(username, password)
|
94
|
+
response = get('DataService.authenticateUser', username, password)
|
67
95
|
end
|
68
96
|
|
69
|
-
#
|
97
|
+
# This method will return back the data currently configured in a user configured
|
98
|
+
# application setting.
|
70
99
|
#
|
71
|
-
# @
|
72
|
-
# @
|
73
|
-
|
74
|
-
|
100
|
+
# @param [String] module
|
101
|
+
# @param [String] setting
|
102
|
+
# @return [String] current values in given application setting
|
103
|
+
# @note to find the module and option names, view the HTML field name within the Infusionsoft
|
104
|
+
# settings. You will see something such as name="Contact_WebModule0optiontypes" . The portion
|
105
|
+
# before the underscore is the module name. "Contact" in this example. The portion after the
|
106
|
+
# 0 is the setting name, "optiontypes" in this example.
|
107
|
+
def data_get_app_setting(module_name, setting)
|
108
|
+
response = get('DataService.getAppSetting', module_name, setting)
|
75
109
|
end
|
76
110
|
|
77
|
-
#
|
111
|
+
# Returns a temporary API key if given a valid Vendor key and user credentials.
|
78
112
|
#
|
79
|
-
# @
|
80
|
-
# @
|
81
|
-
|
82
|
-
|
113
|
+
# @param [String] vendor_key
|
114
|
+
# @param [String] username
|
115
|
+
# @param [String] password_hash an md5 hash of users password
|
116
|
+
# @return [String] temporary API key
|
117
|
+
def data_get_temporary_key(vendor_key, username, password_hash)
|
118
|
+
response = get('DataService.getTemporaryKey', username, password_hash)
|
83
119
|
end
|
84
120
|
|
85
|
-
|
86
|
-
|
121
|
+
# Updates a custom field. Every field can have it’s display name and group id changed,
|
122
|
+
# but only certain data types will allow you to change values(dropdown, listbox, radio, etc).
|
123
|
+
#
|
124
|
+
# @param [Integer] field_id
|
125
|
+
# @param [Hash] field_values
|
126
|
+
# @return [Boolean] returns true/false if it was updated
|
127
|
+
def data_update_custom_field(field_id, field_values)
|
128
|
+
response = get('DataService.updateCustomField', field_id, field_values)
|
87
129
|
end
|
88
130
|
end
|
89
131
|
end
|