Sha256: 88b1176b9d6914afeb9041765530169af09bc93e5aac18e6abfa7150d6e0dcb5
Contents?: true
Size: 1.43 KB
Versions: 23
Compression:
Stored size: 1.43 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: "") log(: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)}" log(:error) { msg } false end else msg = "#{context} Error (connection error)\n" msg += " -- Failed to \"#{reason}\".\n" msg += " • Person: #{person_ref(person)}" log(: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
23 entries across 23 versions & 1 rubygems
Version | Path |
---|---|
eco-helpers-3.0.1 | lib/eco/api/microcases/person_update.rb |
eco-helpers-3.0.0 | lib/eco/api/microcases/person_update.rb |
eco-helpers-2.7.25 | lib/eco/api/microcases/person_update.rb |