Class: Google::Apis::Messages::MessageObject

Inherits:
Object
  • Object
show all
Includes:
Core::Hashable, Core::JsonObjectSupport
Defined in:
lib/google/apis/messages/classes.rb,
lib/google/apis/messages/representations.rb,
lib/google/apis/messages/representations.rb

Defined Under Namespace

Classes: Representation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ MessageObject

Returns a new instance of MessageObject.



81
82
83
# File 'lib/google/apis/messages/classes.rb', line 81

def initialize(**args)
  update!(**args)
end

Instance Attribute Details

#androidObject

Returns the value of attribute android.



76
77
78
# File 'lib/google/apis/messages/classes.rb', line 76

def android
  @android
end

#apnsObject

Returns the value of attribute apns.



77
78
79
# File 'lib/google/apis/messages/classes.rb', line 77

def apns
  @apns
end

#conditionObject

Returns the value of attribute condition.



72
73
74
# File 'lib/google/apis/messages/classes.rb', line 72

def condition
  @condition
end

#dataObject

Returns the value of attribute data.



75
76
77
# File 'lib/google/apis/messages/classes.rb', line 75

def data
  @data
end

#fcm_optionsObject

Returns the value of attribute fcm_options.



79
80
81
# File 'lib/google/apis/messages/classes.rb', line 79

def fcm_options
  @fcm_options
end

#notificationObject

Returns the value of attribute notification.



74
75
76
# File 'lib/google/apis/messages/classes.rb', line 74

def notification
  @notification
end

#tokenObject

Returns the value of attribute token.



73
74
75
# File 'lib/google/apis/messages/classes.rb', line 73

def token
  @token
end

#topicObject

Returns the value of attribute topic.



71
72
73
# File 'lib/google/apis/messages/classes.rb', line 71

def topic
  @topic
end

#webpushObject

Returns the value of attribute webpush.



78
79
80
# File 'lib/google/apis/messages/classes.rb', line 78

def webpush
  @webpush
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/google/apis/messages/classes.rb', line 86

def update!(**args)
  @topic = args[:topic] if args.key?(:topic)
  @condition = args[:condition] if args.key?(:condition)
  @token = args[:token] if args.key?(:token)
  @notification = args[:notification] if args.key?(:notification)
  if args.key?(:data) && args[:data].is_a?(Hash)
    @data = { 'payload' => JSON.dump(args[:data]) }
  end

  if args.key?(:extra) && args[:extra].is_a?(Hash)
    args[:extra].each do |key, value|
      @data[key] = value.to_s
    end
  end

  @android = args[:android] if args.key?(:android)
  @apns = args[:apns] if args.key?(:apns)
  @webpush = args[:webpush] if args.key?(:webpush)
  @fcm_options = args[:fcm_options] if args.key?(:fcm_options)
end