parent
ca5bb884ae
commit
621c035260
@ -0,0 +1,25 @@
|
||||
require 'uri'
|
||||
require 'net/http'
|
||||
|
||||
class SyncTrustieJob < ApplicationJob
|
||||
queue_as :default
|
||||
|
||||
def perform(type, count)
|
||||
Rails.logger.info("#######_________response__sync__start__#########")
|
||||
configs_content = Rails.application.config_for(:configuration)
|
||||
|
||||
token = configs_content["sync_token"]
|
||||
token_url = configs_content["sync_url"]
|
||||
url = "#{token_url}/api/v1/homes/sync_count"
|
||||
sync_json = {
|
||||
"token": token,
|
||||
"type": type,
|
||||
"number": count
|
||||
}
|
||||
uri = URI.parse(url)
|
||||
|
||||
http = Net::HTTP.new(uri.hostname, uri.port)
|
||||
http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'})
|
||||
Rails.logger.info("#######_________response__sync__end_____#########")
|
||||
end
|
||||
end
|
Loading…
Reference in new issue