Module: Selligent::Client::Data
- Included in:
- Selligent::Client
- Defined in:
- lib/selligent/client/data.rb
Overview
Implements the data endpoints
/organizations/:organization/lists/data/*
Instance Method Summary collapse
-
#delete_data(api_name, data, params = {}) ⇒ Object
Deletes data from the list with the given api-name in the given organization.
-
#delete_data_from_segment(api_name, segment_api_name, data, params = {}) ⇒ Object
Deletes data via json from the segment with the given segment-api-name in the list with the given api-name in the given organization.
-
#load_data(api_name, data, params = {}) ⇒ Object
Loads data into the list with the given api-name in the given organization.
-
#load_data_into_segment(api_name, segment_api_name, data, params = {}) ⇒ Object
Loads data into the segment with the given segment-api-name in the list with the given api-name in the given organization.
-
#search_data(api_name, request, params = {}) ⇒ Object
Method to search for data records in a specific table.
-
#search_data_within_segment(api_name, segment_api_name, request, params = {}) ⇒ Object
Method to search for data records within a segment of specific table.
Instance Method Details
#delete_data(api_name, data, params = {}) ⇒ Object
Deletes data from the list with the given api-name in the given organization
18 19 20 21 22 |
# File 'lib/selligent/client/data.rb', line 18 def delete_data(api_name, data, params = {}) delete("#{base_url}/lists/#{api_name}/data", params) do |req| req.body = data.to_json end end |
#delete_data_from_segment(api_name, segment_api_name, data, params = {}) ⇒ Object
Deletes data via json from the segment with the given segment-api-name in the list with the given api-name in the given organization
86 87 88 89 90 |
# File 'lib/selligent/client/data.rb', line 86 def delete_data_from_segment(api_name, segment_api_name, data, params = {}) delete("#{base_url}/lists/#{api_name}/segments/#{segment_api_name}/data", params) do |req| req.body = data.to_json end end |
#load_data(api_name, data, params = {}) ⇒ Object
Loads data into the list with the given api-name in the given organization
37 38 39 40 41 |
# File 'lib/selligent/client/data.rb', line 37 def load_data(api_name, data, params = {}) post("#{base_url}/lists/#{api_name}/data/load", data) do |req| req.params.merge!(params) end end |
#load_data_into_segment(api_name, segment_api_name, data, params = {}) ⇒ Object
Loads data into the segment with the given segment-api-name in the list with the given api-name in the given organization
103 104 105 106 107 |
# File 'lib/selligent/client/data.rb', line 103 def load_data_into_segment(api_name, segment_api_name, data, params = {}) post("#{base_url}/lists/#{api_name}/segments/#{segment_api_name}/data/load", data) do |req| req.params.merge!(params) end end |
#search_data(api_name, request, params = {}) ⇒ Object
Method to search for data records in a specific table
The request has the following shape:
{
"fields": [
"FIELD1",
"FIELD2"
],
"filters": [
{
"field_name": "FIELD1",
"operator": "EqualTo",
"field_value": "VALUE"
}
],
"skip": 20,
"take": 20,
"order_by": "FIELD2",
"order_by_direction": "ASC"
}
69 70 71 72 73 |
# File 'lib/selligent/client/data.rb', line 69 def search_data(api_name, request, params = {}) post("#{base_url}/lists/#{api_name}/data/search", request) do |req| req.params.merge!(params) end end |
#search_data_within_segment(api_name, segment_api_name, request, params = {}) ⇒ Object
Method to search for data records within a segment of specific table
The request has the following shape:
{
"fields": [
"FIELD1",
"FIELD2"
],
"filters": [
{
"field_name": "FIELD1",
"operator": "EqualTo",
"field_value": "VALUE"
}
],
"skip": 20,
"take": 20,
"order_by": "FIELD2",
"order_by_direction": "ASC"
}
135 136 137 138 139 140 141 142 |
# File 'lib/selligent/client/data.rb', line 135 def search_data_within_segment(api_name, segment_api_name, request, params = {}) post( "#{base_url}/lists/#{api_name}/segments/#{segment_api_name}/data/search", request ) do |req| req.params.merge!(params) end end |