You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
716 B
27 lines
716 B
require 'uri'
|
|
require 'net/http'
|
|
|
|
class SyncTrustieJob < ApplicationJob
|
|
queue_as :default
|
|
|
|
def perform(type, count)
|
|
Rails.logger.info("#######_________response__sync__start__#########")
|
|
|
|
token = EduSetting.get('trustie_api_token')
|
|
api_host = EduSetting.get('trustie_api_url')
|
|
|
|
url = "#{api_host}/api/v1/homes/sync_count"
|
|
sync_json = {
|
|
"token": token,
|
|
"type": type,
|
|
"number": count
|
|
}
|
|
uri = URI.parse(url)
|
|
if api_host
|
|
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
|
|
end
|