Exception: Ably::Models::DevicePushDetails

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

Parameters:

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

    Device push detail attributes



37
38
39
40
# File 'lib/submodules/ably-ruby/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

Returns If the state is Failing of Failed, this field may optionally contain a reason.

Returns:

  • (ErrorInfo)

    If the state is Failing of Failed, this field may optionally contain a reason



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/submodules/ably-ruby/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)

Returns Arbitrary metadata that can be associated with this object.

Returns:

  • (Hash)

    Arbitrary metadata that can be associated with this object



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/submodules/ably-ruby/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)

Returns The current state of this push target such as Active, Failing or Failed.

Returns:

  • (String)

    The current state of this push target such as Active, Failing or Failed



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/submodules/ably-ruby/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)

Returns Transport type for push notifications such as gcm, apns, web.

Returns:

  • (String)

    Transport type for push notifications such as gcm, apns, web



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/submodules/ably-ruby/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/submodules/ably-ruby/lib/ably/models/device_push_details.rb', line 82

def attributes
  @hash_object
end

#recipientObject



55
56
57
# File 'lib/submodules/ably-ruby/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/submodules/ably-ruby/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