google-dfp-api 0.13.0 → 0.13.1

Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog CHANGED
@@ -1,3 +1,6 @@
1
+ 0.13.1:
2
+ - Require google-ads-common 0.11.3 or later from now on.
3
+
1
4
  0.13.0:
2
5
  - Added support for DFP v201602.
3
6
  - Removed support for DFP v201411.
@@ -82,6 +82,7 @@ def get_availability_forecast()
82
82
  :cost_type => 'CPM'
83
83
  }
84
84
 
85
+ # [START forecasting_3] MOE:strip_line
85
86
  prospective_line_item = {
86
87
  :advertiser_id => advertiser_id,
87
88
  :line_item => line_item
@@ -96,6 +97,7 @@ def get_availability_forecast()
96
97
  # Get forecast for the line item.
97
98
  forecast = forecast_service.get_availability_forecast(
98
99
  prospective_line_item, forecast_options)
100
+ # [END forecasting_3] MOE:strip_line
99
101
 
100
102
  if forecast
101
103
  # Display results.
@@ -31,12 +31,15 @@ def get_availability_forecast_for_line_item()
31
31
  # the configuration file or provide your own logger:
32
32
  # dfp.logger = Logger.new('dfp_xml.log')
33
33
 
34
+ # [START forecasting_1] MOE:strip_line
34
35
  # Get the ForecastService.
35
36
  forecast_service = dfp.service(:ForecastService, API_VERSION)
37
+ # [END forecasting_1] MOE:strip_line
36
38
 
37
39
  # Set the line item to get a forecast for.
38
40
  line_item_id = 'INSERT_LINE_ITEM_ID_HERE'.to_i
39
41
 
42
+ # [START forecasting_2] MOE:strip_line
40
43
  # Set forecasting options.
41
44
  forecast_options = {
42
45
  :include_contending_line_items => True,
@@ -60,6 +63,7 @@ def get_availability_forecast_for_line_item()
60
63
  puts "%.2f%% %s possible." % [possible_percent, unit_type]
61
64
  end
62
65
  end
66
+ # [END forecasting_2] MOE:strip_line
63
67
  end
64
68
 
65
69
  if __FILE__ == $0
@@ -31,13 +31,16 @@ def get_delivery_forecast_for_line_items()
31
31
  # the configuration file or provide your own logger:
32
32
  # dfp.logger = Logger.new('dfp_xml.log')
33
33
 
34
+ # [START forecasting_4] MOE:strip_line
34
35
  # Get the ForecastService.
35
36
  forecast_service = dfp.service(:ForecastService, API_VERSION)
37
+ # [END forecasting_4] MOE:strip_line
36
38
 
37
39
  # Set the line items to get a forecast for.
38
40
  line_item_id1 = 'INSERT_LINE_ITEM_ID_1_HERE'.to_i
39
41
  line_item_id2 = 'INSERT_LINE_ITEM_ID_2_HERE'.to_i
40
42
 
43
+ # [START forecasting_5] MOE:strip_line
41
44
  # Get forecast for the line item.
42
45
  forecast = forecast_service.get_delivery_forecast_by_ids(
43
46
  [line_item_id1, line_item_id2], nil)
@@ -53,6 +56,7 @@ def get_delivery_forecast_for_line_items()
53
56
  single_forecast[:predicted_delivery_units], unit_type]
54
57
  end
55
58
  end
59
+ # [END forecasting_5] MOE:strip_line
56
60
  end
57
61
 
58
62
  if __FILE__ == $0
@@ -19,6 +19,6 @@
19
19
 
20
20
  module DfpApi
21
21
  module ApiConfig
22
- CLIENT_LIB_VERSION = '0.13.0'
22
+ CLIENT_LIB_VERSION = '0.13.1'
23
23
  end
24
24
  end
@@ -0,0 +1,105 @@
1
+ # Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
2
+ #
3
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
12
+ # implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+ # Tests issue #81.
17
+
18
+ require 'nori'
19
+ require 'ads_savon'
20
+ require 'test/unit'
21
+
22
+ require 'ads_common/savon_service'
23
+ require 'dfp_api/v201602/line_item_service'
24
+
25
+ # SavonService is abstract, defining a child class for the test.
26
+ class StubService < AdsCommon::SavonService
27
+
28
+ public :get_module
29
+
30
+ def initialize(namespace, endpoint, version)
31
+ @logger = Logger.new(STDERR)
32
+ @config = AdsCommon::Config.new({:library => {:logger => @logger}})
33
+ super(@config, namespace, endpoint, version)
34
+ end
35
+
36
+ def get_module()
37
+ return DfpApi::V201602::LineItemService
38
+ end
39
+ end
40
+
41
+
42
+ class TestDfpIssue81 < Test::Unit::TestCase
43
+
44
+ TEST_NAMESPACE = 'https://ads.google.com/apis/ads/publisher/'
45
+ TEST_ENDPOINT = (
46
+ 'https://ads.google.com/apis/ads/publisher/v201602/LineItemService?wsdl')
47
+ TEST_VERSION = :v201602
48
+
49
+ def setup()
50
+ @stub_service = StubService.new(TEST_NAMESPACE, TEST_ENDPOINT, TEST_VERSION)
51
+ nori_options = {
52
+ :strip_namespaces => true,
53
+ :convert_tags_to => lambda { |tag| tag.snakecase.to_sym },
54
+ :advanced_typecasting => false
55
+ }
56
+ @nori = Nori.new(nori_options)
57
+ end
58
+
59
+ def test_issue_81()
60
+ data = @nori.parse(get_xml_text())[:envelope][:body]
61
+ savon_service = StubService.new(TEST_NAMESPACE, TEST_ENDPOINT, TEST_VERSION)
62
+ assert_instance_of(DfpApi::V201602::LineItemService::ApiException,
63
+ savon_service.send(:exception_for_soap_fault, data))
64
+ end
65
+
66
+ def get_xml_text()
67
+ return <<EOT
68
+ <?xml version="1.0"?>
69
+ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
70
+ <soap:Header>
71
+ <ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201602">
72
+ <requestId>abc123</requestId>
73
+ <responseTime>658</responseTime>
74
+ </ResponseHeader>
75
+ </soap:Header>
76
+ <soap:Body>
77
+ <soap:Fault>
78
+ <faultcode>soap:Server</faultcode>
79
+ <faultstring>
80
+ [PublisherQueryLanguageContextError.UNEXECUTABLE @ Unknown column: 'blah']
81
+ </faultstring>
82
+ <detail>
83
+ <ApiExceptionFault
84
+ xmlns="https://www.google.com/apis/ads/publisher/v201502">
85
+ <message>
86
+ [PublisherQueryLanguageContextError.UNEXECUTABLE
87
+ @ Unknown column: 'blah']
88
+ </message>
89
+ <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
90
+ xsi:type="PublisherQueryLanguageContextError">
91
+ <fieldPath>Unknown column: 'blah'</fieldPath>
92
+ <trigger></trigger>
93
+ <errorString>
94
+ PublisherQueryLanguageContextError.UNEXECUTABLE
95
+ </errorString>
96
+ <reason>UNEXECUTABLE</reason>
97
+ </errors>
98
+ </ApiExceptionFault>
99
+ </detail>
100
+ </soap:Fault>
101
+ </soap:Body>
102
+ </soap:Envelope>
103
+ EOT
104
+ end
105
+ end
@@ -21,6 +21,10 @@
21
21
  $:.unshift File.expand_path('../../lib/', __FILE__)
22
22
  $:.unshift File.expand_path('../../', __FILE__)
23
23
 
24
+ # Work around jruby <= 1.7.8 issue with OpenSSL definition.
25
+ require 'openssl'
26
+ OpenSSL::SSL::SSLContext::METHODS = []
27
+
24
28
  # DFP API units tests.
25
29
  dfp_mask = File.join(File.dirname(__FILE__), 'dfp_api', 'test_*.rb')
26
30
  Dir.glob(dfp_mask).each { |file| require file }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-dfp-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.13.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-23 00:00:00.000000000 Z
13
+ date: 2016-03-07 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: google-ads-common
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 0.11.0
22
+ version: 0.11.3
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - ~>
29
29
  - !ruby/object:Gem::Version
30
- version: 0.11.0
30
+ version: 0.11.3
31
31
  description: google-dfp-api is a DFP API client library for Ruby
32
32
  email:
33
33
  - dfpapi-advisor+nicholas@google.com
@@ -1164,6 +1164,7 @@ files:
1164
1164
  - test/suite_unittests.rb
1165
1165
  - test/dfp_api/test_config.yml
1166
1166
  - test/dfp_api/test_dfp_api.rb
1167
+ - test/bugs/test_issue_00000081.rb
1167
1168
  - COPYING
1168
1169
  - README.md
1169
1170
  - ChangeLog
@@ -1195,3 +1196,4 @@ specification_version: 3
1195
1196
  summary: Ruby Client libraries for DFP API
1196
1197
  test_files:
1197
1198
  - test/dfp_api/test_dfp_api.rb
1199
+ - test/bugs/test_issue_00000081.rb