Sha256: c5c827598efb8fffb78e2fe563afc762074b3a8f00cf95b79e40a76f506d1945

Contents?: true

Size: 632 Bytes

Versions: 5

Compression:

Stored size: 632 Bytes

Contents

module SugarCRM; class Connection
  # Sets a single relationship between two SugarBeans.
  def set_relationship(module_name, module_id, link_field_name, related_ids)
    login! unless logged_in?
    raise ArgumentError, "related_ids must be an Array" unless related_ids.class == Array
    json = <<-EOF
      {
        \"session\": \"#{@session}\"\,
        \"module_name\": \"#{module_name}\"\,
        \"module_id\": #{module_id}\,
        \"link_field_name\": #{link_field_name}\,
        \"related_ids\": #{link_field_name.to_json}   
      }
    EOF
    json.gsub!(/^\s{6}/,'')
    send!(:set_relationship, json)
  end
end; end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sugarcrm-0.8.0 lib/sugarcrm/connection/api/set_relationship.rb
sugarcrm-0.7.9 lib/sugarcrm/connection/api/set_relationship.rb
sugarcrm-0.7.8 lib/sugarcrm/connection/api/set_relationship.rb
sugarcrm-0.7.7 lib/sugarcrm/connection/api/set_relationship.rb
sugarcrm-0.7.2 lib/sugarcrm/connection/api/set_relationship.rb