Method: Quickbooks::Service::ServiceCrud#create
- Defined in:
- lib/quickbooks/service/service_crud.rb
#create(entity, options = {}) ⇒ Object Also known as: update
48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/quickbooks/service/service_crud.rb', line 48 def create(entity, = {}) raise Quickbooks::InvalidModelException.new(entity.errors..join(',')) unless entity.valid? xml = entity.to_xml_ns() response = do_http_post(url_for_resource(model.resource_for_singular), valid_xml_document(xml), [:query]) if response.code.to_i == 200 model.from_xml(parse_singular_entity_response(model, response.plain_body)) else nil end end |