Class: Userlist::Push::Event

Inherits:
Resource show all
Defined in:
lib/userlist/push/event.rb

Instance Attribute Summary

Attributes inherited from Resource

#attributes

Instance Method Summary collapse

Methods inherited from Resource

endpoint, resource_name, #respond_to_missing?

Constructor Details

#initialize(attributes = {}) ⇒ Event

Returns a new instance of Event.

Raises:

  • (ArgumentError)


4
5
6
7
8
9
10
11
12
# File 'lib/userlist/push/event.rb', line 4

def initialize(attributes = {})
  raise ArgumentError, 'Missing required attributes hash' unless attributes
  raise ArgumentError, 'Missing required parameter :name' unless attributes[:name]
  raise ArgumentError, 'Missing required parameter :user' unless attributes[:user]

  attributes[:occured_at] ||= Time.now

  super
end

Dynamic Method Handling

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