module Markety::Command::SyncCustomObject

Public Instance Methods

sync_custom_object(custom_object, operation="UPSERT") click to toggle source
# File lib/markety/command/sync_custom_object.rb, line 4
def sync_custom_object(custom_object, operation="UPSERT")
  sync_custom_objects_request(custom_object.object_type_name, operation, custom_object.to_sync_custom_object_hash)
end
sync_custom_objects(custom_objects, operation="UPSERT") click to toggle source
# File lib/markety/command/sync_custom_object.rb, line 8
def sync_custom_objects(custom_objects, operation="UPSERT")
  object_type_name = custom_objects.first.object_type_name
  sync_custom_objects_request(object_type_name, operation, multiple_custom_obj_params(custom_objects))
end

Private Instance Methods

multiple_custom_obj_params(custom_objects) click to toggle source
# File lib/markety/command/sync_custom_object.rb, line 15
def multiple_custom_obj_params(custom_objects)
  custom_objects.map{|custom_object| custom_object.to_sync_custom_object_hash}
end
sync_custom_objects_request(object_type_name, operation, custom_obj_list) click to toggle source
# File lib/markety/command/sync_custom_object.rb, line 19
def sync_custom_objects_request(object_type_name, operation, custom_obj_list)
  send_request(:sync_custom_objects,
    {
      "objTypeName" => object_type_name,
      "operation" => operation,
      "customObjList" => {
        "customObj" => custom_obj_list
      }
    }
  )
end