Sha256: 5c287f7e8442d3bdcebdd5c9bd3bc8de904706035bc86bd4cf3114db65286584

Contents?: true

Size: 918 Bytes

Versions: 9

Compression:

Stored size: 918 Bytes

Contents

module Roqua
  module CoreApi
    # @api private
    class Dossiers < Base
      object :session, class: Sessions::AuthSession
      string :dossier_group_id, default: nil
      string :with_name, default: nil
      string :with_external_identifier, default: nil

      validates :dossier_group_id, presence: true, if: :with_external_identifier?

      # usage:
      # Roqua.CoreApi.Dossiers.run!.each do |d|
      #   puts d.id, d.birth_year, d.gender, d.firstname, d.lastname
      # end
      def execute
        response = session.get "#{url_prefix}/dossiers", params
        create_enum(response['headers'], response['rows'])
      end

      def url_prefix
        dossier_group_id.present? ? "/dossier_groups/#{dossier_group_id}" : ''
      end

      def params
        {name: with_name,
         external_identifier: with_external_identifier
        }.delete_if { |k, v| v.nil? }
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
roqua-core-api-0.5.0 lib/roqua/core_api/dossiers.rb
roqua-core-api-0.4.0 lib/roqua/core_api/dossiers.rb
roqua-core-api-0.3.1 lib/roqua/core_api/dossiers.rb
roqua-core-api-0.3.0 lib/roqua/core_api/dossiers.rb
roqua-core-api-0.2.4 lib/roqua/core_api/dossiers.rb
roqua-core-api-0.2.3 lib/roqua/core_api/dossiers.rb
roqua-core-api-0.2.2 lib/roqua/core_api/dossiers.rb
roqua-core-api-0.2.1 lib/roqua/core_api/dossiers.rb
roqua-core-api-0.2.0 lib/roqua/core_api/dossiers.rb