Sha256: 53bff6831c97c00896b82225969a76b646a3b84b3040767671a615e1415eaee3

Contents?: true

Size: 657 Bytes

Versions: 1

Compression:

Stored size: 657 Bytes

Contents

module Commands::Groups::Membership
  class List < RestPack::Service::Command
    required do
      integer :application_id
    end

    optional do
      integer :account_id
      integer :group_id
      integer :user_id
      boolean :is_account_group, default: false
      integer :page
      integer :page_size
      string :include
    end

    def execute
      scope = Models::Groups::Membership.all
      if is_account_group
        scope = scope.where("account_id IS NOT NULL")
      else
        scope = scope.where("account_id IS NULL") unless account_id
      end

      Serializers::Groups::Membership.resource(inputs, scope)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
restpack_group_service-0.0.8 lib/restpack_group_service/commands/membership/list.rb