Module: Rmobio::Ads::MKhoj

Defined in:
lib/rmobio/ads/m_khoj.rb

Instance Method Summary collapse

Instance Method Details

#getAd(keywords, adClient) ⇒ Object



29
30
31
# File 'lib/rmobio/ads/m_khoj.rb', line 29

def getAd(keywords,adClient)
  getAdByPage(adClient) # keywords have no effect in mKhoj 
end

#getAdByPage(adClient) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/rmobio/ads/m_khoj.rb', line 33

def getAdByPage(adClient)
  # mKhoj just detects your URL, so you don't really need an adClient variable for this particular network!
  # but we have it here for consistency
  handset = request.user_agent if request.user_agent
  # handset="nokia6030/"
  handset = URI.escape(handset)
  #carrier = URI.escape(request.remote_ip)
  carrier="59.181.113.59" # only works with India carriers!!
  
  adUrl="http://www.mkhoj.com/view/Traffic/ShowAd.aspx?siteId=330ed28f-0de9-4c4f-b0a8-1f2118358c80&handset=nokia6030/&carrier=59.181.113.59"
  logger.info "Calling: " + adUrl
  #adUrl = "http://www.mkhoj.com/view/Traffic/ShowAd.aspx?siteId=330ed28f-0de9-4c4f-b0a8-1f2118358c80&handset="+handset+"&carrier="+carrier   
  begin
    @ad = open(adUrl).read   
    logger.info "Returned ad: " + @ad
  rescue
  end 
  @ad
end