Exception: Ably::Models::DevicePushDetails

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

Overview

An object with the push notification details for Ably::Modules::Conversions#DeviceDetails object

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 = {}) ⇒ DevicePushDetails

a


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

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

Instance Attribute Details

#error_reasonErrorInfo


32
33
34
35
36
37
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
# File 'lib/ably/models/device_push_details.rb', line 32

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

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

  %w(state).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 recipient
    attributes[:recipient] || {}
  end

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

  def error_reason
    attributes[:error_reason]
  end

  def error_reason=(val)
    unless val.nil? || val.kind_of?(Hash) || val.kind_of?(Ably::Models::ErrorInfo)
      raise ArgumentError, "error_reason must be nil, a Hash value or a ErrorInfo object"
    end

    attributes[:error_reason] = if val.nil?
      nil
    else
      ErrorInfo(val)
    end
  end

  def attributes
    @hash_object
  end
end

#metadataHash (readonly)


32
33
34
35
36
37
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
# File 'lib/ably/models/device_push_details.rb', line 32

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

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

  %w(state).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 recipient
    attributes[:recipient] || {}
  end

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

  def error_reason
    attributes[:error_reason]
  end

  def error_reason=(val)
    unless val.nil? || val.kind_of?(Hash) || val.kind_of?(Ably::Models::ErrorInfo)
      raise ArgumentError, "error_reason must be nil, a Hash value or a ErrorInfo object"
    end

    attributes[:error_reason] = if val.nil?
      nil
    else
      ErrorInfo(val)
    end
  end

  def attributes
    @hash_object
  end
end

#stateString (readonly)


32
33
34
35
36
37
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
# File 'lib/ably/models/device_push_details.rb', line 32

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

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

  %w(state).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 recipient
    attributes[:recipient] || {}
  end

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

  def error_reason
    attributes[:error_reason]
  end

  def error_reason=(val)
    unless val.nil? || val.kind_of?(Hash) || val.kind_of?(Ably::Models::ErrorInfo)
      raise ArgumentError, "error_reason must be nil, a Hash value or a ErrorInfo object"
    end

    attributes[:error_reason] = if val.nil?
      nil
    else
      ErrorInfo(val)
    end
  end

  def attributes
    @hash_object
  end
end

#transport_typeString (readonly)


32
33
34
35
36
37
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
# File 'lib/ably/models/device_push_details.rb', line 32

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

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

  %w(state).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 recipient
    attributes[:recipient] || {}
  end

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

  def error_reason
    attributes[:error_reason]
  end

  def error_reason=(val)
    unless val.nil? || val.kind_of?(Hash) || val.kind_of?(Ably::Models::ErrorInfo)
      raise ArgumentError, "error_reason must be nil, a Hash value or a ErrorInfo object"
    end

    attributes[:error_reason] = if val.nil?
      nil
    else
      ErrorInfo(val)
    end
  end

  def attributes
    @hash_object
  end
end

Instance Method Details

#attributesObject


82
83
84
# File 'lib/ably/models/device_push_details.rb', line 82

def attributes
  @hash_object
end

#recipientObject


55
56
57
# File 'lib/ably/models/device_push_details.rb', line 55

def recipient
  attributes[:recipient] || {}
end

#recipient=(val) ⇒ Object


59
60
61
62
63
64
# File 'lib/ably/models/device_push_details.rb', line 59

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