Sha256: aa244db6750fec808e87acce8d44686b087fbc708a94ac297ee89217cfe7b610
Contents?: true
Size: 679 Bytes
Versions: 5
Compression:
Stored size: 679 Bytes
Contents
require 'active_support' require File.dirname(__FILE__) + '/../../proxy' class LHS::Item < LHS::Proxy module Save extend ActiveSupport::Concern def save save! rescue LHC::Error => e self.errors = LHS::Errors.new(e.response) false end def save! service = _data._root._service data = _data._raw.dup url = if href.present? href else service.instance.find_endpoint(data).compile(data) end response = service.instance.request(method: :post, url: url, body: data.to_json, headers: {'Content-Type' => 'application/json'}) self._data.merge!(response) true end end end
Version data entries
5 entries across 5 versions & 1 rubygems