Sha256: 83e67b91ec1719f38059a39cf11461c68c8656c1040fbae7ebef3067399bc68d

Contents?: true

Size: 697 Bytes

Versions: 3

Compression:

Stored size: 697 Bytes

Contents

#!/usr/bin/env ruby

# Use adwords4r in parent dir
$LOAD_PATH.unshift '../lib/'

require 'adwords4r'

SEP = "---"

def dumpObj(o)
    str = ""
    o.instance_variables.each { |v| str << dumpAttr(o, v)}
    return str << SEP
end

def dumpAttr(o, v)
    name = v.sub(/@/,'')
    value = eval("o.#{name}.to_s")
    return "#{name}: #{value}\n"
end

begin
    adwords = AdWords::API.new
    
    res = adwords.estimateKeywordList(
        [AdWords::KeywordRequest.new(nil, 50000, false, 'flowers', 'Broad')]).estimateKeywordListReturn
    res.each {|c| puts dumpObj(c)}

rescue AdWords::Error::UnknownAPICall => e
    puts e
rescue AdWords::Error::ApiError => e
    puts e.code
    puts e.message
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
adwords4r-11.1.0 examples/old/traffic_estimator.rb
adwords4r-11.0.2 examples/traffic_estimator.rb
adwords4r-11.0.3 examples/traffic_estimator.rb