Metadata API for PubNub Ruby SDK

Objects provides easy-to-use, serverless storage for user and channel data you need to build innovative, reliable, scalable applications. Use Objects to easily store metadata about your application users and channels, and their membership associations, without the need to stand up your own databases.

PubNub also triggers events when object data is set or removed from the database. Clients can receive these events in real time and update their front-end application accordingly.

User

Get Metadata for All Users

Description

Returns a paginated list of UUID Metadata objects, optionally including the custom data object for each.

Method(s)

To Get All UUID Metadata you can use the following method(s) in the Ruby V4 SDK:

get_all_uuid_metadata(sort: sort, include: include, filter: filter, start: start, end: end, limit: limit, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
sortArrayOptionalList of criteria (name of field) which should be used for sorting in ascending order. Available options are id, name, and updated. Use asc or desc to specify sort direction.
includeObjectOptional{ count: true }Additional information which should be included in response. Available options:
  • count- include how many UUID has been associated with metadata.
  • custom - include field with additional information from metadata which has been used during UUID metadata set requests.
filterStringOptionalExpression to filter out results basing on specified criteria. For more details on the supported grammar, check here
startStringOptionalPreviously-returned cursor bookmark for fetching the next page.
endStringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
limitIntegerOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.get_all_uuid_metadata(
limit: 5,
include: { custom: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:metadata => [
{
:id => "mg",
:name => "magnum",
:externalId => nil,
:profileUrl => nil,
:email => nil,
:custom => { "XXX" => "YYYY" },
:updated => <Date>,
:eTag => "Ad2eyIWXwJzBqAE"
}
],
show all 24 lines

Get User Metadata

Description

Returns metadata for the specified UUID, optionally including the custom data object for each.

Method(s)

To Get UUID Metadata you can use the following method(s) in the Ruby V4 SDK:

get_uuid_metadata(uuid: uuid, include: include, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
uuidStringOptionalClient UUIDIdentifier for which associated metadata should be fetched. Default: configured PubNub client uuid.
includeObjectOptional{ custom: true }Additional information which should be included in response. Available options:
  • custom - include field with additional information from metadata which has been used during UUID metadata set requests.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.get_uuid_metadata(include: { custom: true }) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:id => "mg",
:name => "magnum",
:externalId => nil,
:profileUrl => nil,
:email => nil,
:custom => { "XXX" => "YYYY" },
:updated => <Date>,
:eTag => "Ad2eyIWXwJzBqAE"
}
},
@status = {
:code => 200
show all 17 lines

Set User Metadata

Description

Set metadata for a UUID in the database, optionally including the custom data object for each.

Method(s)

To Set UUID Metadata you can use the following method(s) in the Ruby V4 SDK:

set_uuid_metadata(uuid: uuid, metadata: metadata, include: include, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
uuidStringOptionalClient UUIDIdentifier with which new metadata should be associated. Default: configured PubNub client uuid.
metadataObjectYesMetadata information which should be associated with UUID. Available options:
  • name - Name which should be stored in metadata associated with specified UUID.
  • externalId - External identifier (database, auth service) associated with specified UUID.
  • profileUrl - External URL with information for specified UUID representation.
  • custom - Additional information which should be stored in metadata associated with specified UUID. Objects filtering language doesn’t support filtering by custom properties.
  • email - Email address which should be stored in metadata associated with specified UUID.
includeObjectOptional{ custom: true }Additional information which should be included in response. Available options:
  • custom - include field with additional information from metadata which has been used during UUID metadata set requests.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.set_uuid_metadata(
uuid: 'mg',
metadata: { name: 'magnum', custom: { XXX: 'YYYY' } },
include: { custom: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:id => "mg",
:name => "magnum",
:externalId => nil,
:profileUrl => nil,
:email => nil,
:custom => { "XXX" => "YYYY" },
:updated => <Date>,
:eTag => "Ad2eyIWXwJzBqAE"
}
},
@status = {
:code => 200
show all 17 lines

Remove User Metadata

Description

Removes the metadata from a specified UUID.

Method(s)

To Remove UUID Metadata you can use the following method(s) in the Ruby V4 SDK:

remove_uuid_metadata(uuid: uuid, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
uuidStringOptionalClient UUIDIdentifier for which associated metadata should be removed. Default: configured PubNub client uuid.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.remove_uuid_metadata(uuid: 'mg') do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@status = {
:code => 200,
:operation => :remove_uuid_metadata,
:category => :ack,
:error => false,
# [...]
},
# [...]
>

Channel

Get Metadata for All Channels

Description

Returns a paginated list of Channel Metadata objects, optionally including the custom data object for each.

Method(s)

To Get All Channel Metadata you can use the following method(s) in the Ruby V4 SDK:

get_all_channels_metadata(sort: sort, include: include, filter: filter, start: start, end: end, limit: limit, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
sortArrayOptionalList of criteria (name of field) which should be used for sorting in ascending order. Available options are id, name, and updated. Use asc or desc to specify sort direction.
includeObjectOptional{ count: true }Additional information which should be included in response. Available options:
  • count - include how many channels has been associated with metadata.
  • custom - include field with additional information from metadata which has been used during channel metadata set requests.
filterStringOptionalExpression to filter out results basing on specified criteria. For more details on the supported grammar, check here
startStringOptionalPreviously-returned cursor bookmark for fetching the next page.
endStringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
limitIntegerOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.get_all_channels_metadata(
limit: 5,
include: { custom: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:metadata => [
{
:id => "rb_channel1",
:name => "some_name",
:description => nil,
:custom => { "XXX" => "YYYY" },
:updated => <Date>,
:eTag => "AZTUtcvx6NDGLQ"
},
# {...}
],
:totalCount => 2,
show all 23 lines

Get Channel Metadata

Description

Returns metadata for the specified Channel, optionally including the custom data object for each.

Method(s)

To Get Channel Metadata you can use the following method(s) in the Ruby V4 SDK:

get_channel_metadata(channel: channel, include: include, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
channelStringYesName of channel for which associated metadata should be fetched.
includeObjectOptional{ custom: true }Additional information which should be included in response. Available options:
  • custom - include field with additional information from metadata which has been used during channel metadata set requests.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.get_channel_metadata(
channel: 'channel',
include: { custom: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:id => "channel",
:name => "some_name",
:description => nil,
:custom => { "XXX" => "YYYY" },
:updated => <Date>,
:eTag => "AZTUtcvx6NDGLQ"
}
},
@status = {
:code => 200
}
>

Set Channel Metadata

Description

Set metadata for a Channel in the database, optionally including the custom data object for each.

Method(s)

To Set Channel Metadata you can use the following method(s) in the Ruby V4 SDK:

set_channel_metadata(channel: channel, metadata: metadata, include: include, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
channelStringYesName of channel with which new metadata should be associated.
metadataObjectYesMetadata information which should be associated with channel. Available options:
  • name - Name which should stored in metadata associated with specified channel.
  • information - Description which should be stored in metadata associated with specified channel.
  • custom - Additional information which should be stored in metadata associated with specified channel. Objects filtering language doesn’t support filtering by custom properties.
includeObjectOptional{ custom: true }Additional information which should be included in response. Available options:
  • custom - include field with additional information from metadata which has been used during UUID metadata set requests.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.set_channel_metadata(
channel: 'channel',
metadata: { name: 'some_name', custom: { XXX: 'YYYY' } }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:id => "channel",
:name => "some_name",
:description => nil,
:custom => { "XXX" => "YYYY" },
:updated => <Date>,
:eTag => "AZTUtcvx6NDGLQ"
}
},
@status = {
:code => 200
}
>

Remove Channel Metadata

Description

Removes the metadata from a specified channel.

Method(s)

To Remove Channel Metadata you can use the following method(s) in the Ruby V4 SDK:

remove_channel_metadata(channel: channel, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
channelStringYesName of channel with which the metadata should be removed.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.remove_channel_metadata(channel: 'channel') do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@status = {
:code => 200,
:operation => :remove_channel_metadata,
:category => :ack,
:error => false,
# [...]
},
# [...]
>

Channel Memberships

Get Channel Memberships

Description

The method returns a list of channel memberships for a user. This method doesn't return a user's subscriptions.

Method(s)

To Get Memberships you can use the following method(s) in the Ruby V4 SDK:

get_memberships(uuid: uuid, sort: sort, include: include, filter: filter, start: start, end: end, limit: limit, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
uuidStringOptionalClient UUIDIdentifier for which memberships in channels should be fetched. Default: configured PubNub client uuid.
sortArrayOptionalList of criteria (name of field) which should be used for sorting in ascending order. Available options are id, name, and updated. Use asc or desc to specify sort direction.
includeObjectOptional{ count: true }Additional information which should be included in response. Available options:
  • count - include how many memberships UUID has.
  • custom - include field with additional information from metadata which has been associated with UUID during membership add requests.
  • channel_metadata - include channel's metadata into response (not only name).
  • channel_custom - include channel's additional information which has been used during channel metadata set requests..
filterStringOptionalExpression to filter out results basing on specified criteria. For more details on the supported grammar, check here
startStringOptionalPreviously-returned cursor bookmark for fetching the next page.
endStringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
limitIntegerOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.get_memberships(
uuid: 'mg',
include: { count: true, custom: true, channel_metadata: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:memberships => [
{
:channel => {
:id => "channel-identifier1",
:name => "Channel1",
:description => nil,
# {...}
},
:custom => { "membership-custom" => "custom-data-1" },
:updated => <Date>,
:eTag => "AYbepevg39XeDA"
},
show all 26 lines

Set Channel Memberships

Description

Set channel memberships for a UUID.

Method(s)

To Set Memberships you can use the following method(s) in the Ruby V4 SDK:

set_memberships(uuid: uuid, channels: channels, sort: sort, include: include, filter: filter, start: start, end: end, limit: limit, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
uuidStringOptionalClient UUIDIdentifier for which memberships in channels should be set. Default: configured PubNub client uuid.
channelsArrayYesList of channels for which metadata associated with each of them in context of UUID should be set. Each entry is dictionary with channel and optional custom fields. custom should be dictionary with simple objects: String and Integer.
sortArrayOptionalList of criteria (name of field) which should be used for sorting in ascending order. Available options are id, name, and updated. Use asc or desc to specify sort direction.
includeObjectOptional{ count: true }Additional information which should be included in response. Available options:
  • count - include how many memberships UUID has.
  • custom - include field with additional information from metadata which has been associated with UUID during membership add requests.
  • channel_metadata - include channel's metadata into response (not only name).
  • channel_custom - include channel's additional information which has been used during channel metadata set requests..
filterStringOptionalExpression to filter out results basing on specified criteria. For more details on the supported grammar, check here
startStringOptionalPreviously-returned cursor bookmark for fetching the next page.
endStringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
limitIntegerOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.set_memberships(
uuid: 'mg',
channels: [
{ channel: 'channel-1' }
],
include: { custom: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:memberships => [
{
:channel => {
:id => "channel-1",
# {...}
},
:custom => nil,
:updated => <Date>,
:eTag => "AY39mJKK//C0VA"
}
],
:totalCount => 1,
show all 23 lines

Remove Channel Memberships

Description

Remove channel memberships for a UUID.

Method(s)

To Remove Memberships you can use the following method(s) in the Ruby V4 SDK:

remove_memberships(uuid: uuid, channels: channels, sort: sort, include: include, filter: filter, start: start, end: end, limit: limit, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
uuidStringOptionalClient UUIDIdentifier for which memberships in channels should be removed. Default: configured PubNub client uuid.
channelsArrayYesList of channels from which UUID should be removed as member.
sortArrayOptionalList of criteria (name of field) which should be used for sorting in ascending order. Available options are id, name, and updated. Use asc or desc to specify sort direction.
includeObjectOptional{ count: true }Additional information which should be included in response. Available options:
  • count - include how many memberships UUID has.
  • custom - include field with additional information from metadata which has been associated with UUID during membership add requests.
  • channel_metadata - include channel's metadata into response (not only name).
  • channel_custom - include channel's additional information which has been used during channel metadata set requests..
filterStringOptionalExpression to filter out results basing on specified criteria. For more details on the supported grammar, check here
startStringOptionalPreviously-returned cursor bookmark for fetching the next page.
endStringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
limitIntegerOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.remove_memberships(
uuid: 'mg',
channels: [ 'channel-1' ],
include: { custom: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:memberships => [
{
:channel => {
:id => "channel-2",
# {...}
},
:custom => nil,
:updated => <Date>,
:eTag => "AY39mJKK//C0VA"
}
],
:totalCount => 1,
show all 23 lines

Channel Members

Get Channel Members

Description

The method returns a list of members in a channel. The list will include user metadata for members that have additional metadata stored in the database.

Method(s)

To Get Channel Members you can use the following method(s) in the Ruby V4 SDK:

get_channel_members(channel: channel, sort: sort, include: include, filter: filter, start: start, end: end, limit: limit, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
channelStringYesName of channel from which members should be fetched.
sortArrayOptionalList of criteria (name of field) which should be used for sorting in ascending order. Available options are id, name, and updated. Use asc or desc to specify sort direction.
includeObjectOptional{ count: true }Additional information which should be included in response. Available options:
  • count - include how many members channel has.
  • custom - include field with additional information from metadata which has been associated with UUID during channel member add requests.
  • uuid_metadata - include UUID's metadata into response (not only identifier).
  • uuid_custom - include UUID's additional information which has been used during UUID metadata set requests.
filterStringOptionalExpression to filter out results basing on specified criteria. For more details on the supported grammar, check here
startStringOptionalPreviously-returned cursor bookmark for fetching the next page.
endStringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
limitIntegerOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.get_channel_members(
channel: 'channel-1',
include: { count: true, custom: true, uuid_metadata: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:members => [
{
:uuid => {
:id => "uuid-identifier1",
:name => "uuid1",
:externalId => nil,
:profileUrl => nil,
:email => nil,
:updated => <Date>,
:eTag => "AYfwuq+u+4C01gE",
# {...}
},
show all 30 lines

Set Channel Members

Description

This method sets members in a channel.

Method(s)

To Set Channel Members you can use the following method(s) in the Ruby V4 SDK:

set_channel_members(channel: channel, uuids: uuids, sort: sort, include: include, filter: filter, start: start, end: end, limit: limit, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
channelStringYesName of channel for which members should be set.
uuidsArrayYesList of UUIDs for which metadata associated with each of them in context of channel should be set. Each entry is dictionary with UUID and optional custom fields. custom should be dictionary with simple objects: String and Integer.
sortArrayOptionalList of criteria (name of field) which should be used for sorting in ascending order. Available options are id, name, and updated. Use asc or desc to specify sort direction.
includeObjectOptional{ count: true }Additional information which should be included in response. Available options:
  • count - include how many members channel has.
  • custom - include field with additional information from metadata which has been associated with UUID during channel member add requests.
  • uuid_metadata - include UUID's metadata into response (not only identifier).
  • uuid_custom - include UUID's additional information which has been used during UUID metadata set requests.
filterStringOptionalExpression to filter out results basing on specified criteria. For more details on the supported grammar, check here
startStringOptionalPreviously-returned cursor bookmark for fetching the next page.
endStringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
limitIntegerOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.set_channel_members(
channel: 'channel',
uuids: [
{ uuid: 'uuid1' }
],
include: { custom: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:members=>[
{
:uuid => {
:id => "mg2",
# {...}
},
:custom => nil,
:updated=><Date>,
:eTag => "AY39mJKK//C0VA"
}
],
:totalCount => 1,
show all 23 lines

Remove Channel Members

Description

Remove members from a Channel.

Method(s)

To Remove Channel Members you can use the following method(s) in the Ruby V4 SDK:

remove_channel_members(channel: channel, uuids: uuids, sort: sort, include: include, filter: filter, start: start, end: end, limit: limit, http_sync: http_sync, callback: callback)
ParameterTypeRequiredDefaultDescription
channelStringYesName of channel from which members should be removed.
uuidsArrayYesList of UUIDs which should be removed from channel's list.
sortArrayOptionalList of criteria (name of field) which should be used for sorting in ascending order. Available options are id, name, and updated. Use asc or desc to specify sort direction.
includeObjectOptional{ count: true }Additional information which should be included in response. Available options:
  • count - include how many members channel has.
  • custom - include field with additional information from metadata which has been associated with UUID during channel member add requests.
  • uuid_metadata - include UUID's metadata into response (not only identifier).
  • uuid_custom - include UUID's additional information which has been used during UUID metadata set requests.
filterStringOptionalExpression to filter out results basing on specified criteria. For more details on the supported grammar, check here
startStringOptionalPreviously-returned cursor bookmark for fetching the next page.
endStringOptionalPreviously-returned cursor bookmark for fetching the previous page. Ignored if you also supply the start parameter.
limitIntegerOptional100Number of objects to return in response. Default is 100, which is also the maximum value.
http_syncBooleanOptionalfalseMethod will be executed asynchronously and will return future, to get its value you can use value method. If set to true, method will return array of envelopes (even if there's only one envelope). For sync methods Envelope object will be returned.
callbackLambda accepting one parameterOptionalCallback that will be called for each envelope. For async methods future will be returned, to retrieve value Envelope object you have to call value method (thread will be locked until the value is returned).

Basic Usage

pubnub.remove_channel_members(
channel: 'channel',
uuids: [ 'mg1' ],
include: { custom: true }
) do |envelope|
puts envelope
end

Response

#<Pubnub::Envelope
@result = {
:data => {
:members=>[
{
:uuid => {
:id => "uuid-identifier",
# {...}
},
:custom => nil,
:updated => <Date>,
:eTag => "AY39mJKK//C0VA"
}
],
:totalCount => 1,
show all 23 lines

Objects Filtering Language Definition

The filtering language for Objects is similar to the stream filtering language.

Note the following:

  • Date/time properties, such as updated, must be compared to valid date/time strings formatted according to ISO 8601.

  • The LIKE operator supports wildcards denoted by the * character. A wildcard matches any sequence of arbitrary Unicode characters, including the empty sequence. The literal asterisk is matched when escaped using the backslash (\) character.

  • Values used with LIKE must be properly encoded just like any other string value. Thus, in order to escape an asterisk, the raw value must contain \\*.

  • The entire expression must be properly URL-encoded when used in the query string.

Custom property filtering

You can't filter by custom properties.

<expression>           ::= <and_expression> ( "||" <and_expression> )*
<and_expression> ::= <binary_condition> ( "&&" <binary_condition> )*
<binary_condition> ::= "!" <binary_condition> | "(" <expression> ")" | <relational_condition>
<relational_condition> ::= <property_path> <relational_operator> <value>
<property_path> ::= <property_name> ( "." <property_name> )*
<property_name> ::= <identifier> | "[" <string> "]"
<value> ::= <string> | <number> | "true" | "false" | "null"

Tokens

<identifier> ::= <letter> | "$" | "_" ( <letter> | "$" | "_" | <digit> )*
<relational_operator> ::= "==" | "!=" | "<=" | ">=" | "<" | ">" | "LIKE"
<string> ::= <double_quote> ( "\" <double_quote> | "\" <special_char>
| "\" "u" <hex_digit> <hex_digit> <hex_digit> <hex_digit>
| <unicode_char> - <double_quote> - "\" )* <double_quote>
show all 26 lines

Sample object filtering operations

The following date/time comparison returns results that were modified on or after August 31st, 2019 (UTC):

updated >= "2019-08-31T00:00:00Z"

The following wildcard expression returns results whose name starts with the letter X:

name LIKE 'X*'

The following escaped wildcard expression returns results whose name contains an asterisk:

name LIKE '*\\**'
Last updated on