Class: PaxfulRails::SyncOrderBookJob
- Inherits:
-
ApplicationJob
- Object
- ApplicationJob
- PaxfulRails::SyncOrderBookJob
- Defined in:
- app/jobs/paxful_rails/sync_order_book_job.rb
Constant Summary collapse
- HOST =
"https://paxful.com/api".freeze
Instance Method Summary collapse
Instance Method Details
#perform ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/jobs/paxful_rails/sync_order_book_job.rb', line 6 def perform client = PaxfulClient.new( host: HOST, key: PaxfulRails.configuration.paxful_key, secret: PaxfulRails.configuration.paxful_secret, ) response = client.get_completed_trades return unless response.success? trades = response.parsed_body["data"]["trades"] trades.each do |payload| EnqueueCreateTradeJob.perform_async(payload) end end |