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.



54
55
56
# File 'lib/google/apis/messages/classes.rb', line 54

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

Instance Attribute Details

#dataObject

Returns the value of attribute data.



51
52
53
# File 'lib/google/apis/messages/classes.rb', line 51

def data
  @data
end

#notificationObject

Returns the value of attribute notification.



50
51
52
# File 'lib/google/apis/messages/classes.rb', line 50

def notification
  @notification
end

#topicObject

Returns the value of attribute topic.



49
50
51
# File 'lib/google/apis/messages/classes.rb', line 49

def topic
  @topic
end

#webpushObject

Returns the value of attribute webpush.



52
53
54
# File 'lib/google/apis/messages/classes.rb', line 52

def webpush
  @webpush
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



59
60
61
62
63
64
65
66
# File 'lib/google/apis/messages/classes.rb', line 59

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