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/device_details.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/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, ChannelStateChange, 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:



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

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

.CipherParams(attributes) ⇒ CipherParams

Convert cipher param attributes to a CipherParams object

Returns:



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

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:



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

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:



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

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:



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

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:



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

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:



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

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