Class: DSP::API::UploadAdsInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/dsp/api/upload_ads_info.rb

Constant Summary collapse

@@target_url =
"#{DSP::ADX_URL}/order/sync"

Class Method Summary collapse

Class Method Details

.upload(options = {}) ⇒ Object

def upload(file_url = ”, dsp_order_id = Time.now.to_i)



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dsp/api/upload_ads_info.rb', line 8

def upload(options = {})
  order_info = [{
                  "dsp_order_id"=> "#{options[:dsp_order_id]}",
                  "client_name"=> "#{options[:client_name]}",
                  "file_info"=> [{
                  "file_url"=> "#{options[:file_url]}" 
                  }],
                  "targeting_url"=> "#{options[:targeting_url]}" ,
                "monitor_url"=> options[:monitor_url]
              }].to_json
  body = {order_info: order_info}.merge(DSP::AUTH)
  req = HTTParty.post(@@target_url, body: body).body
  JSON.parse(req)
end