class Google::Apis::Messages::Message
Attributes
message_object[RW]
Public Class Methods
new(**args)
click to toggle source
# File lib/google/apis/messages/classes.rb, line 9 def initialize(**args) update!(**args) end
Public Instance Methods
initialize_build(**args)
click to toggle source
# File lib/google/apis/messages/classes.rb, line 13 def initialize_build(**args) if args[:token] && args[:topic] raise ArgumentError, "Arguments :token and :topic can't be used together" end if args[:notification] notification = Notification.new( title: args[:notification][:title], body: args[:notification][:body] ) end message_object_args = { topic: args[:topic], condition: args[:condition], token: args[:token], data: args[:payload] } if notification message_object_args[:notification] = notification end if args.key?(:android) message_object_args[:android] = args[:android] end if args.key?(:apns) message_object_args[:apns] = args[:apns] end if args.key?(:webpush) message_object_args[:webpush] = args[:webpush] end if args.key?(:fcm_options) message_object_args[:fcm_options] = args[:fcm_options] end if args.key?(:extra) message_object_args[:extra] = args[:extra] end @message_object = MessageObject.new(message_object_args) end
update!(**args)
click to toggle source
# File lib/google/apis/messages/classes.rb, line 59 def update!(**args) if args.key?(:message_object) @message_object = args[:message_object] else initialize_build(**args) end end