Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Testing the list/create/update/delete ad methods
71: # create an ad
72: # create_ad(oid, cid, n, mpid, sd, ed, d, vinit, vaud, vlang, pltyp, ct, pdev, arc, params = {})
73: gmt_start = DateTime.parse("2014-1-26").to_time.to_i #+ offset_in_seconds
74: gmt_end = DateTime.parse("2014-1-31" + 'T23:59:00').to_time.to_i
75: new_add = mash(@adap.create_ad("6482","44810", "Best Test Ad Ever!", "33", gmt_start, gmt_end, "15", "AUTO", "YES", "ENGLISH", "GAME_PLAYER", "PRO", "ANY", "VIDEO"))
=> 76: binding.pry
77: end
78: end
[1] pry(#<AdapMiddleware::App>)> gmt_start
=> 1390694400
[2] pry(#<AdapMiddleware::App>)> gmt_end
=> 1391212740
[3] pry(#<AdapMiddleware::App>)> new_add
=> {"result"=>{"code"=>"OK", "msg"=>""}, "id"=>198348}
{"result"=>{"code"=>"OK", "msg"=>""},
"ads"=>
[{"id"=>2,
"campaign_id"=>7181,
"external_id"=>"Google-5min-2",
"name"=>"Google Overlay",
"ad_type"=>"OO",
"status"=>"DELETED",
"serving_start_date"=>1245264514,
"serving_end_date"=>1325404740,
"cross_view_frequency_capping_amount"=>-2,
"cross_view_frequency_capping_reset_period_in_seconds"=>0,
"targeting_expression"=>
"([Publisher]=\"answers\" AND ([Zone] IN (\"B_pre\",\"no_google\",\"D_pre_post\"))) OR ([Publisher]=\"5min_wikihow\" AND ([Zone] IN (\"D_pre_post\",\"B_pre\",\"no_google\"))) OR ([Publisher]=\"5min\" AND ([Zone] IN (\"no_google\",\"D_pre_post\",\"B_pre\",\"test1\",\"test\",\"E_pre_over_post\",\"A_pre_over\")))",
"placement_targeting_expression"=>"",
"delivery_catch_up_speed"=>"CATCH_UP_QUICKLY",
"delivery_algorithm_type"=>"NONE",
"site_level_reporting"=>0,
"companion_types"=>[],
"durations"=>[],
"property_types"=>[],
"companion_delivery"=>"ALL_REQUIRED",
"targeting_attributes"=>[],
"cost"=>0.0,
"price"=>0.0,
"ad_response_capability"=>"VIDEO",
"targeting_criteria_expression"=>"",
"date_ranges"=>[],
"market_place_ids"=>[1],
"max_ecpm"=>0.0,
"ecpm_type"=>"",
"click_through_rate"=>0.0,
"completion_rate"=>0,
"audience_gender"=>"",
"audience_age_start"=>0,
"audience_age_end"=>0,
"aod_buyer_margin"=>0.0,
"aod_passthrough_cost"=>0.0,
"tv"=>nil}],
"count"=>146033}
74: params = {}
75: params["n"] = "The new updated Name for this test Ad"
76: existing_ad = mash(@adap.update_ad("198348", params))
77:
78: delete_response = mash(@adap.delete_ad("198348"))
=> 79: binding.pry
80:
81: end
82: end
[1] pry(#<AdapMiddleware::App>)> existing_ad
=> {"result"=>{"code"=>"OK", "msg"=>""}, "id"=>198348}
[2] pry(#<AdapMiddleware::App>)> delete_response
=> {"result"=>{"code"=>"OK", "msg"=>""}, "id"=>198348}
[3] pry(#<AdapMiddleware::App>)> mash(@adap.list_ads({"aid"=>"198348"}))
Found bundle for host go.adap.tv: 0x7f96618c6fa0
Connection 0 seems to be dead!
Closing connection 0
Adding handle: conn: 0x7f965d001200
Adding handle: send: 0
Adding handle: recv: 0
Curl_addHandleToPipeline: length: 1
- Conn 1 (0x7f965d001200) send_pipe: 1, recv_pipe: 0
About to connect() to go.adap.tv port 443 (#1)
Trying 74.217.78.174...
Connected to go.adap.tv (74.217.78.174) port 443 (#1)
TLS 1.2 connection using TLS_RSA_WITH_RC4_128_SHA
Server certificate: *.adap.tv
Server certificate: Entrust Certification Authority - L1C
Server certificate: Entrust.net Certification Authority (2048)
GET /ads/list?aid=198348&ts=1392069072&user_id=8842&signature=zkM1U1EXRqoDhUJJO7j9n2Ehad4%3D HTTP/1.1
Host: go.adap.tv
Accept: */*
User-Agent: Typhoeus - https://github.com/typhoeus/typhoeus
HTTP/1.1 200 OK
Server ribs2.0 is not blacklisted
Server: ribs2.0
Content-Type: application/json
Connection: Keep-Alive
Access-Control-Allow-Origin: -
Access-Control-Allow-Credentials: true
Access-Control-Expose-Header: Set-Cookie
Content-Length: 1472
Connection #1 to host go.adap.tv left intact
=> {"result"=>{"code"=>"OK", "msg"=>""},
"ads"=>
[{"id"=>198348,
"campaign_id"=>44810,
"external_id"=>"6482_besttestadever21_130",
"name"=>"The new updated Name for this test Ad",
"ad_type"=>"ATM",
"status"=>"DELETED",
"serving_start_date"=>1390694400,
"serving_end_date"=>1391212740,
"cross_view_frequency_capping_amount"=>-2,
"cross_view_frequency_capping_reset_period_in_seconds"=>-2,
"targeting_expression"=>"",
"placement_targeting_expression"=>"",
"delivery_catch_up_speed"=>"DELIVER_EVENLY",
"delivery_algorithm_type"=>"NONE",
"site_level_reporting"=>0,
"companion_types"=>[],
"durations"=>["0"],
"property_types"=>[],
"companion_delivery"=>"ALL_OPTIONAL",
"targeting_attributes"=>
[{"attribute"=>"VideoQuality", "values"=>["PRO"]},
{"attribute"=>"AdInitiation", "values"=>["AUTO"]},
{"attribute"=>"MediaType", "values"=>["GAME_PLAYER"]},
{"attribute"=>"AdSound", "values"=>["YES"]},
{"attribute"=>"PlacementListingType", "values"=>["_ALL_PLACEMENT_"]},
{"attribute"=>"PlatformDevices",
"values"=>
["INTERNET_TV", "MOBILES", "GAME_CONSOLE", "TABLETS", "ONLINE_VIDEO"]},
{"attribute"=>"Language", "values"=>["ENGLISH"]}],
"cost"=>0.0,
"price"=>0.0,
"ad_response_capability"=>"VIDEO",
"targeting_criteria_expression"=>"",
"date_ranges"=>[{"start_date"=>1390694400, "end_date"=>1391212740}],
"market_place_ids"=>[33],
"max_ecpm"=>0.0,
"ecpm_type"=>"",
"click_through_rate"=>0.0,
"completion_rate"=>0,
"audience_gender"=>"",
"audience_age_start"=>0,
"audience_age_end"=>0,
"aod_buyer_margin"=>0.0,
"aod_passthrough_cost"=>0.0,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.