sem4r 0.1.3 → 0.1.5
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.
- data/.gemtest +0 -0
- data/Gemfile +2 -22
- data/Gemfile.lock +43 -20
- data/Rakefile +4 -2
- data/bin/sem +2 -6
- data/lib/sem4r/adwords.rb +8 -142
- data/lib/sem4r/campaign/campaign_account_extension.rb +4 -5
- data/lib/sem4r/profile.rb +173 -0
- data/lib/sem4r/sem4r_utilities.rb +113 -0
- data/lib/sem4r/v13_report/report.rb +5 -0
- data/lib/sem4r/version.rb +27 -0
- data/lib/sem4r.rb +5 -26
- data/lib/sem4r_cli/cli_sem.rb +116 -170
- data/lib/sem4r_cli/commands/{cli_ads.rb → cmd_ads.rb} +4 -4
- data/lib/sem4r_cli/commands/{cli_campaign.rb → cmd_campaign.rb} +7 -7
- data/lib/sem4r_cli/commands/{cli_clients.rb → cmd_clients.rb} +4 -5
- data/lib/sem4r_cli/commands/{cli_ideas.rb → cmd_ideas.rb} +7 -5
- data/lib/sem4r_cli/commands/{cli_info.rb → cmd_info.rb} +6 -6
- data/lib/sem4r_cli/commands/{cli_job.rb → cmd_job.rb} +4 -2
- data/lib/sem4r_cli/commands/{cli_keywords.rb → cmd_keywords.rb} +4 -4
- data/lib/sem4r_cli/commands/{cli_profile.rb → cmd_profile.rb} +23 -19
- data/lib/sem4r_cli/commands/{cli_repdef.rb → cmd_repdef.rb} +6 -4
- data/lib/sem4r_cli/commands/{cli_report.rb → cmd_report.rb} +8 -6
- data/lib/sem4r_cli.rb +6 -4
- data/lib/sem4r_debug_client/client.rb +200 -0
- data/lib/sem4r_debug_client.rb +31 -0
- data/lib/sem4r_sinatra/cli_server.rb +45 -0
- data/lib/sem4r_sinatra/helpers.rb +60 -0
- data/lib/sem4r_sinatra/web_server.rb +46 -0
- data/lib/sem4r_sinatra.rb +13 -0
- data/lib/sem4r_soap/http_connector.rb +5 -6
- data/lib/sem4r_soap/soap_dumper.rb +3 -14
- data/lib/sem4r_soap/soap_service.rb +5 -5
- data/lib/sem4r_soap/soap_service_v2010.rb +2 -2
- data/lib/sem4r_soap.rb +24 -0
- data/sem4r.gemspec +75 -313
- data/spec/fixtures/password.example.yml +5 -3
- data/spec/helpers/rspec_matchers.rb +2 -19
- data/spec/helpers/rspec_sem4r_helper.rb +25 -9
- data/spec/rspec_helper.rb +7 -0
- data/spec/sem4r/ad_group/ad_group_spec.rb +2 -3
- data/spec/sem4r/ad_group_ad/fixtures/mutate_add_mobile_ad-req.xml +8 -11
- data/spec/sem4r/ad_group_criterion/fixtures/mutate_add_negative_keyword-req.xml +1 -3
- data/spec/sem4r/adwords_spec.rb +0 -5
- data/spec/sem4r/bulk_mutate_job/fixtures/get-list_job-req.xml +18 -33
- data/spec/sem4r/bulk_mutate_job/fixtures/get-list_job-res.xml +232 -416
- data/spec/sem4r/bulk_mutate_job/fixtures/mutate-add_job-req.xml +55 -104
- data/spec/sem4r/bulk_mutate_job/fixtures/mutate-add_job-res.xml +25 -47
- data/spec/sem4r/geo_location/fixtures/get-req.xml +23 -40
- data/spec/sem4r/geo_location/fixtures/get-res.xml +31 -59
- data/spec/sem4r/info/fixtures/get-req.xml +19 -32
- data/spec/sem4r/info/fixtures/get-res.xml +16 -26
- data/spec/sem4r/profiles_spec.rb +52 -0
- data/spec/sem4r/report_definition/fixtures/get-list-repdef-req.xml +13 -20
- data/spec/sem4r/report_definition/fixtures/get-list-repdef-res.xml +34 -72
- data/spec/sem4r/report_definition/fixtures/getReportFields-req.xml +13 -22
- data/spec/sem4r/report_definition/fixtures/getReportFields-res.xml +476 -1198
- data/spec/sem4r/report_definition/fixtures/mutate-add-report-req.xml +30 -61
- data/spec/sem4r/report_definition/fixtures/mutate-add-report-res.xml +31 -67
- data/spec/sem4r/report_definition/report_definition_spec.rb +1 -1
- data/spec/sem4r/v13_report/fixtures/schedule_report_job-req.xml +11 -33
- data/spec/sem4r_cli/cli_spec.rb +4 -22
- data/tasks/sem4r.rake +0 -3
- data/tasks/yard.rake +2 -2
- metadata +188 -177
- data/VERSION.yml +0 -5
- data/lib/sem4r_cli/cli_helpers.rb +0 -59
- data/lib/sem4r_cli/cli_mini_framework.rb +0 -147
- data/tasks/jeweler.rake +0 -66
@@ -75,6 +75,7 @@ module Sem4r
|
|
75
75
|
g_accessor :type
|
76
76
|
g_accessor :cross_client, {:default => false}
|
77
77
|
g_accessor :zero_impression, {:default => false}
|
78
|
+
g_accessor :client_emails, {:default => []}
|
78
79
|
|
79
80
|
g_reader :status
|
80
81
|
|
@@ -104,6 +105,10 @@ module Sem4r
|
|
104
105
|
t.crossClient cross_client
|
105
106
|
t.includeZeroImpression zero_impression
|
106
107
|
|
108
|
+
client_emails.each do |email|
|
109
|
+
t.clientEmails email
|
110
|
+
end unless client_emails.empty?
|
111
|
+
|
107
112
|
columns.each do |column|
|
108
113
|
t.selectedColumns column
|
109
114
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# -------------------------------------------------------------------------
|
3
|
+
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
4
|
+
#
|
5
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
# a copy of this software and associated documentation files (the
|
7
|
+
# "Software"), to deal in the Software without restriction, including
|
8
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
# the following conditions:
|
12
|
+
#
|
13
|
+
# The above copyright notice and this permission notice shall be
|
14
|
+
# included in all copies or substantial portions of the Software.
|
15
|
+
#
|
16
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
+
# -------------------------------------------------------------------------
|
24
|
+
|
25
|
+
module Sem4r
|
26
|
+
VERSION="0.1.5"
|
27
|
+
end
|
data/lib/sem4r.rb
CHANGED
@@ -23,7 +23,7 @@
|
|
23
23
|
# -------------------------------------------------------------------
|
24
24
|
|
25
25
|
#
|
26
|
-
#
|
26
|
+
# std lib
|
27
27
|
#
|
28
28
|
require 'yaml'
|
29
29
|
require 'pathname'
|
@@ -32,18 +32,8 @@ require 'uri'
|
|
32
32
|
require 'pp'
|
33
33
|
require 'logger'
|
34
34
|
require 'fileutils'
|
35
|
-
# require 'rexml/document'
|
36
|
-
|
37
|
-
#
|
38
|
-
# use bundler
|
39
|
-
#
|
40
|
-
require "rubygems"
|
41
|
-
|
42
|
-
begin
|
43
|
-
require "bundler/setup"
|
44
|
-
rescue LoadError
|
45
|
-
end
|
46
35
|
|
36
|
+
# TODO: use Nokogiri as xml builder?
|
47
37
|
require 'builder'
|
48
38
|
require 'nokogiri'
|
49
39
|
|
@@ -52,22 +42,11 @@ if RUBY_PLATFORM =~ /java/
|
|
52
42
|
require 'openssl'
|
53
43
|
end
|
54
44
|
|
55
|
-
|
56
|
-
|
57
|
-
cwd = Pathname(__FILE__).dirname.expand_path.to_s
|
58
|
-
yaml = YAML.load_file(cwd + '/../VERSION.yml')
|
59
|
-
major = (yaml['major'] || yaml[:major]).to_i
|
60
|
-
minor = (yaml['minor'] || yaml[:minor]).to_i
|
61
|
-
patch = (yaml['patch'] || yaml[:patch]).to_i
|
62
|
-
"#{major}.#{minor}.#{patch}"
|
63
|
-
end
|
64
|
-
end
|
65
|
-
|
66
|
-
cwd = Pathname(__FILE__).dirname
|
67
|
-
$:.unshift(cwd.to_s) unless $:.include?(cwd.to_s) || $:.include?(cwd.expand_path.to_s)
|
68
|
-
|
45
|
+
require 'sem4r/version'
|
46
|
+
require 'sem4r/sem4r_utilities'
|
69
47
|
require 'sem4r/extensions.rb'
|
70
48
|
|
49
|
+
require 'sem4r/profile'
|
71
50
|
require 'sem4r/adwords'
|
72
51
|
require 'sem4r/credentials'
|
73
52
|
require 'sem4r/sem4r_error'
|
data/lib/sem4r_cli/cli_sem.rb
CHANGED
@@ -27,8 +27,8 @@ module Sem4rCli
|
|
27
27
|
#
|
28
28
|
# Macro helper for define new sem4r command
|
29
29
|
#
|
30
|
-
def self.define_command_sem4r(command_name, description, &block)
|
31
|
-
|
30
|
+
def self.define_command_sem4r(klass, command_name, description, &block)
|
31
|
+
OptParseCommand::define_command(klass, command_name, description) do |cli, options, rest|
|
32
32
|
account = cli.account
|
33
33
|
unless account
|
34
34
|
puts "please select a valid account!"
|
@@ -46,52 +46,124 @@ module Sem4rCli
|
|
46
46
|
# passes the unparsed parameter to command
|
47
47
|
# leaves control to command
|
48
48
|
#
|
49
|
-
class CliSem <
|
50
|
-
|
51
|
-
def
|
52
|
-
|
53
|
-
@options = OpenStruct.new({
|
54
|
-
:verbose => true,
|
55
|
-
:force => false,
|
56
|
-
:default_logging => true,
|
57
|
-
# :dump_soap_to_file => true,
|
58
|
-
# :dump_soap_to_directory => true,
|
59
|
-
:profile => 'sandbox',
|
60
|
-
:ask_password => false
|
61
|
-
})
|
49
|
+
class CliSem < OptParseCommand::CliMain
|
50
|
+
|
51
|
+
def self.command
|
52
|
+
"sem4r"
|
62
53
|
end
|
63
54
|
|
64
|
-
def
|
55
|
+
def self.description
|
56
|
+
"Sem is a simple command line interface using the sem4r library.\n" +
|
57
|
+
"It's alpha software, please don't use in production or use it at your risk!\n" +
|
58
|
+
"Code https://github.com/sem4r/sem4r. Feedback to sem4ruby@gmail.com\n" +
|
59
|
+
"Further information: http://www.sem4r.com\n\n"
|
60
|
+
end
|
65
61
|
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
62
|
+
def self.version
|
63
|
+
Sem4r::VERSION
|
64
|
+
end
|
65
|
+
|
66
|
+
def defaults(options)
|
67
|
+
OpenStruct.new({:verbose => true,
|
68
|
+
:force => false,
|
69
|
+
:default_logging => true,
|
70
|
+
# :dump_soap_to_file => true,
|
71
|
+
# :dump_soap_to_directory => true,
|
72
|
+
:profile => 'sandbox',
|
73
|
+
:ask_password => false
|
74
|
+
})
|
75
|
+
end
|
76
|
+
|
77
|
+
def option_parser(options)
|
78
|
+
parser = super(options)
|
79
|
+
|
80
|
+
parser.separator "execute COMMAND to an adwords account using google adwords api"
|
81
|
+
parser.separator "To view help and options for a particular command, use 'sem COMMAND -h'"
|
82
|
+
|
83
|
+
#
|
84
|
+
# common options
|
85
|
+
#
|
86
|
+
parser.on("-v", "--[no-]verbose", "run verbosely") do |v|
|
87
|
+
options.verbose = v
|
71
88
|
end
|
72
|
-
return true if @options.exit
|
73
89
|
|
74
|
-
|
75
|
-
|
76
|
-
return false
|
90
|
+
parser.on("-q", "--quiet", "quiet mode as --no-verbose") do |v|
|
91
|
+
options.verbose = false
|
77
92
|
end
|
78
93
|
|
79
|
-
|
80
|
-
|
94
|
+
#
|
95
|
+
# Logging
|
96
|
+
#
|
97
|
+
parser.separator ""
|
98
|
+
parser.separator "logging options: "
|
99
|
+
parser.separator ""
|
81
100
|
|
82
|
-
|
83
|
-
|
84
|
-
puts "unknow command #{command}"
|
85
|
-
return false
|
101
|
+
parser.on("--log FILE", "log sem4r messages to file") do |v|
|
102
|
+
options.logger = v
|
86
103
|
end
|
87
104
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
105
|
+
parser.on("--dump-file FILE", "dump soap conversation to file") do |v|
|
106
|
+
options.dump_soap_to_file = v
|
107
|
+
end
|
108
|
+
|
109
|
+
str = "dump soap conversation to directory: each \n"
|
110
|
+
str << (" " * 37) + "request/response is in a single file"
|
111
|
+
parser.on("--dump-dir DIRECTORY", str) do |v|
|
112
|
+
options.dump_soap_to_directory = v
|
113
|
+
end
|
114
|
+
|
115
|
+
#
|
116
|
+
# Profile - Configuration
|
117
|
+
#
|
118
|
+
parser.separator ""
|
119
|
+
parser.separator "profile and credentials options: "
|
120
|
+
parser.separator " credentials options overwrite profile attributes"
|
121
|
+
parser.separator ""
|
122
|
+
|
123
|
+
str = "file where profiles are defined\n"
|
124
|
+
str << (" " * 37) + "(default $HOME/.sem4r/sem4r.yaml)"
|
125
|
+
parser.on("--config CONFIG", str) do |config|
|
126
|
+
options.config_name = config
|
94
127
|
end
|
128
|
+
|
129
|
+
parser.on("-p", "--profile PROFILE", "select profile (default is sandbox)") do |profile|
|
130
|
+
options.profile = profile
|
131
|
+
end
|
132
|
+
|
133
|
+
# email
|
134
|
+
parser.on("--email EMAIL",
|
135
|
+
"email of adwords account") do |email|
|
136
|
+
options.email = email
|
137
|
+
end
|
138
|
+
|
139
|
+
# password
|
140
|
+
parser.on("-a", "--ask-password",
|
141
|
+
"ask password on terminal") do
|
142
|
+
options.ask_password = true
|
143
|
+
end
|
144
|
+
|
145
|
+
parser.on("--password PASSWORD",
|
146
|
+
"password of adwords account") do |password|
|
147
|
+
options.password = password if password
|
148
|
+
end
|
149
|
+
|
150
|
+
# developer token
|
151
|
+
parser.on("--token TOKEN",
|
152
|
+
"developer token to access adwords api") do |token|
|
153
|
+
options.developer_token = token
|
154
|
+
end
|
155
|
+
|
156
|
+
# client account
|
157
|
+
parser.on("-c", "--client EMAIL",
|
158
|
+
"email for client account") do |email|
|
159
|
+
options.client_email = email
|
160
|
+
end
|
161
|
+
parser.separator ""
|
162
|
+
parser
|
163
|
+
end
|
164
|
+
|
165
|
+
def read_password_from_terminal
|
166
|
+
ask("Enter your password: ") { |q| q.echo = "x" }
|
95
167
|
end
|
96
168
|
|
97
169
|
#
|
@@ -108,7 +180,7 @@ module Sem4rCli
|
|
108
180
|
if @options.config_name
|
109
181
|
options[:config_file] = @options.config_name
|
110
182
|
end
|
111
|
-
@adwords = Adwords.new(@options.profile, options)
|
183
|
+
@adwords = Sem4r::Adwords.new(@options.profile, options)
|
112
184
|
if @options.verbose
|
113
185
|
puts "using #{@adwords.profile} profile"
|
114
186
|
puts "config file is #{@adwords.config_file}"
|
@@ -117,15 +189,15 @@ module Sem4rCli
|
|
117
189
|
# Extracts dump soap options
|
118
190
|
#
|
119
191
|
if @options.default_logging
|
120
|
-
|
121
|
-
unless File.exists?(
|
122
|
-
puts "Directory #{
|
123
|
-
FileUtils.mkdir(
|
192
|
+
config_dir = File.join(ENV['HOME'], ".sem4r")
|
193
|
+
unless File.exists?(config_dir)
|
194
|
+
puts "Directory #{config_dir} not exists"
|
195
|
+
FileUtils.mkdir(config_dir)
|
124
196
|
end
|
125
|
-
dir = File.join(
|
197
|
+
dir = File.join(config_dir, Time.new.strftime("%Y%m%d-soap-dump"))
|
126
198
|
@options.dump_soap_to_directory = dir
|
127
199
|
|
128
|
-
file = File.join(
|
200
|
+
file = File.join(config_dir, Time.new.strftime("%Y%m%d-sem4r-log"))
|
129
201
|
@options.logger = file
|
130
202
|
end
|
131
203
|
|
@@ -189,132 +261,6 @@ module Sem4rCli
|
|
189
261
|
end
|
190
262
|
@account = account
|
191
263
|
end
|
192
|
-
|
193
|
-
private
|
194
|
-
|
195
|
-
def opt_parser(options)
|
196
|
-
opt_parser = OptionParser.new
|
197
|
-
opt_parser.banner = "Sem is a simple command line interface using the sem4r library."
|
198
|
-
opt_parser.separator "It's alpha software, please don't use in production or use it at your risk!"
|
199
|
-
opt_parser.separator "Further information: http://www.sem4r.com"
|
200
|
-
opt_parser.separator ""
|
201
|
-
opt_parser.separator "Usage: sem [options] [COMMAND [command options]]"
|
202
|
-
|
203
|
-
opt_parser.separator ""
|
204
|
-
opt_parser.separator "execute COMMAND to an adwords account using google adwords api"
|
205
|
-
opt_parser.separator "To view help and options for a particular command, use 'sem COMMAND -h'"
|
206
|
-
|
207
|
-
#
|
208
|
-
# common options
|
209
|
-
#
|
210
|
-
opt_parser.separator ""
|
211
|
-
opt_parser.separator "common options: "
|
212
|
-
opt_parser.separator ""
|
213
|
-
|
214
|
-
opt_parser.on("-h", "--help", "show this message") do
|
215
|
-
puts opt_parser
|
216
|
-
options.exit = true
|
217
|
-
end
|
218
|
-
|
219
|
-
opt_parser.on("--version", "show the sem4r version") do
|
220
|
-
puts "sem4r version #{Sem4r::version}"
|
221
|
-
options.exit = true
|
222
|
-
end
|
223
|
-
|
224
|
-
opt_parser.on("-v", "--[no-]verbose", "run verbosely") do |v|
|
225
|
-
options.verbose = v
|
226
|
-
end
|
227
|
-
|
228
|
-
opt_parser.on("-q", "--quiet", "quiet mode as --no-verbose") do |v|
|
229
|
-
options.verbose = false
|
230
|
-
end
|
231
|
-
|
232
|
-
opt_parser.on("-l", "--list-commands", "list commands") do
|
233
|
-
puts "SEM commands are:"
|
234
|
-
commands = CliCommand.commands.values.sort { |a, b| a.command <=> b.command }
|
235
|
-
commands.each do |cmd|
|
236
|
-
printf " %-20s %s\n", cmd.command, cmd.description
|
237
|
-
end
|
238
|
-
puts
|
239
|
-
puts "For help on a particular command, use 'sem COMMAND -h'"
|
240
|
-
options.exit = true
|
241
|
-
end
|
242
|
-
|
243
|
-
#
|
244
|
-
# Logging
|
245
|
-
#
|
246
|
-
opt_parser.separator ""
|
247
|
-
opt_parser.separator "logging options: "
|
248
|
-
opt_parser.separator ""
|
249
|
-
|
250
|
-
opt_parser.on("--log FILE", "log sem4r messages to file") do |v|
|
251
|
-
options.logger = v
|
252
|
-
end
|
253
|
-
|
254
|
-
opt_parser.on("--dump-file FILE", "dump soap conversation to file") do |v|
|
255
|
-
options.dump_soap_to_file = v
|
256
|
-
end
|
257
|
-
|
258
|
-
str = "dump soap conversation to directory: each \n"
|
259
|
-
str << (" " * 37) + "request/response is in a single file"
|
260
|
-
opt_parser.on("--dump-dir DIRECTORY", str) do |v|
|
261
|
-
options.dump_soap_to_directory = v
|
262
|
-
end
|
263
|
-
|
264
|
-
#
|
265
|
-
# Profile - Configuration
|
266
|
-
#
|
267
|
-
opt_parser.separator ""
|
268
|
-
opt_parser.separator "profile and credentials options: "
|
269
|
-
opt_parser.separator " credentials options overwrite profile attributes"
|
270
|
-
opt_parser.separator ""
|
271
|
-
|
272
|
-
str = "file where profiles are defined\n"
|
273
|
-
str << (" " * 37) + "(default $HOME/.sem4r/sem4r.yaml)"
|
274
|
-
opt_parser.on("--config CONFIG", str) do |config|
|
275
|
-
options.config_name = config
|
276
|
-
end
|
277
|
-
|
278
|
-
opt_parser.on("-p", "--profile PROFILE", "select profile (default is sandbox)") do |profile|
|
279
|
-
options.profile = profile
|
280
|
-
end
|
281
|
-
|
282
|
-
# email
|
283
|
-
opt_parser.on("--email EMAIL",
|
284
|
-
"email of adwords account") do |email|
|
285
|
-
options.email = email
|
286
|
-
end
|
287
|
-
|
288
|
-
# password
|
289
|
-
opt_parser.on("-a", "--ask-password",
|
290
|
-
"ask password on terminal") do
|
291
|
-
options.ask_password = true
|
292
|
-
end
|
293
|
-
|
294
|
-
opt_parser.on("--password PASSWORD",
|
295
|
-
"password of adwords account") do |password|
|
296
|
-
options.password = password if password
|
297
|
-
end
|
298
|
-
|
299
|
-
# developer token
|
300
|
-
opt_parser.on("--token TOKEN",
|
301
|
-
"developer token to access adwords api") do |token|
|
302
|
-
options.developer_token = token
|
303
|
-
end
|
304
|
-
|
305
|
-
# client account
|
306
|
-
opt_parser.on("-c", "--client EMAIL",
|
307
|
-
"email for client account") do |email|
|
308
|
-
options.client_email = email
|
309
|
-
end
|
310
|
-
opt_parser.separator ""
|
311
|
-
opt_parser
|
312
|
-
end
|
313
|
-
|
314
|
-
def read_password_from_terminal
|
315
|
-
ask("Enter your password: ") { |q| q.echo = "x" }
|
316
|
-
end
|
317
|
-
|
318
264
|
end
|
319
265
|
|
320
266
|
end # module Sem4rCli
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# -------------------------------------------------------------------------
|
3
3
|
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
# a copy of this software and associated documentation files (the
|
7
7
|
# "Software"), to deal in the Software without restriction, including
|
@@ -9,10 +9,10 @@
|
|
9
9
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
10
|
# permit persons to whom the Software is furnished to do so, subject to
|
11
11
|
# the following conditions:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# The above copyright notice and this permission notice shall be
|
14
14
|
# included in all copies or substantial portions of the Software.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
17
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
18
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
module Sem4rCli
|
26
26
|
|
27
|
-
|
27
|
+
define_command_sem4r(CliSem, "ads", "list ads") do |account|
|
28
28
|
puts "Collecting ads from account(s) - please wait"
|
29
29
|
|
30
30
|
# if the accounts have client_accounts it is a master
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# -------------------------------------------------------------------------
|
3
3
|
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
# a copy of this software and associated documentation files (the
|
7
7
|
# "Software"), to deal in the Software without restriction, including
|
@@ -9,10 +9,10 @@
|
|
9
9
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
10
|
# permit persons to whom the Software is furnished to do so, subject to
|
11
11
|
# the following conditions:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# The above copyright notice and this permission notice shall be
|
14
14
|
# included in all copies or substantial portions of the Software.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
17
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
18
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
module Sem4rCli
|
26
26
|
|
27
|
-
|
27
|
+
define_command_sem4r(CliSem, "campaigns", "list campaigns") do |account|
|
28
28
|
puts "Collecting campaign from account(s) - please wait"
|
29
29
|
|
30
30
|
# if the accounts have client_accounts it is a master
|
@@ -38,7 +38,7 @@ module Sem4rCli
|
|
38
38
|
|
39
39
|
client_accounts.each do |client_account|
|
40
40
|
if need_newline
|
41
|
-
puts
|
41
|
+
puts ""
|
42
42
|
need_newline = false
|
43
43
|
end
|
44
44
|
|
@@ -58,10 +58,10 @@ module Sem4rCli
|
|
58
58
|
end
|
59
59
|
|
60
60
|
if need_newline
|
61
|
-
puts
|
61
|
+
puts ""
|
62
62
|
need_newline = false
|
63
63
|
end
|
64
|
-
report(items, :client, :id, :name, :status)
|
64
|
+
OptParseCommand::report(items, :client, :id, :name, :status)
|
65
65
|
account.adwords.p_counters
|
66
66
|
true
|
67
67
|
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# -------------------------------------------------------------------------
|
3
3
|
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
# a copy of this software and associated documentation files (the
|
7
7
|
# "Software"), to deal in the Software without restriction, including
|
@@ -9,10 +9,10 @@
|
|
9
9
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
10
|
# permit persons to whom the Software is furnished to do so, subject to
|
11
11
|
# the following conditions:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# The above copyright notice and this permission notice shall be
|
14
14
|
# included in all copies or substantial portions of the Software.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
17
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
18
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -20,12 +20,11 @@
|
|
20
20
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
#
|
24
23
|
# -------------------------------------------------------------------------
|
25
24
|
|
26
25
|
module Sem4rCli
|
27
26
|
|
28
|
-
|
27
|
+
define_command_sem4r(CliSem, "clients", "list clients account") do |account|
|
29
28
|
puts account.adwords.to_s
|
30
29
|
puts account.to_s
|
31
30
|
account.p_client_accounts
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# -------------------------------------------------------------------------
|
3
3
|
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
# a copy of this software and associated documentation files (the
|
7
7
|
# "Software"), to deal in the Software without restriction, including
|
@@ -9,10 +9,10 @@
|
|
9
9
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
10
|
# permit persons to whom the Software is furnished to do so, subject to
|
11
11
|
# the following conditions:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# The above copyright notice and this permission notice shall be
|
14
14
|
# included in all copies or substantial portions of the Software.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
17
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
18
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -20,7 +20,7 @@
|
|
20
20
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# -------------------------------------------------------------------------
|
25
25
|
|
26
26
|
module Sem4rCli
|
@@ -28,7 +28,9 @@ module Sem4rCli
|
|
28
28
|
#
|
29
29
|
# idea
|
30
30
|
#
|
31
|
-
class
|
31
|
+
class CommandIdeas < OptParseCommand::Command
|
32
|
+
|
33
|
+
CliSem.register_command(self)
|
32
34
|
|
33
35
|
def self.command
|
34
36
|
"ideas"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# -------------------------------------------------------------------------
|
3
3
|
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
# a copy of this software and associated documentation files (the
|
7
7
|
# "Software"), to deal in the Software without restriction, including
|
@@ -9,10 +9,10 @@
|
|
9
9
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
10
|
# permit persons to whom the Software is furnished to do so, subject to
|
11
11
|
# the following conditions:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# The above copyright notice and this permission notice shall be
|
14
14
|
# included in all copies or substantial portions of the Software.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
17
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
18
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -20,12 +20,12 @@
|
|
20
20
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
21
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
22
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
23
|
-
#
|
23
|
+
#
|
24
24
|
# -------------------------------------------------------------------------
|
25
25
|
|
26
26
|
module Sem4rCli
|
27
27
|
|
28
|
-
|
28
|
+
define_command_sem4r(CliSem, "info", "show account info") do |account|
|
29
29
|
account.p_info
|
30
30
|
items = (InfoSelector::UsageTypes - [InfoSelector::METHOD_COST]).map do |usage_type|
|
31
31
|
n = account.year_unit_cost(usage_type)
|
@@ -36,4 +36,4 @@ module Sem4rCli
|
|
36
36
|
true
|
37
37
|
end
|
38
38
|
|
39
|
-
end
|
39
|
+
end
|
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
# -------------------------------------------------------------------------
|
3
3
|
# Copyright (c) 2009-2010 Sem4r sem4ruby@gmail.com
|
4
|
-
#
|
4
|
+
#
|
5
5
|
# Permission is hereby granted, free of charge, to any person obtaining
|
6
6
|
# a copy of this software and associated documentation files (the
|
7
7
|
# "Software"), to deal in the Software without restriction, including
|
@@ -9,10 +9,10 @@
|
|
9
9
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
10
10
|
# permit persons to whom the Software is furnished to do so, subject to
|
11
11
|
# the following conditions:
|
12
|
-
#
|
12
|
+
#
|
13
13
|
# The above copyright notice and this permission notice shall be
|
14
14
|
# included in all copies or substantial portions of the Software.
|
15
|
-
#
|
15
|
+
#
|
16
16
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
17
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
18
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -24,7 +24,7 @@
|
|
24
24
|
|
25
25
|
module Sem4rCli
|
26
26
|
|
27
|
-
|
27
|
+
define_command_sem4r(CliSem, "keywords", "list keywords") do |account|
|
28
28
|
puts "Collecting keywords from account(s) - please wait"
|
29
29
|
|
30
30
|
# if the account have client_accounts it is a master
|