google-dfp-api 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. data/COPYING +201 -0
  2. data/ChangeLog +10 -0
  3. data/README +210 -0
  4. data/Rakefile +83 -0
  5. data/examples/v201101/common/error_handling.rb +76 -0
  6. data/examples/v201101/company_service/create_companies.rb +82 -0
  7. data/examples/v201101/company_service/get_all_companies.rb +92 -0
  8. data/examples/v201101/company_service/get_companies_by_statement.rb +88 -0
  9. data/examples/v201101/company_service/get_company.rb +72 -0
  10. data/examples/v201101/company_service/update_companies.rb +95 -0
  11. data/examples/v201101/creative_service/copy_image_creatives.rb +117 -0
  12. data/examples/v201101/creative_service/create_creatives.rb +109 -0
  13. data/examples/v201101/creative_service/get_all_creatives.rb +93 -0
  14. data/examples/v201101/creative_service/get_creative.rb +72 -0
  15. data/examples/v201101/creative_service/get_creatives_by_statement.rb +87 -0
  16. data/examples/v201101/creative_service/update_creatives.rb +98 -0
  17. data/examples/v201101/custom_targeting_service/create_custom_targeting_keys_and_values.rb +118 -0
  18. data/examples/v201101/custom_targeting_service/delete_custom_targeting_keys.rb +121 -0
  19. data/examples/v201101/custom_targeting_service/delete_custom_targeting_values.rb +125 -0
  20. data/examples/v201101/custom_targeting_service/get_all_custom_targeting_keys_and_values.rb +148 -0
  21. data/examples/v201101/custom_targeting_service/get_custom_targeting_keys_by_statement.rb +92 -0
  22. data/examples/v201101/custom_targeting_service/get_custom_targeting_values_by_statement.rb +98 -0
  23. data/examples/v201101/custom_targeting_service/update_custom_targeting_keys.rb +94 -0
  24. data/examples/v201101/custom_targeting_service/update_custom_targeting_values.rb +106 -0
  25. data/examples/v201101/forecast_service/get_forecast.rb +103 -0
  26. data/examples/v201101/forecast_service/get_forecast_by_id.rb +80 -0
  27. data/examples/v201101/inventory_service/create_ad_units.rb +98 -0
  28. data/examples/v201101/inventory_service/deactivate_ad_units.rb +119 -0
  29. data/examples/v201101/inventory_service/get_ad_unit.rb +72 -0
  30. data/examples/v201101/inventory_service/get_ad_units_by_statement.rb +96 -0
  31. data/examples/v201101/inventory_service/get_all_ad_units.rb +93 -0
  32. data/examples/v201101/inventory_service/update_ad_units.rb +94 -0
  33. data/examples/v201101/line_item_creative_association_service/create_licas.rb +94 -0
  34. data/examples/v201101/line_item_creative_association_service/deactivate_licas.rb +127 -0
  35. data/examples/v201101/line_item_creative_association_service/get_all_licas.rb +95 -0
  36. data/examples/v201101/line_item_creative_association_service/get_lica.rb +77 -0
  37. data/examples/v201101/line_item_creative_association_service/get_licas_by_statement.rb +91 -0
  38. data/examples/v201101/line_item_creative_association_service/update_licas.rb +92 -0
  39. data/examples/v201101/line_item_service/activate_line_items.rb +131 -0
  40. data/examples/v201101/line_item_service/create_line_items.rb +141 -0
  41. data/examples/v201101/line_item_service/get_all_line_items.rb +94 -0
  42. data/examples/v201101/line_item_service/get_line_item.rb +74 -0
  43. data/examples/v201101/line_item_service/get_line_items_by_statement.rb +89 -0
  44. data/examples/v201101/line_item_service/target_custom_criteria.rb +135 -0
  45. data/examples/v201101/line_item_service/update_line_items.rb +110 -0
  46. data/examples/v201101/network_service/get_all_networks.rb +74 -0
  47. data/examples/v201101/network_service/get_current_network.rb +66 -0
  48. data/examples/v201101/order_service/approve_orders.rb +116 -0
  49. data/examples/v201101/order_service/create_orders.rb +93 -0
  50. data/examples/v201101/order_service/get_all_orders.rb +93 -0
  51. data/examples/v201101/order_service/get_order.rb +74 -0
  52. data/examples/v201101/order_service/get_orders_by_statement.rb +90 -0
  53. data/examples/v201101/order_service/update_orders.rb +95 -0
  54. data/examples/v201101/placement_service/create_placements.rb +128 -0
  55. data/examples/v201101/placement_service/deactivate_placements.rb +118 -0
  56. data/examples/v201101/placement_service/get_all_placements.rb +93 -0
  57. data/examples/v201101/placement_service/get_placement.rb +74 -0
  58. data/examples/v201101/placement_service/get_placements_by_statement.rb +86 -0
  59. data/examples/v201101/placement_service/update_placements.rb +96 -0
  60. data/examples/v201101/publisher_query_language_service/get_all_cities.rb +85 -0
  61. data/examples/v201101/publisher_query_language_service/get_all_countries.rb +85 -0
  62. data/examples/v201101/publisher_query_language_service/get_all_metros.rb +85 -0
  63. data/examples/v201101/publisher_query_language_service/get_all_regions.rb +85 -0
  64. data/examples/v201101/report_service/download_report.rb +81 -0
  65. data/examples/v201101/report_service/run_delivery_report.rb +89 -0
  66. data/examples/v201101/report_service/run_inventory_report.rb +90 -0
  67. data/examples/v201101/report_service/run_sales_report.rb +89 -0
  68. data/examples/v201101/user_service/create_users.rb +89 -0
  69. data/examples/v201101/user_service/deactivate_users.rb +99 -0
  70. data/examples/v201101/user_service/get_all_roles.rb +73 -0
  71. data/examples/v201101/user_service/get_all_users.rb +92 -0
  72. data/examples/v201101/user_service/get_user.rb +73 -0
  73. data/examples/v201101/user_service/get_users_by_statement.rb +79 -0
  74. data/examples/v201101/user_service/update_users.rb +89 -0
  75. data/lib/dfp_api.rb +142 -0
  76. data/lib/dfp_api/api_config.rb +126 -0
  77. data/lib/dfp_api/credential_handler.rb +60 -0
  78. data/lib/dfp_api/errors.rb +59 -0
  79. data/lib/dfp_api/extensions.rb +54 -0
  80. data/lib/dfp_api/v201101/company_service.rb +52 -0
  81. data/lib/dfp_api/v201101/company_service_registry.rb +37 -0
  82. data/lib/dfp_api/v201101/creative_service.rb +52 -0
  83. data/lib/dfp_api/v201101/creative_service_registry.rb +37 -0
  84. data/lib/dfp_api/v201101/custom_targeting_service.rb +60 -0
  85. data/lib/dfp_api/v201101/custom_targeting_service_registry.rb +37 -0
  86. data/lib/dfp_api/v201101/forecast_service.rb +36 -0
  87. data/lib/dfp_api/v201101/forecast_service_registry.rb +37 -0
  88. data/lib/dfp_api/v201101/inventory_service.rb +56 -0
  89. data/lib/dfp_api/v201101/inventory_service_registry.rb +37 -0
  90. data/lib/dfp_api/v201101/line_item_creative_association_service.rb +56 -0
  91. data/lib/dfp_api/v201101/line_item_creative_association_service_registry.rb +37 -0
  92. data/lib/dfp_api/v201101/line_item_service.rb +56 -0
  93. data/lib/dfp_api/v201101/line_item_service_registry.rb +37 -0
  94. data/lib/dfp_api/v201101/network_service.rb +40 -0
  95. data/lib/dfp_api/v201101/network_service_registry.rb +37 -0
  96. data/lib/dfp_api/v201101/order_service.rb +56 -0
  97. data/lib/dfp_api/v201101/order_service_registry.rb +37 -0
  98. data/lib/dfp_api/v201101/placement_service.rb +56 -0
  99. data/lib/dfp_api/v201101/placement_service_registry.rb +37 -0
  100. data/lib/dfp_api/v201101/publisher_query_language_service.rb +32 -0
  101. data/lib/dfp_api/v201101/publisher_query_language_service_registry.rb +37 -0
  102. data/lib/dfp_api/v201101/report_service.rb +40 -0
  103. data/lib/dfp_api/v201101/report_service_registry.rb +37 -0
  104. data/lib/dfp_api/v201101/user_service.rb +60 -0
  105. data/lib/dfp_api/v201101/user_service_registry.rb +37 -0
  106. metadata +204 -0
