Exception: Ably::Models::DeviceDetails

Inherits:
Exceptions::BaseAblyException show all
Includes:
Ably::Modules::ModelCommon
Defined in:
lib/ably/models/device_details.rb

Overview

Contains the properties of a device registered for push notifications.

Instance Attribute Summary

Attributes included from Ably::Modules::ModelCommon

#hash

Attributes inherited from Exceptions::BaseAblyException

#code, #message, #request_id, #status

Instance Method Summary collapse

Methods included from Ably::Modules::ModelCommon

#==, #[], #as_json, included, #to_json, #to_s

Methods included from Ably::Modules::MessagePack

#to_msgpack

Methods inherited from Exceptions::BaseAblyException

#as_json, #to_s

Constructor Details

#initialize(hash_object = {}) ⇒ DeviceDetails

Returns a new instance of DeviceDetails.

Parameters:

  • hash_object (Hash, nil) (defaults to: {})

    Device detail attributes



29
30
31
32
# File 'lib/ably/models/device_details.rb', line 29

def initialize(hash_object = {})
  @raw_hash_object = hash_object || {}
  @hash_object     = IdiomaticRubyWrapper(hash_object)
end

Instance Method Details

#attributesObject



122
123
124
# File 'lib/ably/models/device_details.rb', line 122

def attributes
  @hash_object
end

#client_idString

The client ID the device is connected to Ably with.

Returns:

  • (String)


59
60
61
# File 'lib/ably/models/device_details.rb', line 59

def client_id
  attributes[:client_id]
end

#device_secretObject



74
75
76
# File 'lib/ably/models/device_details.rb', line 74

def device_secret
  attributes[:device_secret]
end

#form_factorString

The DeviceFormFactor object associated with the device. Describes the type of the device, such as phone or tablet.

Returns:

  • (String)


70
71
72
# File 'lib/ably/models/device_details.rb', line 70

def form_factor
  attributes[:form_factor]
end

#idObject

A unique ID generated by the device.



38
39
40
# File 'lib/ably/models/device_details.rb', line 38

def id
  attributes[:id]
end

#metadataHash?

A JSON object of key-value pairs that contains metadata for the device.

Returns:

  • (Hash, nil)


93
94
95
# File 'lib/ably/models/device_details.rb', line 93

def 
  attributes[:metadata] || {}
end

#metadata=(val) ⇒ Object



97
98
99
100
101
102
# File 'lib/ably/models/device_details.rb', line 97

def metadata=(val)
  unless val.nil? || val.kind_of?(Hash)
    raise ArgumentError, "metadata must be nil or a Hash value"
  end
  attributes[:metadata] = val
end

#platformString

The DevicePlatform associated with the device. Describes the platform the device uses, such as android or ios.

Returns:

  • (String)


49
50
51
# File 'lib/ably/models/device_details.rb', line 49

def platform
  attributes[:platform]
end

#pushAbly::Models::DevicePushDetails

The Ably::Models::DevicePushDetails object associated with the device. Describes the details of the push registration of the device.



111
112
113
# File 'lib/ably/models/device_details.rb', line 111

def push
  DevicePushDetails(attributes[:push] || {})
end

#push=(val) ⇒ Object



115
116
117
118
119
120
# File 'lib/ably/models/device_details.rb', line 115

def push=(val)
  unless val.nil? || val.kind_of?(Hash) || val.kind_of?(Ably::Models::DevicePushDetails)
    raise ArgumentError, "push must be nil, a Hash value or a DevicePushDetails object"
  end
  attributes[:push] = DevicePushDetails(val)
end