Class: Peatio::Model::DepositCreatedConsumer

Inherits:
Object
  • Object
show all
Defined in:
app/consumers/peatio/model/deposit_created_consumer.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.call(event) ⇒ Object



17
18
19
# File 'app/consumers/peatio/model/deposit_created_consumer.rb', line 17

def call(event)
  new.call(event)
end

Instance Method Details

#call(event) ⇒ Object



7
8
9
10
11
12
13
14
# File 'app/consumers/peatio/model/deposit_created_consumer.rb', line 7

def call(event)
  user = event[:record][:user]
  Event::Event.where(trigger_key: 'deposit', trigger_value: 'created').each do |event|
    next if event.participants.exists?(uid: user[:uid])

    event.participants.create!(uid: user[:uid])
  end
end