Class: Google::Apis::Messages::MessagesService
- Inherits:
-
Core::BaseService
- Object
- Core::BaseService
- Google::Apis::Messages::MessagesService
- Defined in:
- lib/google/apis/messages/service.rb
Instance Attribute Summary collapse
-
#project_id ⇒ String
Your project ID from Google Firebase Console console.firebase.google.com/.
Instance Method Summary collapse
-
#initialize(project_id:) ⇒ MessagesService
constructor
A new instance of MessagesService.
-
#notify_topic(message, options: nil, &block) ⇒ Object
(also: #notify)
Notify topic subscribers with message.
Constructor Details
#initialize(project_id:) ⇒ MessagesService
Returns a new instance of MessagesService.
16 17 18 19 20 |
# File 'lib/google/apis/messages/service.rb', line 16 def initialize(project_id:) @project_id = project_id super('https://fcm.googleapis.com/', 'v1/projects/{projectId}/') end |
Instance Attribute Details
#project_id ⇒ String
Your project ID from Google Firebase Console console.firebase.google.com/
13 14 15 |
# File 'lib/google/apis/messages/service.rb', line 13 def project_id @project_id end |
Instance Method Details
#notify_topic(message, options: nil, &block) ⇒ Object Also known as: notify
Notify topic subscribers with message
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/google/apis/messages/service.rb', line 26 def notify_topic(, options: nil, &block) command = make_simple_command(:post, 'messages:send', ) command.request_representation = Google::Apis::Messages::Message::Representation command.request_object = if !ENV['FIREBASE_DEBUG'].nil? log_json(command) end execute_or_queue_command(command, &block) end |