google-dfp-api 0.22.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 686591c920a9aeac7e14108b382f67235521171b
4
- data.tar.gz: b51d891c9ac928f54084afbe565a520dc038f08a
3
+ metadata.gz: c397f20b48dccdbd614f7987afba9304b4405471
4
+ data.tar.gz: 07f20684de0d8c47ca8b1de220422f5124d7e292
5
5
  SHA512:
6
- metadata.gz: e2f171519098bcbca0efc52994c76561f49a9a402174002c2a5feadeb4af1d565c7664c7f80722ac5ce6a1a356201ab1b1d694e18ead4ab118cb18f593bc1d90
7
- data.tar.gz: 5ca8da1155f23afa89fe7bb711ac30b5d85e8642ffe697f420eae67aa1754088cad3ec5b2f5fc1c7b18965e5993d1daf58061df6f3e2d5b6bd52e78972e1e68c
6
+ metadata.gz: ab2045bdfff1df0320cb8b96cf4d6731189c1927857e6319af40cf699e53844088a35bc0f44eabc064c9a1af51b7481ef97956aba525e2decbb65fe6779942bd
7
+ data.tar.gz: d8832b6c9a3d686942474b236acc77d74e913b6f3db7104d6bd843ebf7cd4e140da6d6820cd0d045b4f8725f970e489c569f52cd9f06b7ffe4dfa29a50525188
data/ChangeLog CHANGED
@@ -1,3 +1,10 @@
1
+ 1.0.0:
2
+ - Major version bump. The library has been stable and feature complete for
3
+ some time, and this is more accurately reflected by this version number.
4
+ - No longer include test files in the built gem.
5
+ - Removing support for multiple environments.
6
+ - Require google-ads-common 1.0.0 or later from now on.
7
+
1
8
  0.22.0:
2
9
  - Added support for v201708.
3
10
  - Removed support for v201608.
@@ -39,9 +39,6 @@
39
39
 
40
40
  # Required for all calls other than GetAllNetworks and MakeTestNetwork.
41
41
  :network_code: INSERT_NETWORK_CODE_HERE
42
- :service:
43
- # Only production environment is now available.
44
- :environment: PRODUCTION
45
42
  :connection:
46
43
  # Enable to request all responses to be compressed.
47
44
  :enable_gzip: false
@@ -32,7 +32,6 @@ module DfpApi
32
32
 
33
33
  # Set defaults
34
34
  DEFAULT_VERSION = :v201708
35
- DEFAULT_ENVIRONMENT = :PRODUCTION
36
35
  LATEST_VERSION = :v201708
37
36
 
38
37
  # Set other constants
@@ -139,16 +138,14 @@ module DfpApi
139
138
  :UserTeamAssociationService, :WorkflowRequestService],
140
139
  }
141
140
 
