Sha256: f2e4607deb74b96f8f404fff0f17dc32e82dab47fbb14cf09a044c4ee119bc8d
Contents?: true
Size: 1.16 KB
Versions: 10
Compression:
Stored size: 1.16 KB
Contents
module Roqua module CoreApi # @api private class CreateDossier < Base object :session, class: Sessions::AuthSession string :dossier_group_id object :dossier, class: Models::Dossier, default: nil object :person, class: Models::Person, default: nil object :credential, class: Models::Credential, default: nil def execute response = session.post "/dossier_groups/#{dossier_group_id}/dossiers", person: attribute_hash(person), dossier: dossier_attributes, credential: attribute_hash(credential) if response.code == 422 errors_to_object(response, person) errors_to_object(response, dossier) errors_to_object(response, credential) end Models::Dossier.new(response) end private def dossier_attributes return {} unless dossier dossier.serializable_hash(except: :people).keep_if { |_k, v| !v.nil? } end def attribute_hash(obj) return {} unless obj obj.serializable_hash.keep_if { |_k, v| !v.nil? } end end end end
Version data entries
10 entries across 10 versions & 1 rubygems