Sha256: a2a09ffe869008f761774401af216c5ecea982d6eafe64212db7ced01910b78e
Contents?: true
Size: 1.39 KB
Versions: 77
Compression:
Stored size: 1.39 KB
Contents
module Eco module API class MicroCases # It updates an idividual person. # @note if it succeeds the update, it calls `person.consolidate!` # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done. # @param context [String] main part of the message. # @param reason [String] why are we updating now. # @return [Boolean] `true` if it succeded to update, and `false` otherwise def person_update!(person, context: "Session", reason: "") logger.debug("#{context}, going to \"#{reason}\".\nPerson: #{person_ref(person)}") if response = api.people.update(person) if response.success? person.consolidate! true else msg = "#{context} Error #{response.status}: #{response.body}\n" msg += " -- Failed to \"#{reason}\".\n" msg += " • Person: #{person_ref(person)}" logger.error(msg) false end else msg = "#{context} Error (connection error)\n" msg += " -- Failed to \"#{reason}\".\n" msg += " • Person: #{person_ref(person)}" logger.error(msg) false end end private def person_ref(person) Eco::API::Session::Batch::Feedback.person_ref(person) end end end end
Version data entries
77 entries across 77 versions & 1 rubygems