module Mrkt::CrudCustomObjects

Public Instance Methods

createupdate_custom_objects(name, input, action: 'createOrUpdate', dedupe_by: 'dedupeFields') click to toggle source
# File lib/mrkt/concerns/crud_custom_objects.rb, line 16
def createupdate_custom_objects(name, input, action: 'createOrUpdate', dedupe_by: 'dedupeFields')
  post_json("/rest/v1/customobjects/#{name}.json") do
    {
      input: input,
      action: action,
      dedupeBy: dedupe_by
    }
  end
end
delete_custom_objects(name, input, delete_by: 'dedupeFields') click to toggle source
# File lib/mrkt/concerns/crud_custom_objects.rb, line 26
def delete_custom_objects(name, input, delete_by: 'dedupeFields')
  post_json("/rest/v1/customobjects/#{name}/delete.json") do
    {
      input: input,
      deleteBy: delete_by
    }
  end
end
describe_custom_object(name) click to toggle source
# File lib/mrkt/concerns/crud_custom_objects.rb, line 10
def describe_custom_object(name)
  raise Mrkt::Errors::Unknown unless name

  get("/rest/v1/customobjects/#{name}/describe.json")
end
get_custom_objects(name, input, filter_type: 'dedupeFields', fields: nil, next_page_token: nil, batch_size: nil) click to toggle source
# File lib/mrkt/concerns/crud_custom_objects.rb, line 35
def get_custom_objects(name, input, filter_type: 'dedupeFields', fields: nil, next_page_token: nil, batch_size: nil)
  post_json("/rest/v1/customobjects/#{name}.json?_method=GET") do
    params = {
      input: input,
      filterType: filter_type
    }

    optional = {
      fields: fields,
      nextPageToken: next_page_token,
      batchSize: batch_size
    }

    merge_params(params, optional)
  end
end
get_list_of_custom_objects(names = nil) click to toggle source
# File lib/mrkt/concerns/crud_custom_objects.rb, line 3
def get_list_of_custom_objects(names = nil)
  params = {}
  params[:names] = names if names

  get('/rest/v1/customobjects.json', params)
end