Class: Unresponsys::Event

Inherits:
Object show all
Extended by:
Forwardable
Defined in:
lib/unresponsys/event.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Event

Returns a new instance of Event.



7
8
9
10
# File 'lib/unresponsys/event.rb', line 7

def initialize(options = {})
  @event_name = options[:event]
  @member     = options[:member]
end

Instance Attribute Details

#memberObject (readonly)

Returns the value of attribute member.



5
6
7
# File 'lib/unresponsys/event.rb', line 5

def member
  @member
end

Instance Method Details

#saveObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/unresponsys/event.rb', line 12

def save
  body = {
    customEvent: {},
    recipientData: [{
      recipient: { listName: { objectName: @member.list.name }, recipientId:  @member.riid }
    }]
  }

  r = client.post("/events/#{@event_name}", body: body.to_json)
  return false if r.first['errorMessage'].present?
  true
end