Class: Userlist::Push::Message

Inherits:
Resource
  • Object
show all
Includes:
Operations::Push
Defined in:
lib/userlist/push/message.rb

Instance Attribute Summary

Attributes inherited from Resource

#config, #context, #payload

Instance Method Summary collapse

Methods included from Operations::Push

included

Methods inherited from Resource

association_names, #association_names, associations, #attribute_names, endpoint, #eql?, #for_context, from_payload, #hash, #identifier, resource_name, #respond_to_missing?, #to_hash, #to_json

Constructor Details

#initialize(payload = {}, config = Userlist.config) ⇒ Message

Returns a new instance of Message.



9
10
11
12
13
# File 'lib/userlist/push/message.rb', line 9

def initialize(payload = {}, config = Userlist.config)
  raise Userlist::ArgumentError, 'Missing required payload' unless payload

  super
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Userlist::Push::Resource

Instance Method Details

#push?Boolean

Returns:

  • (Boolean)


15
16
17
# File 'lib/userlist/push/message.rb', line 15

def push?
  super && (user.nil? || user.push?)
end