Method: FellowshipOne::ApiWriter#save_object
- Defined in:
- lib/writers/api_writer.rb
#save_object ⇒ Object
Saves this object.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/writers/api_writer.rb', line 10 def save_object @url_data_params ||= {} success = true if @url_data_path.nil? = ["#{@url_action.to_s.upcase} not implemented for #{self.class.to_s}"] return false end if @updatable_fields and !@updatable_fields.empty? # fields_to_remove = @url_data_params.keys - @updatable_fields # fields_to_remove.each { |ftr| @url_data_params.delete(ftr) } end begin response = FellowshipOne::api_request(@url_action, @url_data_path, [], @url_data_params.to_json) @response_code = response.code # No content but is a success success = response.code == 204 ? {'success' => true} : JSON.parse(response.body) rescue Exception => e = e..split(',') success = false end return success end |