Class: Api2Convert::Webhook::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/api2convert/webhook/event.rb

Overview

A verified webhook callback. The API posts the job whose status changed.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(job, payload) ⇒ Event

Returns a new instance of Event.



12
13
14
15
16
# File 'lib/api2convert/webhook/event.rb', line 12

def initialize(job, payload)
  @job = job
  @payload = payload
  freeze
end

Instance Attribute Details

#jobModel::Job (readonly)

Returns the job whose status changed.

Returns:



8
9
10
# File 'lib/api2convert/webhook/event.rb', line 8

def job
  @job
end

#payloadHash (readonly)

Returns the full decoded callback body.

Returns:

  • (Hash)

    the full decoded callback body.



10
11
12
# File 'lib/api2convert/webhook/event.rb', line 10

def payload
  @payload
end

Class Method Details

.from_hash(payload) ⇒ Object



18
19
20
# File 'lib/api2convert/webhook/event.rb', line 18

def self.from_hash(payload)
  new(Model::Job.from_hash(payload), payload)
end