Sha256: e7d87143893bbbb96e9aa13f1bf2a68968a17948783904c20b83d12326d8e11a

Contents?: true

Size: 1.86 KB

Versions: 12

Compression:

Stored size: 1.86 KB

Contents

#
# Copyright (C) 2007 Mobio Networks, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

=begin
this provides advertising fetch for m_khoj  
=end
require 'uri'
require 'open-uri' 

module Rmobio
  module Ads
    module MKhoj
      
      
      def getAd(keywords,adClient)
        getAdByPage(adClient) # keywords have no effect in mKhoj 
      end
      
      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
      
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
rmobio-1.1.15 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.11 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.12 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.10 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.14 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.13 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.19 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.16 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.18 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.20 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.17 lib/rmobio/ads/m_khoj.rb
rmobio-1.1.21 lib/rmobio/ads/m_khoj.rb