Module: Infusionsoft::Client::Data
- Included in:
- Infusionsoft::Client
- Defined in:
- lib/infusionsoft/client/data.rb
Overview
The Data service is used to manipulate most data in Infusionsoft. It permits you to work on any available tables and has a wide range of uses.
Instance Method Summary collapse
-
#data_add(table, data) ⇒ Integer
Adds a record with the data provided.
-
#data_add_custom_field(field_type, name, data_type, header_id) ⇒ Object
Adds a custom field to Infusionsoft.
-
#data_authenticate_user(username, password) ⇒ Integer
Authenticate an Infusionsoft username and password(md5 hash).
-
#data_delete(table, id) ⇒ Boolean
Deletes the record (specified by id) in the given table from the database.
-
#data_find_by_field(table, limit, page, field_name, field_value, selected_fields) ⇒ Array<Hash>
This will locate all records in a given table that match the criteria for a given field.
-
#data_get_app_setting(module_name, setting) ⇒ String
This method will return back the data currently configured in a user configured application setting.
-
#data_get_temporary_key(vendor_key, username, password_hash) ⇒ String
Returns a temporary API key if given a valid Vendor key and user credentials.
-
#data_load(table, id, selected_fields) ⇒ Hash
This method will load a record from the database given the primary key.
-
#data_query(table, limit, page, data, selected_fields) ⇒ Array<Hash>
Queries records in a given table to find matches on certain fields.
-
#data_query_order_by(table, limit, page, data, selected_fields, by, ascending) ⇒ Array<Hash>
Queries records in a given table to find matches on certain fields.
-
#data_update(table, id, data) ⇒ Integer
Updates the specified record (indicated by ID) with the data provided.
-
#data_update_custom_field(field_id, field_values) ⇒ Boolean
Updates a custom field.
Instance Method Details
#data_add(table, data) ⇒ Integer
Adds a record with the data provided.
11 12 13 |
# File 'lib/infusionsoft/client/data.rb', line 11 def data_add(table, data) response = xmlrpc('DataService.add', table, data) end |
#data_add_custom_field(field_type, name, data_type, header_id) ⇒ Object
Adds a custom field to Infusionsoft
96 97 98 |
# File 'lib/infusionsoft/client/data.rb', line 96 def data_add_custom_field(field_type, name, data_type, header_id) response = xmlrpc('DataService.addCustomField', field_type, name, data_type, header_id) end |
#data_authenticate_user(username, password) ⇒ Integer
Authenticate an Infusionsoft username and password(md5 hash). If the credentials match it will return back a User ID, if the credentials do not match it will send back an error message
107 108 109 |
# File 'lib/infusionsoft/client/data.rb', line 107 def data_authenticate_user(username, password) response = xmlrpc('DataService.authenticateUser', username, password) end |
#data_delete(table, id) ⇒ Boolean
Deletes the record (specified by id) in the given table from the database.
44 45 46 |
# File 'lib/infusionsoft/client/data.rb', line 44 def data_delete(table, id) response = xmlrpc('DataService.delete', table, id) end |
#data_find_by_field(table, limit, page, field_name, field_value, selected_fields) ⇒ Array<Hash>
This will locate all records in a given table that match the criteria for a given field.
57 58 59 60 |
# File 'lib/infusionsoft/client/data.rb', line 57 def data_find_by_field(table, limit, page, field_name, field_value, selected_fields) response = xmlrpc('DataService.findByField', table, limit, page, field_name, field_value, selected_fields) end |
#data_get_app_setting(module_name, setting) ⇒ String
to find the module and option names, view the HTML field name within the Infusionsoft settings. You will see something such as name=“Contact_WebModule0optiontypes” . The portion before the underscore is the module name. “Contact” in this example. The portion after the 0 is the setting name, “optiontypes” in this example.
This method will return back the data currently configured in a user configured application setting.
121 122 123 |
# File 'lib/infusionsoft/client/data.rb', line 121 def data_get_app_setting(module_name, setting) response = xmlrpc('DataService.getAppSetting', module_name, setting) end |
#data_get_temporary_key(vendor_key, username, password_hash) ⇒ String
Returns a temporary API key if given a valid Vendor key and user credentials.
131 132 133 |
# File 'lib/infusionsoft/client/data.rb', line 131 def data_get_temporary_key(vendor_key, username, password_hash) response = xmlrpc('DataService.getTemporaryKey', username, password_hash) end |
#data_load(table, id, selected_fields) ⇒ Hash
This method will load a record from the database given the primary key.
23 24 25 |
# File 'lib/infusionsoft/client/data.rb', line 23 def data_load(table, id, selected_fields) response = xmlrpc('DataService.load', table, id, selected_fields) end |
#data_query(table, limit, page, data, selected_fields) ⇒ Array<Hash>
Queries records in a given table to find matches on certain fields.
70 71 72 |
# File 'lib/infusionsoft/client/data.rb', line 70 def data_query(table, limit, page, data, selected_fields) response = xmlrpc('DataService.query', table, limit, page, data, selected_fields) end |
#data_query_order_by(table, limit, page, data, selected_fields, by, ascending) ⇒ Array<Hash>
Queries records in a given table to find matches on certain fields.
84 85 86 |
# File 'lib/infusionsoft/client/data.rb', line 84 def data_query_order_by(table, limit, page, data, selected_fields, by, ascending) response = xmlrpc('DataService.query', table, limit, page, data, selected_fields, by, ascending) end |
#data_update(table, id, data) ⇒ Integer
Updates the specified record (indicated by ID) with the data provided.
35 36 37 |
# File 'lib/infusionsoft/client/data.rb', line 35 def data_update(table, id, data) response = xmlrpc('DataService.update', table, id, data) end |
#data_update_custom_field(field_id, field_values) ⇒ Boolean
Updates a custom field. Every field can have it’s display name and group id changed, but only certain data types will allow you to change values(dropdown, listbox, radio, etc).
141 142 143 |
# File 'lib/infusionsoft/client/data.rb', line 141 def data_update_custom_field(field_id, field_values) response = xmlrpc('DataService.updateCustomField', field_id, field_values) end |