Class: Google::Apis::Messages::Message
- Inherits:
-
Object
- Object
- Google::Apis::Messages::Message
- 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
-
#message_object ⇒ Object
Returns the value of attribute message_object.
Instance Method Summary collapse
-
#initialize(**args) ⇒ Message
constructor
A new instance of Message.
- #initialize_build(**args) ⇒ Object
- #update!(**args) ⇒ Object
Constructor Details
#initialize(**args) ⇒ Message
Returns a new instance of Message.
9 10 11 |
# File 'lib/google/apis/messages/classes.rb', line 9 def initialize(**args) update!(**args) end |
Instance Attribute Details
#message_object ⇒ Object
Returns the value of attribute message_object.
7 8 9 |
# File 'lib/google/apis/messages/classes.rb', line 7 def @message_object end |
Instance Method Details
#initialize_build(**args) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 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 |
# 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 = { topic: args[:topic], condition: args[:condition], token: args[:token], data: args[:payload] } if notification [:notification] = notification end if args.key?(:android) [:android] = args[:android] end if args.key?(:apns) [:apns] = args[:apns] end if args.key?(:webpush) [:webpush] = args[:webpush] end if args.key?(:fcm_options) [:fcm_options] = args[:fcm_options] end if args.key?(:extra) [:extra] = args[:extra] end @message_object = MessageObject.new() end |
#update!(**args) ⇒ Object
59 60 61 62 63 64 65 |
# 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 |