lib/frodo/concerns/api.rb
# Public: Insert a new record.
#
# entity_set_name - The set the entity belongs to
# attrs   - Hash of attributes to set on the new record.
#
# Examples
#
#   # Add a new lead
#   client.create!('leads', {"firstname" =>'Bob'})
#   # => '073ca9c8-2a41-e911-a81d-000d3a1d5a0b'
#
# Returns the primary key value of the newly created entity.
# Raises exceptions if an error is returned from Dynamics.
Insert a new record.
entity_set_name - The set the entity belongs to
attrs   - Hash of attributes to set on the new record.

Examples



Returns the primary key value of the newly created entity.
Raises exceptions if an error is returned from Dynamics.
Insert a new record . entity_set_name - The set the entity belongs to attrs - Hash of attributes to set on the new record . Examples Returns the primary key value of the newly created entity . Raises exceptions if an error is returned from Dynamics .
def create!(entity_set_name, attrs)
        url = api_post(entity_set_name, attrs).headers['odata-entityid']
        id_match = url.match(/\((.+)\)/)
        if id_match.nil?
          raise Frodo::Error.new "entity url not in expected format: #{url.inspect}"
        end
        return id_match[1]
      end
def create! ( entity_set_name , attrs ) url = api_post ( entity_set_name , attrs ) . headers [ 'odata-entityid' ] id_match = url . match ( / \( (.+) \) / ) if id_match . nil? raise Frodo :: Error . new "entity url not in expected format: #{url.inspect}" end return id_match [ 1 ] end
Public: Insert a new record.
Public : Insert a new record .
entity_set_name
attrs