Sha256: d62328915d9bcca798125ef2aab68a8055b8add6487d76e6464418b5ac3ad233

Contents?: true

Size: 850 Bytes

Versions: 4

Compression:

Stored size: 850 Bytes

Contents

module RockRMS
  class Client
    module Group
      def list_groups(options = {})
        RockRMS::Responses::Group.format(get(group_path, options))
      end

      def find_group(id)
        RockRMS::Responses::Group.format(get(group_path(id)))
      end

      def list_groups_for_person(person_id, options = {})
        opts = options.dup
        opts['$filter'] = Array(opts['$filter'])
          .push("Members/any(m: m/PersonId eq #{person_id})")
          .join(' and ')
        opts['$expand'] ||= 'Members'

        list_groups(opts)
      end

      def list_families_for_person(person_id, options = {})
        RockRMS::Responses::Group.format(
          get("Groups/GetFamilies/#{person_id}", options)
        )
      end

      private

      def group_path(id = nil)
        id ? "Groups/#{id}" : 'Groups'
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rock_rms-2.0.0 lib/rock_rms/resources/group.rb
rock_rms-1.3.0 lib/rock_rms/resources/group.rb
rock_rms-1.2.0 lib/rock_rms/resources/group.rb
rock_rms-1.1.0 lib/rock_rms/resources/group.rb