yahoo_ads_estimates 0.1.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.
- data/.gitignore +1 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +22 -0
- data/Rakefile +66 -0
- data/VERSION +1 -0
- data/init.rb +0 -0
- data/install.rb +1 -0
- data/lib/yahoo/ads_estimates.rb +45 -0
- data/lib/yahoo_ads_estimates.rb +1 -0
- data/rails/init.rb +3 -0
- data/spec/rcov.opts +1 -0
- data/spec/spec.opts +0 -0
- data/spec/spec_helper.rb +11 -0
- data/spec/yahoo/ads_estimates_spec.rb +3 -0
- data/uninstall.rb +1 -0
- data/yahoo_ads_estimates.gemspec +55 -0
- metadata +71 -0
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
doc
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2008 [name of plugin creator]
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
= Yahoo::AdsEstimates
|
2
|
+
|
3
|
+
Yahoo::AdsEstimates is a rails plugin for querying Yahoo's ads service for estimates of Max CPC, Impressions, and Clicks.
|
4
|
+
|
5
|
+
== Usage
|
6
|
+
|
7
|
+
y = Yahoo::AdsEstimates.new('git')
|
8
|
+
y.max_cpcs
|
9
|
+
=> [1.12, 1.12]
|
10
|
+
y.impressions
|
11
|
+
=> [1.43, 1.43]
|
12
|
+
y.clicks
|
13
|
+
=> [0.09, 0.09]
|
14
|
+
|
15
|
+
y = Yahoo::AdsEstimates.new('git', [10.0])
|
16
|
+
y.max_cpcs
|
17
|
+
=> [1.12]
|
18
|
+
|
19
|
+
== Credits
|
20
|
+
|
21
|
+
Yahoo::AdsEstimates was created, and is maintained by {Joshua Krall}[http://github.com/jkrall]. More info at {Transparent Development}[http://transfs.com/devblog], the {Transparent Financial Services}[http://transfs.com] development blog.
|
22
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/rdoctask'
|
3
|
+
require 'rubygems'
|
4
|
+
require 'spec'
|
5
|
+
require 'spec/rake/spectask'
|
6
|
+
|
7
|
+
desc 'Generate documentation for the yahoo_ads_estimates plugin.'
|
8
|
+
Rake::RDocTask.new(:rdoc) do |rdoc|
|
9
|
+
rdoc.rdoc_dir = 'rdoc'
|
10
|
+
rdoc.title = 'YahooAdsEstimates'
|
11
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
12
|
+
rdoc.rdoc_files.include('README')
|
13
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
14
|
+
end
|
15
|
+
|
16
|
+
desc "Run all specs in spec directory"
|
17
|
+
Spec::Rake::SpecTask.new do |t|
|
18
|
+
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
19
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
20
|
+
end
|
21
|
+
|
22
|
+
desc "Run all specs in spec directory with RCov"
|
23
|
+
Spec::Rake::SpecTask.new(:rcov) do |t|
|
24
|
+
t.spec_opts = ['--options', "\"#{File.dirname(__FILE__)}/spec/spec.opts\""]
|
25
|
+
t.spec_files = FileList['spec/**/*_spec.rb']
|
26
|
+
t.rcov = true
|
27
|
+
t.rcov_opts = lambda do
|
28
|
+
IO.readlines(File.dirname(__FILE__) + "/spec/rcov.opts").map {|l| l.chomp.split " "}.flatten
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
require 'spec/rake/verify_rcov'
|
33
|
+
RCov::VerifyTask.new(:verify_rcov => :rcov) do |t|
|
34
|
+
t.threshold = 96.9 # Make sure you have rcov 0.7 or higher!
|
35
|
+
end
|
36
|
+
|
37
|
+
Rake::TaskManager.class_eval do
|
38
|
+
def remove_task(task_name)
|
39
|
+
@tasks.delete(task_name.to_s)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def remove_task(task_name)
|
44
|
+
Rake.application.remove_task(task_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
remove_task "default"
|
48
|
+
task :default do
|
49
|
+
Rake::Task["verify_rcov"].invoke
|
50
|
+
end
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
begin
|
55
|
+
require 'jeweler'
|
56
|
+
Jeweler::Tasks.new do |gemspec|
|
57
|
+
gemspec.name = "yahoo_ads_estimates"
|
58
|
+
gemspec.summary = "Rails plugin for querying Yahoo Ads for estimated CPC, impressions, and clicks"
|
59
|
+
gemspec.email = "josh@transfs.com"
|
60
|
+
gemspec.homepage = "http://github.com/jkrall/yahoo_ads_estimates"
|
61
|
+
gemspec.authors = ["Joshua Krall"]
|
62
|
+
end
|
63
|
+
Jeweler::GemcutterTasks.new
|
64
|
+
rescue LoadError
|
65
|
+
puts "Jeweler not available. Install it with: sudo gem install jeweler"
|
66
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
data/init.rb
ADDED
File without changes
|
data/install.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Install hook code here
|
@@ -0,0 +1,45 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Yahoo
|
4
|
+
class AdsEstimates
|
5
|
+
|
6
|
+
attr_reader :keyword
|
7
|
+
attr_reader :budgets
|
8
|
+
attr_reader :max_cpcs, :impressions, :clicks
|
9
|
+
|
10
|
+
def initialize(_keyword, _budgets=[1.0, 50.0])
|
11
|
+
@keyword = _keyword
|
12
|
+
@budgets = _budgets
|
13
|
+
|
14
|
+
@max_cpcs = []
|
15
|
+
@impressions = []
|
16
|
+
@clicks = []
|
17
|
+
|
18
|
+
@budgets.each do |budget|
|
19
|
+
begin
|
20
|
+
json = query(budget)
|
21
|
+
result = ActiveSupport::JSON::decode(json)
|
22
|
+
@impressions << result['impressions'].to_f
|
23
|
+
@clicks << result['clicks'].to_f
|
24
|
+
@max_cpcs << result['maxBid'].to_f
|
25
|
+
rescue
|
26
|
+
RAILS_DEFAULT_LOGGER.info "Problem querying and parsing Yahoo, json: #{json}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def request_uri(_budget)
|
34
|
+
# From: http://sem.smallbusiness.yahoo.com/searchenginemarketing/marketingcost.php
|
35
|
+
_keyword_escaped = URI.escape(@keyword)
|
36
|
+
"http://sem.smallbusiness.yahoo.com/inc/getKeywordForecast.php?format=json&budget=#{_budget}&keyword=#{_keyword_escaped}&target=none"
|
37
|
+
end
|
38
|
+
|
39
|
+
def query(_budget)
|
40
|
+
open(request_uri(_budget)) { |f| return f.string }
|
41
|
+
nil
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'yahoo/ads_estimates'
|
data/rails/init.rb
ADDED
data/spec/rcov.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-x gems,spec
|
data/spec/spec.opts
ADDED
File without changes
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
require "spec"
|
3
|
+
# gem install redgreen for colored test output
|
4
|
+
begin require "redgreen" unless ENV['TM_CURRENT_LINE']; rescue LoadError; end
|
5
|
+
|
6
|
+
Spec::Runner.configure do |config|
|
7
|
+
end
|
8
|
+
|
9
|
+
require File.expand_path(File.dirname(__FILE__) + "/../lib/yahoo_ads_estimates")
|
10
|
+
|
11
|
+
RAILS_ROOT = File.expand_path(File.dirname(__FILE__))
|
data/uninstall.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Uninstall hook code here
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{yahoo_ads_estimates}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Joshua Krall"]
|
12
|
+
s.date = %q{2009-12-10}
|
13
|
+
s.email = %q{josh@transfs.com}
|
14
|
+
s.extra_rdoc_files = [
|
15
|
+
"README.rdoc"
|
16
|
+
]
|
17
|
+
s.files = [
|
18
|
+
".gitignore",
|
19
|
+
"MIT-LICENSE",
|
20
|
+
"README.rdoc",
|
21
|
+
"Rakefile",
|
22
|
+
"VERSION",
|
23
|
+
"init.rb",
|
24
|
+
"install.rb",
|
25
|
+
"lib/yahoo/ads_estimates.rb",
|
26
|
+
"lib/yahoo_ads_estimates.rb",
|
27
|
+
"rails/init.rb",
|
28
|
+
"spec/rcov.opts",
|
29
|
+
"spec/spec.opts",
|
30
|
+
"spec/spec_helper.rb",
|
31
|
+
"spec/yahoo/ads_estimates_spec.rb",
|
32
|
+
"uninstall.rb",
|
33
|
+
"yahoo_ads_estimates.gemspec"
|
34
|
+
]
|
35
|
+
s.homepage = %q{http://github.com/jkrall/yahoo_ads_estimates}
|
36
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
37
|
+
s.require_paths = ["lib"]
|
38
|
+
s.rubygems_version = %q{1.3.5}
|
39
|
+
s.summary = %q{Rails plugin for querying Yahoo Ads for estimated CPC, impressions, and clicks}
|
40
|
+
s.test_files = [
|
41
|
+
"spec/spec_helper.rb",
|
42
|
+
"spec/yahoo/ads_estimates_spec.rb"
|
43
|
+
]
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
|
+
else
|
51
|
+
end
|
52
|
+
else
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: yahoo_ads_estimates
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Joshua Krall
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-10 00:00:00 -06:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description:
|
17
|
+
email: josh@transfs.com
|
18
|
+
executables: []
|
19
|
+
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README.rdoc
|
24
|
+
files:
|
25
|
+
- .gitignore
|
26
|
+
- MIT-LICENSE
|
27
|
+
- README.rdoc
|
28
|
+
- Rakefile
|
29
|
+
- VERSION
|
30
|
+
- init.rb
|
31
|
+
- install.rb
|
32
|
+
- lib/yahoo/ads_estimates.rb
|
33
|
+
- lib/yahoo_ads_estimates.rb
|
34
|
+
- rails/init.rb
|
35
|
+
- spec/rcov.opts
|
36
|
+
- spec/spec.opts
|
37
|
+
- spec/spec_helper.rb
|
38
|
+
- spec/yahoo/ads_estimates_spec.rb
|
39
|
+
- uninstall.rb
|
40
|
+
- yahoo_ads_estimates.gemspec
|
41
|
+
has_rdoc: true
|
42
|
+
homepage: http://github.com/jkrall/yahoo_ads_estimates
|
43
|
+
licenses: []
|
44
|
+
|
45
|
+
post_install_message:
|
46
|
+
rdoc_options:
|
47
|
+
- --charset=UTF-8
|
48
|
+
require_paths:
|
49
|
+
- lib
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: "0"
|
55
|
+
version:
|
56
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - ">="
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: "0"
|
61
|
+
version:
|
62
|
+
requirements: []
|
63
|
+
|
64
|
+
rubyforge_project:
|
65
|
+
rubygems_version: 1.3.5
|
66
|
+
signing_key:
|
67
|
+
specification_version: 3
|
68
|
+
summary: Rails plugin for querying Yahoo Ads for estimated CPC, impressions, and clicks
|
69
|
+
test_files:
|
70
|
+
- spec/spec_helper.rb
|
71
|
+
- spec/yahoo/ads_estimates_spec.rb
|