Exception: Ably::Models::DeviceDetails

Inherits:
Exceptions::BaseAblyException show all
Includes:
Ably::Modules::ModelCommon
Defined in:
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


43
44
45
46
# File '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)


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/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)


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/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)


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/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)


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/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


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/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)


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/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


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/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/ably/models/device_details.rb', line 83

def attributes
  @hash_object
end