142
- # Configure the different environments, with the base URL for each one
143
- @@environment_config = {
144
- :PRODUCTION => {
145
- :oauth_scope => 'https://www.googleapis.com/auth/dfp',
146
- :header_ns => 'https://www.google.com/apis/ads/publisher/',
147
- :v201611 => 'https://ads.google.com/apis/ads/publisher/',
148
- :v201702 => 'https://ads.google.com/apis/ads/publisher/',
149
- :v201705 => 'https://ads.google.com/apis/ads/publisher/',
150
- :v201708 => 'https://ads.google.com/apis/ads/publisher/',
151
- }
141
+ # Configure the base URL for each version and scope.
142
+ @@config = {
143
+ :oauth_scope => 'https://www.googleapis.com/auth/dfp',
144
+ :header_ns => 'https://www.google.com/apis/ads/publisher/',
145
+ :v201611 => 'https://ads.google.com/apis/ads/publisher/',
146
+ :v201702 => 'https://ads.google.com/apis/ads/publisher/',
147
+ :v201705 => 'https://ads.google.com/apis/ads/publisher/',
148
+ :v201708 => 'https://ads.google.com/apis/ads/publisher/'
152
149
  }
153
150
 
154
151
  public
@@ -158,10 +155,6 @@ module DfpApi
158
155
  DEFAULT_VERSION
159
156
  end
160
157
 
161
- def self.default_environment
162
- DEFAULT_ENVIRONMENT
163
- end
164
-
165
158
  def self.latest_version
166
159
  LATEST_VERSION
167
160
  end
@@ -174,9 +167,8 @@ module DfpApi
174
167
  @@service_config
175
168
  end
176
169
 
177
- def self.environment_config(environment, key)
178
- return @@environment_config.include?(environment) ?
179
- @@environment_config[environment][key] : nil
170
+ def self.config(key)
171
+ @@config[key]
180
172
  end
181
173
 
182
174
  def self.subdir_config
@@ -19,6 +19,6 @@
19
19
 
20
20
  module DfpApi
21
21
  module ApiConfig
22
- CLIENT_LIB_VERSION = '0.22.0'
22
+ CLIENT_LIB_VERSION = '1.0.0'
23
23
  end
24
24
  end
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.22.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Danial Klimkin
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-16 00:00:00.000000000 Z
12
+ date: 2017-09-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-ads-common
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.14.0
20
+ version: 1.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.14.0
27
+ version: 1.0.0
28
28
  description: google-dfp-api is a DFP API client library for Ruby
29
29
  email:
30
30
  - dfpapi-advisor@google.com
@@ -440,10 +440,6 @@ files:
440
440
  - lib/dfp_api/v201708/workflow_request_service.rb
441
441
  - lib/dfp_api/v201708/workflow_request_service_registry.rb
442
442
  - lib/dfp_api/version.rb
443
- - test/bugs/test_issue_00000007.rb
444
- - test/bugs/test_issue_00000081.rb
445
- - test/dfp_api/test_credential_handler.rb
446
- - test/dfp_api/test_dfp_api.rb
447
443
  homepage: https://github.com/googleads/google-api-ads-ruby
448
444
  licenses:
449
445
  - Apache-2.0
@@ -464,12 +460,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
464
460
  version: 1.3.6
465
461
  requirements: []
466
462
  rubyforge_project: google-dfp-api
467
- rubygems_version: 2.6.11
463
+ rubygems_version: 2.6.8
468
464
  signing_key:
469
465
  specification_version: 4
470
466
  summary: Ruby Client libraries for DFP API
471
- test_files:
472
- - test/bugs/test_issue_00000007.rb
473
- - test/bugs/test_issue_00000081.rb
474
- - test/dfp_api/test_credential_handler.rb
475
- - test/dfp_api/test_dfp_api.rb
467
+ test_files: []
@@ -1,113 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Encoding: utf-8
3
- #
4
- # Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
5
- #
6
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
- # implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
- # Tests issue #7.
20
-
21
- require 'nori'
22
- require 'ads_savon'
23
- require 'test/unit'
24
-
25
- require 'ads_common/config'
26
- require 'ads_common/savon_service'
27
- require 'ads_savon/soap/response'
28
- require 'dfp_api/v201608/line_item_service'
29
-
30
- class HeaderHandler
31
- def prepare_request(http, soap)
32
- end
33
- end
34
-
35
- # SavonService is abstract, defining a child class for the test.
36
- class StubService7 < AdsCommon::SavonService
37
-
38
- public :get_module
39
-
40
- def initialize(namespace, endpoint, version)
41
- logger = Logger.new(STDERR)
42
- @config = AdsCommon::Config.new({:library => {:logger => logger}})
43
- super(@config, namespace, endpoint, version)
44
- @header_handler = HeaderHandler.new
45
- end
46
-
47
- def get_module()
48
- return DfpApi::V201608::LineItemService
49
- end
50
-
51
- def get_service_registry()
52
- return DfpApi::V201608::LineItemService::LineItemServiceRegistry
53
- end
54
- end
55
-
56
- class StubConfig
57
- attr_reader :raise_errors
58
- end
59
-
60
- class TestDfpIssue7 < Test::Unit::TestCase
61
-
62
- TEST_NAMESPACE = 'https://ads.google.com/apis/ads/publisher/'
63
- TEST_ENDPOINT =
64
- 'https://ads.google.com/apis/ads/publisher/v201608/LineItemService?wsdl'
65
- TEST_VERSION = :v201608
66
-
67
- def test_issue_7_request()
68
- args = {:line_items => [
69
- {:order_id => 42, :id => 82, :web_property_code => ''}
70
- ]}
71
- want = '<webPropertyCode></webPropertyCode>'
72
-
73
- savon_service =
74
- StubService7.new(TEST_NAMESPACE, TEST_ENDPOINT, TEST_VERSION)
75
- result = savon_service.send(
76
- :handle_soap_request, :update_line_items, true, args, nil)
77
-
78
- assert(result.include?(want),
79
- "Expected '%s' but not found in:\n%s" % [want, result])
80
- end
81
-
82
- def test_issue_7_response()
83
- args = get_xml_response_text()
84
-
85
- response = GoogleAdsSavon::SOAP::Response.new(StubConfig.new, nil)
86
- nori = response.send(:nori)
87
-
88
- result = nori.parse(args)
89
- line_item =
90
- result[:body][:get_line_items_by_statement_response][:rval][:results]
91
-
92
- assert_equal('', line_item[:web_property_code])
93
- end
94
-
95
- def get_xml_response_text()
96
- return <<EOT
97
- <soap:Body>
98
- <getLineItemsByStatementResponse xmlns="https://www.google.com/apis/ads/publisher/v201608">
99
- <rval>
100
- <totalResultSetSize>1</totalResultSetSize>
101
- <startIndex>0</startIndex>
102
- <results>
103
- <orderId>41</orderId>
104
- <id>42</id>
105
- <name>name42</name>
106
- <webPropertyCode></webPropertyCode>
107
- </results>
108
- </rval>
109
- </getLineItemsByStatementResponse>
110
- </soap:Body>
111
- EOT
112
- end
113
- end
@@ -1,110 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Encoding: utf-8
3
- #
4
- # Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
5
- #
6
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
- # implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
- # Tests issue #81.
20
-
21
- require 'nori'
22
- require 'ads_savon'
23
- require 'test/unit'
24
-
25
- require 'ads_common/savon_service'
26
- require 'dfp_api/v201702/line_item_service'
27
-
28
- # SavonService is abstract, defining a child class for the test.
29
- class StubService81 < AdsCommon::SavonService
30
-
31
- public :get_module
32
-
33
- def initialize(namespace, endpoint, version)
34
- @logger = Logger.new(STDERR)
35
- @config = AdsCommon::Config.new({:library => {:logger => @logger}})
36
- super(@config, namespace, endpoint, version)
37
- end
38
-
39
- def get_module()
40
- return DfpApi::V201702::LineItemService
41
- end
42
- end
43
-
44
-
45
- class TestDfpIssue81 < Test::Unit::TestCase
46
-
47
- TEST_NAMESPACE = 'https://ads.google.com/apis/ads/publisher/'
48
- TEST_ENDPOINT = (
49
- 'https://ads.google.com/apis/ads/publisher/v201702/LineItemService?wsdl')
50
- TEST_VERSION = :v201702
51
-
52
- def setup()
53
- @stub_service =
54
- StubService81.new(TEST_NAMESPACE, TEST_ENDPOINT, TEST_VERSION)
55
- nori_options = {
56
- :strip_namespaces => true,
57
- :convert_tags_to => lambda { |tag| tag.snakecase.to_sym },
58
- :advanced_typecasting => false
59
- }
60
- @nori = Nori.new(nori_options)
61
- end
62
-
63
- def test_issue_81()
64
- data = @nori.parse(get_xml_text())[:envelope][:body]
65
- savon_service =
66
- StubService81.new(TEST_NAMESPACE, TEST_ENDPOINT, TEST_VERSION)
67
- assert_instance_of(DfpApi::V201702::LineItemService::ApiException,
68
- savon_service.send(:exception_for_soap_fault, data))
69
- end
70
-
71
- def get_xml_text()
72
- return <<EOT
73
- <?xml version="1.0"?>
74
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
75
- <soap:Header>
76
- <ResponseHeader xmlns="https://www.google.com/apis/ads/publisher/v201702">
77
- <requestId>abc123</requestId>
78
- <responseTime>658</responseTime>
79
- </ResponseHeader>
80
- </soap:Header>
81
- <soap:Body>
82
- <soap:Fault>
83
- <faultcode>soap:Server</faultcode>
84
- <faultstring>
85
- [PublisherQueryLanguageContextError.UNEXECUTABLE @ Unknown column: 'blah']
86
- </faultstring>
87
- <detail>
88
- <ApiExceptionFault
89
- xmlns="https://www.google.com/apis/ads/publisher/v201502">
90
- <message>
91
- [PublisherQueryLanguageContextError.UNEXECUTABLE
92
- @ Unknown column: 'blah']
93
- </message>
94
- <errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
95
- xsi:type="PublisherQueryLanguageContextError">
96
- <fieldPath>Unknown column: 'blah'</fieldPath>
97
- <trigger></trigger>
98
- <errorString>
99
- PublisherQueryLanguageContextError.UNEXECUTABLE
100
- </errorString>
101
- <reason>UNEXECUTABLE</reason>
102
- </errors>
103
- </ApiExceptionFault>
104
- </detail>
105
- </soap:Fault>
106
- </soap:Body>
107
- </soap:Envelope>
108
- EOT
109
- end
110
- end
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Encoding: utf-8
3
- #
4
- # Copyright:: Copyright 2016, Google Inc. All Rights Reserved.
5
- #
6
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
- # implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
- # Tests dfp credential handler.
20
-
21
- require 'logger'
22
- require 'test/unit'
23
-
24
- require 'ads_common/config'
25
- require 'dfp_api/credential_handler'
26
-
27
- # Overriding default access levels to public for tests.
28
- module DfpApi
29
-
30
- class CredentialHandler
31
- public :validate_headers_for_server
32
- end
33
- end
34
-
35
-
36
- class TestCredentialHandler < Test::Unit::TestCase
37
-
38
- def setup()
39
- @logger = Logger.new(STDERR)
40
- config = AdsCommon::Config.new({:library => {:logger => @logger}})
41
- @handler = DfpApi::CredentialHandler.new(config)
42
- end
43
-
44
- def test_validate_headers_for_bad_application_name()
45
- credentials1 = {:application_name => 'INSERT_APPLICATION_NAME_HERE'}
46
- assert_raise(AdsCommon::Errors::AuthError) do
47
- @handler.validate_headers_for_server(credentials1)
48
- end
49
-
50
- credentials2 = {:application_name => 'dfp_ruby_examplesEXTRATEXT'}
51
- assert_raise(AdsCommon::Errors::AuthError) do
52
- @handler.validate_headers_for_server(credentials2)
53
- end
54
-
55
- credentials3 = {:application_name => 'something awesome '}
56
- assert_nothing_raised do
57
- @handler.validate_headers_for_server(credentials3)
58
- end
59
- assert_equal(credentials3[:application_name], 'something awesome ')
60
- end
61
-
62
- end
@@ -1,118 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # Encoding: utf-8
3
- #
4
- # Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
5
- #
6
- # License:: Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
15
- # implied.
16
- # See the License for the specific language governing permissions and
17
- # limitations under the License.
18
- #
19
- # Tests the general API features.
20
-
21
- require 'test/unit'
22
- require 'tempfile'
23
-
24
- require 'dfp_api'
25
-
26
-
27
- class LoggerStub
28
- attr_reader :last_warning
29
- def warn(message)
30
- @last_warning = message
31
- end
32
- end
33
-
34
- module DfpApi
35
- module ApiConfig
36
- def self.default_config_filename=(value)
37
- @default_config_filename = value
38
- end
39
-
40
- def self.default_config_filename
41
- @default_config_filename
42
- end
43
- end
44
- end
45
-
46
- class TestDfpApi < Test::Unit::TestCase
47
- DEFAULT_CONFIG_HASH = {
48
- :authentication => {
49
- :method => 'OAuth2',
50
- :oauth2_client_id => 'myClientId',
51
- :oauth2_client_secret => 'This is MY secret!',
52
- :oauth2_token => 'my access token',
53
- :application_name => 'ruby_test_suite',
54
- :network_code => 1234567
55
- }
56
- }
57
-
58
- DEFAULT_CONFIG_FILENAME = File.expand_path('../test_config.yml', __FILE__)
59
- DEFAULT_FAILURE_FILENAME = 'test_notexists.yml'
60
-
61
- def setup()
62
- @logger = LoggerStub.new
63
- end
64
-
65
- # Test initializer with no arguments.
66
- def test_initialize_nil()
67
- # Set up a tempfile in ENV['HOME']
68
- temp_file = Tempfile.new(['dfp_api', 'yml'], ENV['HOME'])
69
- real_file = File.open(DEFAULT_CONFIG_FILENAME, 'r')
70
- temp_file.write(real_file.read)
71
- temp_file.flush()
72
- real_file.close()
73
- DfpApi::ApiConfig.default_config_filename = File.basename(temp_file.path)
74
-
75
- assert_nothing_raised do
76
- dfp_api = DfpApi::Api.new
77
- end
78
-
79
- temp_file.unlink()
80
- end
81
-
82
- # Test initializer with hash argument.
83
- def test_initialize_hash()
84
- assert_nothing_raised do
85
- dfp_api = DfpApi::Api.new(DEFAULT_CONFIG_HASH)
86
- check_config_data(dfp_api.config)
87
- end
88
- end
89
-
90
- # Test initializer with filename argument.
91
- def test_initialize_filename()
92
- assert_nothing_raised do
93
- dfp_api = DfpApi::Api.new(DEFAULT_CONFIG_FILENAME)
94
- check_config_data(dfp_api.config)
95
- end
96
- end
97
-
98
- # Test initializer with bad filename argument.
99
- def test_initialize_filename_not_exists()
100
- assert_raises(Errno::ENOENT) do
101
- dfp_api = DfpApi::Api.new(DEFAULT_FAILURE_FILENAME)
102
- end
103
- end
104
-
105
- # Utility method to check the actual data.
106
- def check_config_data(config)
107
- assert_equal(:OAUTH2, config.read('authentication.method'))
108
- assert_equal('ruby_test_suite',
109
- config.read('authentication.application_name'))
110
- assert_equal('myClientId', config.read('authentication.oauth2_client_id'))
111
- assert_equal('This is MY secret!', config.read(
112
- 'authentication.oauth2_client_secret'))
113
- assert_equal('my access token', config.read('authentication.oauth2_token'))
114
- assert_equal(1234567, config.read('authentication.network_code'))
115
- assert_nil(config.read('item.not.exists'))
116
- assert_equal(:default, config.read('item.not.exists', :default))
117
- end
118
- end