Permalink
Browse files

Merge branch 'master' of https://code.google.com/p/google-api-ads-ruby

  • Loading branch information...
dklimkin committed Mar 13, 2012
2 parents 88ad2d5 + 26d2aa5 commit 79e03830d0b4390e83651e00f11647ede6c21688
@@ -47,13 +47,17 @@ def initialize(code, body)
class TestParametersValidator < Test::Unit::TestCase
def setup
config = AdsCommon::Config.new({})
- @handler = AdsCommon::Auth::ClientLoginHandler.new(config, nil, nil)
+ @handler = AdsCommon::Auth::ClientLoginHandler.new(
+ config, 'http://www.google.com', nil)
end
def test_handle_login_error_captcha
assert_raises (AdsCommon::Errors::CaptchaRequiredError) do
response = ResponseStub.new(403, '')
- results = {'Error' => 'CaptchaRequired'}
+ results = {
+ 'Error' => 'CaptchaRequired',
+ 'CaptchaUrl' => '/account/test-captcha'
+ }
@handler.handle_login_error({}, response, results)
end
end
View
@@ -4,6 +4,7 @@
- Added .gemspec and updated packaging process.
- Removed explicit require for RubyGems, see README.
- Fixed reports retrieval via curb HTTPI backend.
+ - Removed support for deprecated BulkOpportunityService.
0.5.0:
- Removed deprecated API versions (pre-v201109).
@@ -1,95 +0,0 @@
-#!/usr/bin/env ruby
-# Encoding: utf-8
-#
-# Author:: api.sgomes@gmail.com (Sérgio Gomes)
-#
-# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
-#
-# License:: Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-# implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-# This example reads all the keyword opportunities for the customer.
-#
-# Tags: BulkOpportunityService.get
-
-require 'adwords_api'
-require 'adwords_api/utils'
-
-API_VERSION = :v201109
-PAGE_SIZE = 20
-
-def get_keyword_opportunities()
- # AdwordsApi::Api will read a config file from ENV['HOME']/adwords_api.yml
- # when called without parameters.
- adwords = AdwordsApi::Api.new
-
- # To enable logging of SOAP requests, set the log_level value to 'DEBUG' in
- # the configuration file or provide your own logger:
- # adwords.logger = Logger.new('adwords_xml.log')
-
- bulk_opportunity_srv = adwords.service(:BulkOpportunityService, API_VERSION)
-
- # Construct selector object.
- selector = {
- :requested_attribute_types => ['KEYWORD', 'IDEA_TYPE'],
- :paging => {
- :start_index => 0,
- :number_results => PAGE_SIZE
- }
- }
-
- # Perform request.
- ideas = []
- index = 0
- begin
- page = bulk_opportunity_srv.get(selector)
- if page and page[:entries]
- page[:entries].each do |entry|
- ideas += entry[:opportunity_ideas] if entry[:opportunity_ideas]
- end
- end
- break if page[:total_num_entries] <= index
- index += PAGE_SIZE
- selector[:paging][:start_index] = index
- end while page[:total_num_entries] > index
-
- # Display results.
- ideas.each do |idea|
- data = AdwordsApi::Utils.map(idea[:data])
- keyword = data['KEYWORD'][:value][:text]
- idea_type = data['IDEA_TYPE'][:value]
- puts " Found opportunity idea of type \"%s\": \"%s\"" % [idea_type, keyword]
- end
- puts "Total opportunity ideas: %d." % [ideas.length]
-end
-
-if __FILE__ == $0
- begin
- get_keyword_opportunities()
-
- # HTTP errors.
- rescue AdsCommon::Errors::HttpError => e
- puts "HTTP Error: %s" % e
-
- # API errors.
- rescue AdwordsApi::Errors::ApiException => e
- puts "Message: %s" % e.message
- puts 'Errors:'
- e.errors.each_with_index do |error, index|
- puts "\tError [%d]:" % (index + 1)
- error.each do |field, value|
- puts "\t\t%s: %s" % [field, value]
- end
- end
- end
-end
@@ -47,19 +47,35 @@ class << ApiConfig
# Configure the services available to each version
@@service_config = {
- :v201109 => [:AdExtensionOverrideService, :AdGroupAdService,
- :AdGroupCriterionService, :AdGroupService, :AdParamService,
- :AlertService, :BulkMutateJobService,
- :BulkOpportunityService, :CampaignAdExtensionService,
- :CampaignCriterionService, :CampaignService,
- :CampaignTargetService, :ConversionTrackerService,
- :CustomerSyncService, :DataService, :ExperimentService,
- :GeoLocationService, :InfoService, :MediaService,
- :ReportDefinitionService, :ServicedAccountService,
- :TargetingIdeaService, :TrafficEstimatorService,
- :UserListService, :ConstantDataService,
- :LocationCriterionService, :MutateJobService,
- :CreateAccountService]
+ :v201109 => [
+ :AdExtensionOverrideService,
+ :AdGroupAdService,
+ :AdGroupCriterionService,
+ :AdGroupService,
+ :AdParamService,
+ :AlertService,
+ :BulkMutateJobService,
+ :CampaignAdExtensionService,
+ :CampaignCriterionService,
+ :CampaignService,
+ :CampaignTargetService,
+ :ConstantDataService,
+ :ConversionTrackerService,
+ :CreateAccountService,
+ :CustomerSyncService,
+ :DataService,
+ :ExperimentService,
+ :GeoLocationService,
+ :InfoService,
+ :LocationCriterionService,
+ :MediaService,
+ :MutateJobService,
+ :ReportDefinitionService,
+ :ServicedAccountService,
+ :TargetingIdeaService,
+ :TrafficEstimatorService,
+ :UserListService
+ ]
}
# Configure the different environments, with the base URL for each one
@@ -85,27 +101,26 @@ class << ApiConfig
[:v201109, :AdParamService] => 'cm/',
[:v201109, :AlertService] => 'mcm/',
[:v201109, :BulkMutateJobService] => 'job/',
- [:v201109, :BulkOpportunityService] => 'o/',
[:v201109, :CampaignAdExtensionService] => 'cm/',
[:v201109, :CampaignCriterionService] => 'cm/',
[:v201109, :CampaignService] => 'cm/',
[:v201109, :CampaignTargetService] => 'cm/',
+ [:v201109, :ConstantDataService] => 'cm/',
[:v201109, :ConversionTrackerService] => 'cm/',
+ [:v201109, :CreateAccountService] => 'mcm/',
[:v201109, :CustomerSyncService] => 'ch/',
[:v201109, :DataService] => 'cm/',
[:v201109, :ExperimentService] => 'cm/',
[:v201109, :GeoLocationService] => 'cm/',
[:v201109, :InfoService] => 'info/',
+ [:v201109, :LocationCriterionService] => 'cm/',
[:v201109, :MediaService] => 'cm/',
+ [:v201109, :MutateJobService] => 'cm/',
[:v201109, :ReportDefinitionService] => 'cm/',
[:v201109, :ServicedAccountService] => 'mcm/',
[:v201109, :TargetingIdeaService] => 'o/',
[:v201109, :TrafficEstimatorService] => 'o/',
- [:v201109, :UserListService] => 'cm/',
- [:v201109, :ConstantDataService] => 'cm/',
- [:v201109, :LocationCriterionService] => 'cm/',
- [:v201109, :MutateJobService] => 'cm/',
- [:v201109, :CreateAccountService] => 'mcm/'
+ [:v201109, :UserListService] => 'cm/'
}
# Configure the auth servers to use for each environment
@@ -1,32 +0,0 @@
-#!/usr/bin/ruby
-# This is auto-generated code, changes will be overwritten.
-# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
-# License:: Licensed under the Apache License,Version 2.0 (the "License").
-#
-# Code generated by AdsCommon library 0.6.0 on 2011-12-02 16:42:37.
-
-require 'ads_common/savon_service'
-require 'adwords_api/v201109/bulk_opportunity_service_registry'
-
-module AdwordsApi; module V201109; module BulkOpportunityService
- class BulkOpportunityService < AdsCommon::SavonService
- def initialize(api, endpoint)
- namespace = 'https://adwords.google.com/api/adwords/o/v201109'
- super(api, endpoint, namespace, :v201109)
- end
-
- def get(*args, &block)
- return execute_action('get', args, &block)
- end
-
- private
-
- def get_service_registry()
- return BulkOpportunityServiceRegistry
- end
-
- def get_module()
- return AdwordsApi::V201109::BulkOpportunityService
- end
- end
-end; end; end
@@ -1,44 +0,0 @@
-#!/usr/bin/ruby
-# This is auto-generated code, changes will be overwritten.
-# Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
-# License:: Licensed under the Apache License,Version 2.0 (the "License").
-#
-# Code generated by AdsCommon library 0.6.0 on 2011-12-02 16:42:37.
-
-require 'adwords_api/errors'
-
-module AdwordsApi; module V201109; module BulkOpportunityService
- class BulkOpportunityServiceRegistry
- BULKOPPORTUNITYSERVICE_METHODS = {:get=>{:input=>[{:name=>:selector, :type=>"BulkOpportunitySelector", :min_occurs=>0, :max_occurs=>1}], :output=>{:name=>"get_response", :fields=>[{:name=>:rval, :type=>"BulkOpportunityPage", :min_occurs=>0, :max_occurs=>1}]}}}
- BULKOPPORTUNITYSERVICE_TYPES = {:AdGroupBidLandscape=>{:fields=>[{:name=>:type, :type=>"AdGroupBidLandscape.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:landscape_current, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"BidLandscape", :ns=>0}, :BidLandscape=>{:fields=>[{:name=>:campaign_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:ad_group_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:start_date, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:end_date, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:landscape_points, :type=>"BidLandscape.LandscapePoint", :min_occurs=>0, :max_occurs=>:unbounded}], :abstract=>true, :base=>"DataEntry", :ns=>0}, :"BidLandscape.LandscapePoint"=>{:fields=>[{:name=>:bid, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:clicks, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:cost, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:marginal_cpc, :type=>"Money", :min_occurs=>0, :max_occurs=>1}, {:name=>:impressions, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :ComparableValue=>{:fields=>[{:name=>:comparable_value_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :ns=>0}, :Criterion=>{:fields=>[{:name=>:id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:type, :type=>"Criterion.Type", :min_occurs=>0, :max_occurs=>1}, {:name=>:criterion_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :CriterionBidLandscape=>{:fields=>[{:name=>:criterion_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"BidLandscape", :ns=>0}, :DoubleValue=>{:fields=>[{:name=>:number, :type=>"double", :min_occurs=>0, :max_occurs=>1}], :base=>"NumberValue", :ns=>0}, :Keyword=>{:fields=>[{:name=>:text, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:match_type, :type=>"KeywordMatchType", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :LongValue=>{:fields=>[{:name=>:number, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"NumberValue", :ns=>0}, :Money=>{:fields=>[{:name=>:micro_amount, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"ComparableValue", :ns=>0}, :NumberValue=>{:fields=>[], :abstract=>true, :base=>"ComparableValue", :ns=>0}, :Paging=>{:fields=>[{:name=>:start_index, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:number_results, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :Placement=>{:fields=>[{:name=>:url, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :Product=>{:fields=>[{:name=>:conditions, :type=>"ProductCondition", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:text, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :ProductCondition=>{:fields=>[{:name=>:argument, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:operand, :type=>"ProductConditionOperand", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :ProductConditionOperand=>{:fields=>[{:name=>:operand, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :SoapHeader=>{:fields=>[{:name=>:auth_token, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:client_customer_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:developer_token, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_agent, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:validate_only, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}, {:name=>:partial_failure, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :SoapResponseHeader=>{:fields=>[{:name=>:request_id, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:service_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:method_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:operations, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:response_time, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:units, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :ns=>0}, :DataEntry=>{:fields=>[{:name=>:data_entry_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true, :ns=>0}, :CriterionUserInterest=>{:fields=>[{:name=>:user_interest_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_interest_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :CriterionUserList=>{:fields=>[{:name=>:user_list_id, :type=>"long", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_list_name, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:user_list_membership_status, :type=>"CriterionUserList.MembershipStatus", :min_occurs=>0, :max_occurs=>1}], :base=>"Criterion", :ns=>0}, :Vertical=>{:fields=>[{:name=>:path, :type=>"string", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Criterion", :ns=>0}, :"AdGroupBidLandscape.Type"=>{:fields=>[], :ns=>0}, :"Criterion.Type"=>{:fields=>[], :ns=>0}, :KeywordMatchType=>{:fields=>[], :ns=>0}, :"CriterionUserList.MembershipStatus"=>{:fields=>[], :ns=>0}, :AdFormatSpec=>{:fields=>[{:name=>:format, :type=>"SiteConstants.AdFormat", :min_occurs=>0, :max_occurs=>1}]}, :AdFormatSpecListAttribute=>{:fields=>[{:name=>:value, :type=>"AdFormatSpec", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Attribute"}, :BooleanAttribute=>{:fields=>[{:name=>:value, :type=>"boolean", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :DoubleAttribute=>{:fields=>[{:name=>:value, :type=>"double", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :IdeaTypeAttribute=>{:fields=>[{:name=>:value, :type=>"IdeaType", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :InStreamAdInfo=>{:fields=>[{:name=>:max_ad_duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:min_ad_duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:median_ad_duration, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:pre_roll_percent, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:mid_roll_percent, :type=>"double", :min_occurs=>0, :max_occurs=>1}, {:name=>:post_roll_percent, :type=>"double", :min_occurs=>0, :max_occurs=>1}]}, :InStreamAdInfoAttribute=>{:fields=>[{:name=>:value, :type=>"InStreamAdInfo", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :IntegerAttribute=>{:fields=>[{:name=>:value, :type=>"int", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :IntegerSetAttribute=>{:fields=>[{:name=>:value, :type=>"int", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Attribute"}, :LongAttribute=>{:fields=>[{:name=>:value, :type=>"long", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :MonthlySearchVolume=>{:fields=>[{:name=>:year, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:month, :type=>"int", :min_occurs=>0, :max_occurs=>1}, {:name=>:count, :type=>"long", :min_occurs=>0, :max_occurs=>1}]}, :MonthlySearchVolumeAttribute=>{:fields=>[{:name=>:value, :type=>"MonthlySearchVolume", :min_occurs=>0, :max_occurs=>:unbounded}], :base=>"Attribute"}, :OpportunityIdeaTypeAttribute=>{:fields=>[{:name=>:value, :type=>"OpportunityIdeaType", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :PlacementTypeAttribute=>{:fields=>[{:name=>:value, :type=>"SiteConstants.PlacementType", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :StringAttribute=>{:fields=>[{:name=>:value, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :WebpageDescriptor=>{:fields=>[{:name=>:url, :type=>"string", :min_occurs=>0, :max_occurs=>1}, {:name=>:title, :type=>"string", :min_occurs=>0, :max_occurs=>1}]}, :WebpageDescriptorAttribute=>{:fields=>[{:name=>:value, :type=>"WebpageDescriptor", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :BulkOpportunitySelector=>{:fields=>[{:name=>:idea_types, :type=>"OpportunityIdeaType", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:requested_attribute_types, :type=>"OpportunityAttributeType", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:paging, :type=>"Paging", :min_occurs=>0, :max_occurs=>1}]}, :MoneyAttribute=>{:fields=>[{:name=>:value, :type=>"Money", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :Range=>{:fields=>[{:name=>:min, :type=>"ComparableValue", :min_occurs=>0, :max_occurs=>1}, {:name=>:max, :type=>"ComparableValue", :min_occurs=>0, :max_occurs=>1}]}, :LongRangeAttribute=>{:fields=>[{:name=>:value, :type=>"Range", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :CriterionAttribute=>{:fields=>[{:name=>:value, :type=>"Criterion", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :KeywordAttribute=>{:fields=>[{:name=>:value, :type=>"Keyword", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :PlacementAttribute=>{:fields=>[{:name=>:value, :type=>"Placement", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :BidLandscapeAttribute=>{:fields=>[{:name=>:value, :type=>"BidLandscape", :min_occurs=>0, :max_occurs=>1}], :base=>"Attribute"}, :Attribute=>{:fields=>[{:name=>:attribute_type, :type=>"string", :min_occurs=>0, :max_occurs=>1}], :abstract=>true}, :OpportunityAttribute_AttributeMapEntry=>{:fields=>[{:name=>:key, :type=>"OpportunityAttributeType", :min_occurs=>0, :max_occurs=>1}, {:name=>:value, :type=>"Attribute", :min_occurs=>0, :max_occurs=>1}]}, :OpportunityIdea=>{:fields=>[{:name=>:data, :type=>"OpportunityAttribute_AttributeMapEntry", :min_occurs=>0, :max_occurs=>:unbounded}]}, :Opportunity=>{:fields=>[{:name=>:opportunity_ideas, :type=>"OpportunityIdea", :min_occurs=>0, :max_occurs=>:unbounded}]}, :BulkOpportunityPage=>{:fields=>[{:name=>:entries, :type=>"Opportunity", :min_occurs=>0, :max_occurs=>:unbounded}, {:name=>:total_num_entries, :type=>"int", :min_occurs=>0, :max_occurs=>1}]}, :IdeaType=>{:fields=>[]}, :OpportunityAttributeType=>{:fields=>[]}, :OpportunityIdeaType=>{:fields=>[]}, :"SiteConstants.AdFormat"=>{:fields=>[]}, :"SiteConstants.PlacementType"=>{:fields=>[]}}
- BULKOPPORTUNITYSERVICE_NAMESPACES = ["https://adwords.google.com/api/adwords/cm/v201109"]
-
- def self.get_method_signature(method_name)
- return BULKOPPORTUNITYSERVICE_METHODS[method_name.to_sym]
- end
-
- def self.get_type_signature(type_name)
- return BULKOPPORTUNITYSERVICE_TYPES[type_name.to_sym]
- end
-
- def self.get_namespace(index)
- return BULKOPPORTUNITYSERVICE_NAMESPACES[index]
- end
- end
-
- # Base class for exceptions.
- class ApplicationException < AdwordsApi::Errors::ApiException
- attr_reader :message # string
- attr_reader :application_exception_type # string
- end
-
- # Exception class for holding a list of service errors.
- class ApiException < ApplicationException
- attr_reader :errors # ApiError
- def initialize(exception_fault)
- @array_fields ||= []
- @array_fields << 'errors'
- super(exception_fault)
- end
- end
-end; end; end
View
@@ -1,3 +1,5 @@
+0.2.9:
+
0.2.8:
- Added .gemspec and updated packaging process.
- Removed explicit require for RubyGems, see README.
@@ -21,6 +21,6 @@
module DfpApi
module ApiConfig
- CLIENT_LIB_VERSION = '0.2.8'
+ CLIENT_LIB_VERSION = '0.2.9'
end
end

0 comments on commit 79e0383

Please sign in to comment.