data/COPYING ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2008 Google Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/ChangeLog ADDED
@@ -0,0 +1,10 @@
1
+ 0.2.0:
2
+ - Require google-ads-common 0.3.0 or later from now on;
3
+ - Support for Savon backend 0.9.1.
4
+
5
+ 0.1.1:
6
+ - Exception generation and error handling.
7
+ - DFP API v201101 support.
8
+
9
+ 0.1.0:
10
+ - Initial version with minimal functionality.
data/README ADDED
@@ -0,0 +1,210 @@
1
+ = Google's DoubleClick For Publishers API Ruby Client Library
2
+
3
+ Google's DoubleClick For Publishers API service lets developers design computer
4
+ programs that interact directly with the DFP platform. With these applications,
5
+ advertisers and third parties can more efficiently -- and creatively -- manage
6
+ their large or complex Publisher Display Ads accounts.
7
+
8
+ The DFP API Ruby Client Library makes it easy to write Ruby clients to
9
+ programmatically access Publisher Display Ads accounts. The client library is
10
+ available as a Ruby gem or gzipped tarball. It depends on the google-ads-common
11
+ library which is base for all Google Ads APIs for Ruby.
12
+
13
+
14
+ == What's in the client library?
15
+
16
+ The client library provides full access to all the functionality of the
17
+ DoubleClick For Publishers API web services plus more. It includes:
18
+
19
+ - DfpApi::Api class: The Api class provides methods for setting credentials
20
+ for accessing DFP accounts as well as for creating instances of the DFP
21
+ Service classes.
22
+
23
+ - Ruby native objects support: All data is accepted and returned as Ruby
24
+ hashes and arrays. No complex types are required!
25
+
26
+ - Ruby naming conversions: all method and field names are converted to Ruby
27
+ standard snake_case format.
28
+
29
+ - Helpful utilities: The utilities designed as service extensions help you to
30
+ schedule and run reports and import images into the client library.
31
+
32
+ - Logger support: The library provides simple methods for logging the SOAP XML
33
+ messages of all requests and responses as well as HTTP headers.
34
+
35
+ - ApiException class: The Ruby client library converts XML faults into
36
+ ApiExceptions where possible. For an example of how to use ApiException, see
37
+ the error_handling.rb sample code.
38
+
39
+ - Examples: The Ruby client library comes with code samples in the "examples/"
40
+ directory. We encourage you to use code samples to get started writing your
41
+ own application. All the code samples are runnable out of the box, but you
42
+ will have to set your credentials in "~/dfp_api.yml".
43
+
44
+
45
+ = How to get started
46
+
47
+ == Installation
48
+
49
+ google-dfp-api is a Ruby gem. See http://docs.rubygems.org/read/book/1
50
+
51
+ Install it using the gem install command:
52
+ $ gem install google-dfp-api
53
+
54
+ or if you downloaded the gem package manually, use:
55
+ $ gem install --local google-dfp-api-VERSION.gem
56
+
57
+
58
+ == Using the library
59
+
60
+ In order to use the library you need to include its modules:
61
+ require 'google-dfp-api'
62
+
63
+ Depending on your configuration you might also need to explicitely require
64
+ the rubygems library first:
65
+ require 'rubygems'
66
+
67
+ Then, library object could be instantiated:
68
+ dfp = DfpApi::Api.new
69
+
70
+ The default constructor will load library configuration from '~/dfp_api.yml'
71
+ file. Alternatively, you can pass a configuration hash directly to the
72
+ constructor:
73
+ dfp = DfpApi::Api.new({
74
+ :authentication => {
75
+ :method => 'ClientLogin',
76
+ :application_name => 'Ruby DFP Sample',
77
+ :email => 'user@domain.com',
78
+ :password => 'PASSWORD'
79
+ },
80
+ :service => {
81
+ :environment => 'Sandbox'
82
+ }
83
+ })
84
+
85
+ An example of configuration file is available as part of this library.
86
+
87
+
88
+ == Accessing services
89
+
90
+ Once the library object is created you can request services with a 'service'
91
+ method:
92
+ user_service = dfp.service(:UserService, <API_VERSION>)
93
+
94
+ where <API_VERSION> is required version of DFP API, e.g. :v201101.
95
+
96
+ Then you should be able to execute service methods:
97
+
98
+ # Create statement for all users up to 500 max.
99
+ statement = {:query => "LIMIT 500"}
100
+
101
+ # Execute request and get the response.
102
+ page = user_service.get_users_by_statement(statement)
103
+
104
+ In case of paged results, the requested objects are available as ':results' key:
105
+
106
+ # Print details about each user in results page.
107
+ page[:results].each_with_index do |user|
108
+ puts "[%d] name: %s, email: %s" % [user[:id], user[:name], user[:email]]
109
+ end
110
+
111
+ All object fields are automatically parsed by the library to convert types to
112
+ native ones (Integer, Float etc.) where applicable. The field names are also
113
+ converted to symbols in Ruby native snake_case format:
114
+ "displayName" -> :display_name
115
+
116
+
117
+ == Running examples
118
+
119
+ Before running examples, please ensure that your dfp.yml is filled in and
120
+ placed in your home directory.
121
+
122
+ Examples can be run by executing by running:
123
+ $ ruby <example_name>
124
+
125
+ from the "examples/<version>/<service_name>" directory i.e.
126
+
127
+ $ cd examples/v201101/user_service
128
+ $ ruby get_all_users.rb
129
+
130
+ Some examples require modification to be functional, like create_order example
131
+ needs Advertiser, Trafficker and Salesperson ids to be filled in.
132
+
133
+
134
+ == How do I enable logging?
135
+
136
+ It is often useful to see a trace of the raw SOAP XML being sent and received.
137
+ The quickest way of achieving this when debugging your application is by setting
138
+ the library.log_level configuration variable to 'DEBUG':
139
+ config[:library] = {
140
+ :log_level => 'DEBUG'
141
+ }
142
+ or via configuration file (see example).
143
+
144
+ This will output the SOAP XML to STDOUT, which will usually show up in your
145
+ terminal window.
146
+
147
+ There's also an option of logging requests and XML to a file. In order to enable
148
+ this, you should create a standard Logger object and pass it to the library:
149
+ require 'logger'
150
+ logger = Logger.new('path/to/log_filename')
151
+ logger.level = Logger::DEBUG
152
+ adwords = AdwordsApi::Api.new
153
+ adwords.logger = logger
154
+
155
+ Request details are logged at the INFO log level, while raw HTTP headers and XML
156
+ dumps are logged at the DEBUG log level. For more details on using Logger refer
157
+ to the Ruby Logger documentation.
158
+
159
+
160
+ == What if I am behind an HTTP Proxy server?
161
+
162
+ The Ruby Client Libraries does not support proxy servers in this version but it
163
+ is planned for next releases.
164
+
165
+
166
+ = External dependencies:
167
+
168
+ External dependencies should be pulled automatically on gem install. Here is the
169
+ list though:
170
+
171
+ - Google Ads Common library (google-ads-common-0.3.0);
172
+ - Savon 'the heavy metal Ruby SOAP client' (savon-0.9.1).
173
+
174
+
175
+ = Where do I submit bug reports and feature requests?
176
+
177
+ Bug reports and feature requests can be posted on the library page:
178
+
179
+ http://code.google.com/p/google-api-ads-ruby/issues
180
+
181
+ Questions can be asked on forum
182
+
183
+ http://groups.google.com/group/google-doubleclick-for-publishers-api/
184
+
185
+
186
+ = Copyright/License Info
187
+
188
+ == License
189
+
190
+ Copyright 2011, Google Inc. All Rights Reserved.
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License"); you may not use
193
+ this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software distributed
199
+ under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
200
+ CONDITIONS OF ANY KIND, either express or implied. See the License for the
201
+ specific language governing permissions and limitations under the License.
202
+
203
+
204
+ == Authors
205
+
206
+ Author:
207
+ api.dklimkin@gmail.com (Danial Klimkin)
208
+
209
+ Maintainer:
210
+ api.dklimkin@gmail.com (Danial Klimkin)
data/Rakefile ADDED
@@ -0,0 +1,83 @@
1
+ #!/usr/bin/ruby
2
+ #
3
+ # Authors:: api.dklimkin@gmail.com (Danial Klimkin)
4
+ #
5
+ # Copyright:: Copyright 2011, Google Inc. All Rights Reserved.
6
+ #
7
+ # License:: Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
16
+ # implied.
17
+ # See the License for the specific language governing permissions and
18
+ # limitations under the License.
19
+ #
20
+ # DFP API Rakefile
21
+ #
22
+
23
+ require 'rubygems'
24
+ require 'rake/gempackagetask'
25
+ require 'rake/testtask'
26
+ require 'lib/dfp_api/api_config'
27
+
28
+ # Google common ads library used for wrapper code generation
29
+ gem 'google-ads-common'
30
+ require 'ads_common/build/savon_generator'
31
+
32
+ files = FileList["{lib,examples}/**/*", "Rakefile"].to_a
33
+ tests = FileList["{test}/**/Test*.rb"].to_a
34
+ docs = ['README', 'COPYING', 'ChangeLog']
35
+
36
+ spec = Gem::Specification.new do |s|
37
+ s.name = 'google-dfp-api'
38
+ s.version = DfpApi::ApiConfig::CLIENT_LIB_VERSION
39
+ s.author = 'Danial Klimkin'
40
+ s.email = 'api.dklimkin@gmail.com'
41
+ s.homepage = 'http://code.google.com/p/google-api-ads-ruby/'
42
+ s.platform = Gem::Platform::RUBY
43
+ s.summary = 'Ruby Client libraries for DFP API'
44
+ s.description = "%s is a DFP API client library for Ruby" % s.name
45
+ s.files = files
46
+ s.require_path = 'lib'
47
+ s.test_files = tests
48
+ s.has_rdoc = true
49
+ s.extra_rdoc_files = docs
50
+ s.add_dependency('google-ads-common', '~> 0.3.0')
51
+ s.add_dependency('savon', '~> 0.9.1')
52
+ end
53
+
54
+ Rake::GemPackageTask.new(spec) do |pkg|
55
+ pkg.need_tar = true
56
+ end
57
+
58
+ Rake::TestTask.new do |t|
59
+ t.test_files = FileList["test/**/test*.rb"]
60
+ end
61
+
62
+ desc 'Default target - build'
63
+ task :default => [:generate, :package]
64
+
65
+ desc 'Generate API stubs only'
66
+ task :generate do
67
+ logger = Logger.new(STDOUT)
68
+ logger.level = Logger::INFO
69
+ api_config = DfpApi::ApiConfig
70
+ versions = api_config.versions()
71
+ versions.each do |version|
72
+ code_path = "lib/%s/%s" % [api_config.api_path, version]
73
+ wsdls = DfpApi::ApiConfig.get_wsdls( version )
74
+ wsdls.each do |service_name, wsdl_url|
75
+ logger.info("Processing %s at [%s]..." % [service_name, wsdl_url])
76
+ module_name = "%s::%s::%s" % [api_config.api_name, version.to_s.upcase,
77
+ service_name]
78
+ generator = AdsCommon::Build::SavonGenerator.new(wsdl_url, code_path,
79
+ service_name, module_name)
80
+ generator.process_wsdl()
81
+ end
82
+ end
83
+ end