Class: NotifyUser::Gcm

Inherits:
Push
  • Object
show all
Defined in:
app/models/notify_user/gcm.rb

Constant Summary collapse

PAYLOAD_LIMIT =
4096

Constants inherited from Push

Push::SYMBOL_NAMES_SIZE

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notifications, devices, options) ⇒ Gcm

Returns a new instance of Gcm.



9
10
11
12
13
# File 'app/models/notify_user/gcm.rb', line 9

def initialize(notifications, devices, options)
  super(notifications, devices, options)

  @push_options = setup_options
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



7
8
9
# File 'app/models/notify_user/gcm.rb', line 7

def client
  @client
end

#push_optionsObject

Returns the value of attribute push_options.



7
8
9
# File 'app/models/notify_user/gcm.rb', line 7

def push_options
  @push_options
end

Instance Method Details

#pushObject



15
16
17
# File 'app/models/notify_user/gcm.rb', line 15

def push
  send_notifications
end

#valid?(payload) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'app/models/notify_user/gcm.rb', line 23

def valid?(payload)
  payload.to_json.bytesize <= PAYLOAD_LIMIT
end