Module: Ably::Models

Defined in:
lib/ably-rest/modules/eventmachine_deferrable.rb,
lib/ably-rest/modules/eventmachine_deferrable.rb,
lib/submodules/ably-ruby/lib/ably/models/stats.rb,
lib/submodules/ably-ruby/lib/ably/models/message.rb,
lib/submodules/ably-ruby/lib/ably/models/error_info.rb,
lib/submodules/ably-ruby/lib/ably/models/nil_logger.rb,
lib/submodules/ably-ruby/lib/ably/models/stats_types.rb,
lib/submodules/ably-ruby/lib/ably/models/auth_details.rb,
lib/submodules/ably-ruby/lib/ably/models/delta_extras.rb,
lib/submodules/ably-ruby/lib/ably/models/cipher_params.rb,
lib/submodules/ably-ruby/lib/ably/models/token_details.rb,
lib/submodules/ably-ruby/lib/ably/models/token_request.rb,
lib/submodules/ably-ruby/lib/ably/models/channel_status.rb,
lib/submodules/ably-ruby/lib/ably/models/device_details.rb,
lib/submodules/ably-ruby/lib/ably/models/channel_details.rb,
lib/submodules/ably-ruby/lib/ably/models/channel_metrics.rb,
lib/submodules/ably-ruby/lib/ably/models/channel_options.rb,
lib/submodules/ably-ruby/lib/ably/models/paginated_result.rb,
lib/submodules/ably-ruby/lib/ably/models/presence_message.rb,
lib/submodules/ably-ruby/lib/ably/models/protocol_message.rb,
lib/submodules/ably-ruby/lib/ably/models/channel_occupancy.rb,
lib/submodules/ably-ruby/lib/ably/models/connection_details.rb,
lib/submodules/ably-ruby/lib/ably/models/device_push_details.rb,
lib/submodules/ably-ruby/lib/ably/models/channel_state_change.rb,
lib/submodules/ably-ruby/lib/ably/models/message_encoders/base.rb,
lib/submodules/ably-ruby/lib/ably/models/idiomatic_ruby_wrapper.rb,
lib/submodules/ably-ruby/lib/ably/models/connection_state_change.rb,
lib/submodules/ably-ruby/lib/ably/models/http_paginated_response.rb,
lib/submodules/ably-ruby/lib/ably/models/push_channel_subscription.rb

Defined Under Namespace

Modules: MessageEncoders Classes: AuthDetails, ChannelDetails, ChannelMetrics, ChannelOccupancy, ChannelOptions, ChannelStateChange, ChannelStatus, CipherParams, ConnectionDetails, ConnectionStateChange, DeltaExtras, DeviceDetails, DevicePushDetails, ErrorInfo, HttpPaginatedResponse, IdiomaticRubyWrapper, Message, NilLogger, PaginatedResult, PresenceMessage, ProtocolMessage, PushChannelSubscription, Stats, TokenDetails, TokenRequest

Class Method Summary collapse

Class Method Details

.AuthDetails(attributes) ⇒ AuthDetails

Convert auth details attributes to a AuthDetails object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/auth_details.rb', line 8

def self.AuthDetails(attributes)
  case attributes
  when AuthDetails
    return attributes
  else
    AuthDetails.new(attributes || {})
  end
end

.ChannelDetails(attributes) ⇒ ChannelDetails

Convert token details argument to a ChannelDetails object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/channel_details.rb', line 8

def self.ChannelDetails(attributes)
  case attributes
  when ChannelDetails
    return attributes
  else
    ChannelDetails.new(attributes)
  end
end

.ChannelMetrics(attributes) ⇒ ChannelMetrics

Convert token details argument to a ChannelMetrics object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/channel_metrics.rb', line 8

def self.ChannelMetrics(attributes)
  case attributes
  when ChannelMetrics
    return attributes
  else
    ChannelMetrics.new(attributes)
  end
end

.ChannelOccupancy(attributes) ⇒ ChannelOccupancy

Convert token details argument to a ChannelOccupancy object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/channel_occupancy.rb', line 8

