Method: OData::EntitySet#<<
- Defined in:
- lib/odata/entity_set.rb
#<<(entity) ⇒ OData::Entity
Write supplied entity back to the service.
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/odata/entity_set.rb', line 104 def <<(entity) url_chunk, = setup_entity_post_request(entity) result = execute_entity_post_request(, url_chunk) if entity.is_new? doc = ::Nokogiri::XML(result.body).remove_namespaces! primary_key_node = doc.xpath("//content/properties/#{entity.primary_key}").first entity[entity.primary_key] = primary_key_node.content unless primary_key_node.nil? end unless result.code.to_s =~ /^2[0-9][0-9]$/ entity.errors << ['could not commit entity'] end entity end |