Exception: Ably::Models::DeviceDetails

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

Overview

An object representing a devices details, used currently for push notifications

Instance Attribute Summary collapse

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

a

Parameters:

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

    Device detail attributes



43
44
45
46
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 43

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

Instance Attribute Details

#client_idString (readonly)

Returns The authenticated client identifier for this device. See auth documentation.

Returns:

  • (String)

    The authenticated client identifier for this device. See auth documentation.



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 38

class DeviceDetails < Ably::Exceptions::BaseAblyException
  include Ably::Modules::ModelCommon

  # @param hash_object   [Hash,nil]  Device detail attributes
  #a
  def initialize(hash_object = {})
    @raw_hash_object = hash_object || {}
    @hash_object     = IdiomaticRubyWrapper(hash_object)
  end

  %w(id platform form_factor client_id device_secret).each do |attribute|
    define_method attribute do
      attributes[attribute.to_sym]
    end

    define_method "#{attribute}=" do |val|
      unless val.nil? || val.kind_of?(String)
        raise ArgumentError, "#{attribute} must be nil or a string value"
      end
      attributes[attribute.to_sym] = val
    end
  end

  def 
    attributes[:metadata] || {}
  end

  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

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

  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

  def attributes
    @hash_object
  end
end

#device_secretString (readonly)

Returns This secret is used internally by Ably client libraries to authenticate with Ably when push registration updates are required such as when the GCM token expires and needs renewing.

Returns:

  • (String)

    This secret is used internally by Ably client libraries to authenticate with Ably when push registration updates are required such as when the GCM token expires and needs renewing



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 38

class DeviceDetails < Ably::Exceptions::BaseAblyException
  include Ably::Modules::ModelCommon

  # @param hash_object   [Hash,nil]  Device detail attributes
  #a
  def initialize(hash_object = {})
    @raw_hash_object = hash_object || {}
    @hash_object     = IdiomaticRubyWrapper(hash_object)
  end

  %w(id platform form_factor client_id device_secret).each do |attribute|
    define_method attribute do
      attributes[attribute.to_sym]
    end

    define_method "#{attribute}=" do |val|
      unless val.nil? || val.kind_of?(String)
        raise ArgumentError, "#{attribute} must be nil or a string value"
      end
      attributes[attribute.to_sym] = val
    end
  end

  def 
    attributes[:metadata] || {}
  end

  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

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

  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

  def attributes
    @hash_object
  end
end

#form_factorString (readonly)

Returns Device form factor such as phone, tablet, watch.

Returns:

  • (String)

    Device form factor such as phone, tablet, watch



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 38

class DeviceDetails < Ably::Exceptions::BaseAblyException
  include Ably::Modules::ModelCommon

  # @param hash_object   [Hash,nil]  Device detail attributes
  #a
  def initialize(hash_object = {})
    @raw_hash_object = hash_object || {}
    @hash_object     = IdiomaticRubyWrapper(hash_object)
  end

  %w(id platform form_factor client_id device_secret).each do |attribute|
    define_method attribute do
      attributes[attribute.to_sym]
    end

    define_method "#{attribute}=" do |val|
      unless val.nil? || val.kind_of?(String)
        raise ArgumentError, "#{attribute} must be nil or a string value"
      end
      attributes[attribute.to_sym] = val
    end
  end

  def 
    attributes[:metadata] || {}
  end

  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

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

  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

  def attributes
    @hash_object
  end
end

#idString (readonly)

Returns Unique device identifier assigned randomly by the device.

Returns:

  • (String)

    Unique device identifier assigned randomly by the device



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 38

class DeviceDetails < Ably::Exceptions::BaseAblyException
  include Ably::Modules::ModelCommon

  # @param hash_object   [Hash,nil]  Device detail attributes
  #a
  def initialize(hash_object = {})
    @raw_hash_object = hash_object || {}
    @hash_object     = IdiomaticRubyWrapper(hash_object)
  end

  %w(id platform form_factor client_id device_secret).each do |attribute|
    define_method attribute do
      attributes[attribute.to_sym]
    end

    define_method "#{attribute}=" do |val|
      unless val.nil? || val.kind_of?(String)
        raise ArgumentError, "#{attribute} must be nil or a string value"
      end
      attributes[attribute.to_sym] = val
    end
  end

  def 
    attributes[:metadata] || {}
  end

  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

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

  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

  def attributes
    @hash_object
  end
end

#metadataHash

Returns Arbitrary metadata that can be associated with a device.

Returns:

  • (Hash)

    Arbitrary metadata that can be associated with a device



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 38

class DeviceDetails < Ably::Exceptions::BaseAblyException
  include Ably::Modules::ModelCommon

  # @param hash_object   [Hash,nil]  Device detail attributes
  #a
  def initialize(hash_object = {})
    @raw_hash_object = hash_object || {}
    @hash_object     = IdiomaticRubyWrapper(hash_object)
  end

  %w(id platform form_factor client_id device_secret).each do |attribute|
    define_method attribute do
      attributes[attribute.to_sym]
    end

    define_method "#{attribute}=" do |val|
      unless val.nil? || val.kind_of?(String)
        raise ArgumentError, "#{attribute} must be nil or a string value"
      end
      attributes[attribute.to_sym] = val
    end
  end

  def 
    attributes[:metadata] || {}
  end

  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

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

  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

  def attributes
    @hash_object
  end
end

#platformString (readonly)

Returns Device platform such as android, ios or browser.

Returns:

  • (String)

    Device platform such as android, ios or browser



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 38

class DeviceDetails < Ably::Exceptions::BaseAblyException
  include Ably::Modules::ModelCommon

  # @param hash_object   [Hash,nil]  Device detail attributes
  #a
  def initialize(hash_object = {})
    @raw_hash_object = hash_object || {}
    @hash_object     = IdiomaticRubyWrapper(hash_object)
  end

  %w(id platform form_factor client_id device_secret).each do |attribute|
    define_method attribute do
      attributes[attribute.to_sym]
    end

    define_method "#{attribute}=" do |val|
      unless val.nil? || val.kind_of?(String)
        raise ArgumentError, "#{attribute} must be nil or a string value"
      end
      attributes[attribute.to_sym] = val
    end
  end

  def 
    attributes[:metadata] || {}
  end

  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

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

  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

  def attributes
    @hash_object
  end
end

#pushDevicePushDetails

Returns The push notification specific properties for this device allowing push notifications to be delivered to the device.

Returns:

  • (DevicePushDetails)

    The push notification specific properties for this device allowing push notifications to be delivered to the device



38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 38

class DeviceDetails < Ably::Exceptions::BaseAblyException
  include Ably::Modules::ModelCommon

  # @param hash_object   [Hash,nil]  Device detail attributes
  #a
  def initialize(hash_object = {})
    @raw_hash_object = hash_object || {}
    @hash_object     = IdiomaticRubyWrapper(hash_object)
  end

  %w(id platform form_factor client_id device_secret).each do |attribute|
    define_method attribute do
      attributes[attribute.to_sym]
    end

    define_method "#{attribute}=" do |val|
      unless val.nil? || val.kind_of?(String)
        raise ArgumentError, "#{attribute} must be nil or a string value"
      end
      attributes[attribute.to_sym] = val
    end
  end

  def 
    attributes[:metadata] || {}
  end

  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

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

  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

  def attributes
    @hash_object
  end
end

Instance Method Details

#attributesObject



83
84
85
# File 'lib/submodules/ably-ruby/lib/ably/models/device_details.rb', line 83

def attributes
  @hash_object
end