def self.ChannelOccupancy(attributes)
  case attributes
  when ChannelOccupancy
    return attributes
  else
    ChannelOccupancy.new(attributes)
  end
end

.ChannelOptions(attributes) ⇒ ChannelOptions

Convert token details argument to a ChannelOptions object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/channel_options.rb', line 8

def self.ChannelOptions(attributes)
  case attributes
  when ChannelOptions
    return attributes
  else
    ChannelOptions.new(attributes)
  end
end

.ChannelStatus(attributes) ⇒ ChannelStatus

Convert token details argument to a ChannelStatus object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/channel_status.rb', line 8

def self.ChannelStatus(attributes)
  case attributes
  when ChannelStatus
    return attributes
  else
    ChannelStatus.new(attributes)
  end
end

.CipherParams(attributes) ⇒ CipherParams

Convert cipher param attributes to a CipherParams object

Returns:



11
12
13
14
15
16
17
18
# File 'lib/submodules/ably-ruby/lib/ably/models/cipher_params.rb', line 11

def self.CipherParams(attributes)
  case attributes
  when CipherParams
    return attributes
  else
    CipherParams.new(attributes || {})
  end
end

.ConnectionDetails(attributes) ⇒ ConnectionDetails

Convert connection details attributes to a ConnectionDetails object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/connection_details.rb', line 8

def self.ConnectionDetails(attributes)
  case attributes
  when ConnectionDetails
    return attributes
  else
    ConnectionDetails.new(attributes || {})
  end
end

.Message(message, options = {}) ⇒ Message

Convert messsage argument to a Message object and associate with a protocol message if provided

Parameters:

  • message (Message, Hash)

    A message object or Hash of message properties

  • options (Hash) (defaults to: {})

    (see Message#initialize)

Returns:



11
12
13
14
15
16
17
18
19
20
# File 'lib/submodules/ably-ruby/lib/ably/models/message.rb', line 11

def self.Message(message, options = {})
  case message
  when Message
    message.tap do
      message.assign_to_protocol_message options[:protocol_message] if options[:protocol_message]
    end
  else
    Message.new(message, options)
  end
end

.PresenceMessage(presence_message, options = {}) ⇒ PresenceMessage

Convert presence_messsage argument to a PresenceMessage object and associate with a protocol message if provided

Parameters:

  • presence_message (PresenceMessage, Hash)

    A presence message object or Hash of presence message properties

  • options (Hash) (defaults to: {})

    (see PresenceMessage#initialize)

Returns:



9
10
11
12
13
14
15
16
17
18
# File 'lib/submodules/ably-ruby/lib/ably/models/presence_message.rb', line 9

def self.PresenceMessage(presence_message, options = {})
  case presence_message
  when PresenceMessage
    presence_message.tap do
      presence_message.assign_to_protocol_message options[:protocol_message] if options[:protocol_message]
    end
  else
    PresenceMessage.new(presence_message, options)
  end
end

.Stats(stat) ⇒ Stats

Convert stat argument to a Stats object

Parameters:

  • stat (Stats, Hash)

    A Stats object or Hash of stat properties

Returns:



9
10
11
12
13
14
15
16
# File 'lib/submodules/ably-ruby/lib/ably/models/stats.rb', line 9

def self.Stats(stat)
  case stat
  when Stats
    stat
  else
    Stats.new(stat)
  end
end

.TokenDetails(attributes) ⇒ TokenDetails

Convert token details argument to a TokenDetails object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/token_details.rb', line 8

def self.TokenDetails(attributes)
  case attributes
  when TokenDetails
    return attributes
  else
    TokenDetails.new(attributes)
  end
end

.TokenRequest(attributes) ⇒ TokenRequest

Convert token request argument to a TokenRequest object

Returns:



8
9
10
11
12
13
14
15
# File 'lib/submodules/ably-ruby/lib/ably/models/token_request.rb', line 8

def self.TokenRequest(attributes)
  case attributes
  when TokenRequest
    return attributes
  else
    TokenRequest.new(attributes)
  end
end