scribe_api 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem "httparty", ">= 0"
4
+
5
+ group :development do
6
+ gem "shoulda", ">= 0"
7
+ gem "rdoc", "~> 3.12"
8
+ gem "bundler", "~> 1.0.0"
9
+ gem 'ruby-debug19', :require => 'ruby-debug'
10
+ gem "jeweler", "~> 1.8.3"
11
+ gem 'jnunemaker-matchy', '0.4.0', :require => 'matchy'
12
+ gem 'fakeweb', '1.3.0'
13
+ end
@@ -0,0 +1,52 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ archive-tar-minitar (0.5.2)
5
+ columnize (0.3.6)
6
+ fakeweb (1.3.0)
7
+ git (1.2.5)
8
+ httparty (0.8.3)
9
+ multi_json (~> 1.0)
10
+ multi_xml
11
+ jeweler (1.8.3)
12
+ bundler (~> 1.0)
13
+ git (>= 1.2.5)
14
+ rake
15
+ rdoc
16
+ jnunemaker-matchy (0.4.0)
17
+ json (1.7.1)
18
+ linecache19 (0.5.12)
19
+ ruby_core_source (>= 0.1.4)
20
+ multi_json (1.3.4)
21
+ multi_xml (0.4.4)
22
+ rake (0.9.2.2)
23
+ rdoc (3.12)
24
+ json (~> 1.4)
25
+ ruby-debug-base19 (0.11.25)
26
+ columnize (>= 0.3.1)
27
+ linecache19 (>= 0.5.11)
28
+ ruby_core_source (>= 0.1.4)
29
+ ruby-debug19 (0.11.6)
30
+ columnize (>= 0.3.1)
31
+ linecache19 (>= 0.5.11)
32
+ ruby-debug-base19 (>= 0.11.19)
33
+ ruby_core_source (0.1.5)
34
+ archive-tar-minitar (>= 0.5.2)
35
+ shoulda (3.0.1)
36
+ shoulda-context (~> 1.0.0)
37
+ shoulda-matchers (~> 1.0.0)
38
+ shoulda-context (1.0.0)
39
+ shoulda-matchers (1.0.0)
40
+
41
+ PLATFORMS
42
+ ruby
43
+
44
+ DEPENDENCIES
45
+ bundler (~> 1.0.0)
46
+ fakeweb (= 1.3.0)
47
+ httparty
48
+ jeweler (~> 1.8.3)
49
+ jnunemaker-matchy (= 0.4.0)
50
+ rdoc (~> 3.12)
51
+ ruby-debug19
52
+ shoulda
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2012 Ian Smith
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.
@@ -0,0 +1,14 @@
1
+ = scribe_api
2
+
3
+ This gem lets you interact with the Scribe SEO v4 API from Copyblogger Media. It uses HTTParty, which is a neato gem.
4
+
5
+ == Contributing to scribe_api
6
+
7
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
+ * Fork the project.
10
+ * Start a feature/bugfix branch.
11
+ * Commit and push until you are happy with your contribution.
12
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
+
@@ -0,0 +1,45 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "scribe_api"
18
+ gem.homepage = "http://github.com/ianisborn/scribe_api"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{scribe api wrapper}
21
+ gem.description = %Q{easily access the scribe api.}
22
+ gem.email = "ianhenrysmith@gmail.com"
23
+ gem.authors = ["Ian Smith"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ task :default => :test
36
+
37
+ require 'rdoc/task'
38
+ Rake::RDocTask.new do |rdoc|
39
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
40
+
41
+ rdoc.rdoc_dir = 'rdoc'
42
+ rdoc.title = "scribe_api #{version}"
43
+ rdoc.rdoc_files.include('README*')
44
+ rdoc.rdoc_files.include('lib/**/*.rb')
45
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.0
@@ -0,0 +1,34 @@
1
+ require 'httparty'
2
+
3
+ class ScribeAPI
4
+ include HTTParty
5
+ base_uri "api.scribeseo.com"
6
+
7
+ def initialize( key )
8
+ @key = key
9
+ end
10
+
11
+ def keyword_suggestions( params )
12
+ options = { :body => { :query => params[:keyword] } }
13
+ self.class.post( "/analysis/kw/suggestions?apikey=#{@key}", options )
14
+ end
15
+
16
+ def keyword_details( params )
17
+ options = { :body => { :query => params[:keyword], :domain => params[:domain] } }
18
+ self.class.post( "/analysis/kw/detail?apikey=#{@key}", options )
19
+ end
20
+
21
+ def content_analysis( params )
22
+ options = { :body => { :htmlTitle => params[:title], :htmlDescription => params[:description], :htmlHeadline => params[:headline], :htmlBody => params[:body], :targetedKeyword => params[:keyword] } }
23
+ self.class.post( "/analysis/content?apikey=#{@key}", options )
24
+ end
25
+
26
+ def link_building( params )
27
+ options = { :body => { :query => params[:keyword], :domain => params[:domain] } }
28
+ self.class.post( "/analysis/link?apikey=#{@key}", options )
29
+ end
30
+
31
+ def user_information( )
32
+ self.class.get( "/membership/user/detail?apikey=#{@key}" )
33
+ end
34
+ end
@@ -0,0 +1,14 @@
1
+ keyword suggestions:
2
+ {"scoreDifficulty":100,"scoreContent":2,"scoreLinks":0,"scoreDomainAuthority":0,"scorePageAuthority":1,"scoreFacebookLikes":0,"scoreGenderMale":50,"scoreGenderFemale":47,"agePrimaryDescription":"Age 35 to 49","agePrimaryValue":37,"ageSecondaryDescription":"Age 25 to 34","ageSecondaryValue":27,"ppc":0,"volumeAnnual":28735836,"volumeMonthly":2394653}
3
+
4
+ keyword details:
5
+ {"suggestions":[{"term":"horse","competition":66,"popularity":19},{"term":"horses","competition":61,"popularity":9},{"term":"equestrian","competition":57,"popularity":5},{"term":"riding","competition":62,"popularity":5},{"term":"horse health","competition":41,"popularity":4},{"term":"horse supplies","competition":46,"popularity":4},{"term":"equine","competition":56,"popularity":4},{"term":"horses for sale","competition":54,"popularity":3},{"term":"care","competition":71,"popularity":3},{"term":"games","competition":73,"popularity":3}]}
6
+
7
+ content analysis:
8
+ (need this to work)
9
+
10
+ link building:
11
+ (need this to work)
12
+
13
+ user info:
14
+ {"accountStatus":1,"accountType":"developer","evaluations":[{"remaining":1993,"term":"monthly","total":2000,"type":"KeywordIdeaResearch"},{"remaining":4999,"term":"monthly","total":5000,"type":"ContentAnalysis"}]}
@@ -0,0 +1,29 @@
1
+ require 'pathname'
2
+ require 'rubygems'
3
+ require 'bundler'
4
+ require 'test/unit'
5
+ require 'shoulda'
6
+ require 'matchy'
7
+ require 'fakeweb'
8
+ require 'ruby-debug'
9
+
10
+ # FakeWeb.allow_net_connect = false
11
+
12
+ begin
13
+ Bundler.setup(:default, :development)
14
+ rescue Bundler::BundlerError => e
15
+ $stderr.puts e.message
16
+ $stderr.puts "Run `bundle install` to install missing gems"
17
+ exit e.status_code
18
+ end
19
+
20
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
21
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
22
+
23
+ require 'scribe_api'
24
+
25
+ class Test::Unit::TestCase
26
+ def fixture_file( path )
27
+ Pathname(__FILE__).dirname.join(*path.split('/')).read
28
+ end
29
+ end
@@ -0,0 +1,48 @@
1
+ require 'helper'
2
+ require 'open-uri'
3
+
4
+ class TestScribeApi < Test::Unit::TestCase
5
+ context "scribe_api" do
6
+ setup do
7
+ @key = "scribe-2c81aaba77ca4fc4bcf0a94812dd5e32"
8
+ end
9
+
10
+ # should "have keyword suggestions" do
11
+ # @scribe = ScribeAPI.new( @key )
12
+ # params = { :keyword => "horse" }
13
+ # suggestions = @scribe.keyword_suggestions( params )
14
+ # puts suggestions
15
+ # end
16
+ #
17
+ # should "have keyword details" do
18
+ # @scribe = ScribeAPI.new( @key )
19
+ # params = { :keyword => "design", :domain => "http://blog.iso50.com" }
20
+ # details = @scribe.keyword_details( params )
21
+ # puts details
22
+ # end
23
+ #
24
+ # should "have content analysis" do
25
+ # @scribe = ScribeAPI.new( @key )
26
+ # params = { :title => URI::encode("<title>Stocks Claw Back</title>") }
27
+ # params[:description] = URI::encode("<meta property='og:description' content='Stocks reversed losses and inched higher, after elections in France and Greece fueled concerns about the region's ability to deal with its sovereign-debt problems.' >")
28
+ # params[:keyword] = "stocks"
29
+ # params[:headline] = URI::encode("<h1>Stocks Claw Back</h1>")
30
+ # params[:body] = URI::encode("<p>Stocks reversed losses and inched higher, after elections in France and Greece fueled concerns about the region's ability to deal with its sovereign-debt problems. Stocks opened lower but recovered most losses by Monday afternoon. The Dow Jones Industrial Average rose 10 points, or 0.1%, to 13048. The Dow industrials fell as much as 68 points early in the session. The Standard & Poor's 500-stock index rose four points, or 0.3%, to 1373, and the Nasdaq Composite rose 13 points, 0.4%, to 2969. Vincent Cignarella and Michael Casey join Markets Hub with the U.S. reaction to weekend elections in France and Greece, and what the new order will mean for the continent's debt struggles. Financial-sector stocks rose the most, with Bank of America CVX -0.31% leading Dow components. Utility stocks trailed behind. Walt Disney DIS +1.93% rose after its latest superhero action film, 'The Avengers,' raked in over $200 million in its weekend box-office debut. Strong ticket sales validated Disney's $4 billion acquisition of Marvel Entertainment and softened the blow of the recently disappointing 'John Carter.' American International Group AIG -3.37% slumped after the U.S. government agreed to sell $5 billion of the insurer's stock at $30.50 a share, representing a 7.1% discount to Friday's closing price. Weekend elections across the Atlantic initially jostled markets.</p>")
31
+ # analysis = @scribe.content_analysis( params )
32
+ # puts analysis
33
+ # end
34
+
35
+ should "have link building" do
36
+ @scribe = ScribeAPI.new( @key )
37
+ params = { :keyword => "llama", :domain => "simcity.com" }
38
+ link_building = @scribe.link_building( params )
39
+ puts link_building
40
+ end
41
+
42
+ # should "have user info" do
43
+ # @scribe = ScribeAPI.new( @key )
44
+ # info = @scribe.user_information
45
+ # puts info
46
+ # end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,149 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: scribe_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ian Smith
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-05-08 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: httparty
16
+ requirement: &2156514340 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2156514340
25
+ - !ruby/object:Gem::Dependency
26
+ name: shoulda
27
+ requirement: &2156513380 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :development
34
+ prerelease: false
35
+ version_requirements: *2156513380
36
+ - !ruby/object:Gem::Dependency
37
+ name: rdoc
38
+ requirement: &2156512580 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ~>
42
+ - !ruby/object:Gem::Version
43
+ version: '3.12'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *2156512580
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &2156511660 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 1.0.0
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *2156511660
58
+ - !ruby/object:Gem::Dependency
59
+ name: ruby-debug19
60
+ requirement: &2156510520 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2156510520
69
+ - !ruby/object:Gem::Dependency
70
+ name: jeweler
71
+ requirement: &2156508680 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: 1.8.3
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2156508680
80
+ - !ruby/object:Gem::Dependency
81
+ name: jnunemaker-matchy
82
+ requirement: &2156505500 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - =
86
+ - !ruby/object:Gem::Version
87
+ version: 0.4.0
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2156505500
91
+ - !ruby/object:Gem::Dependency
92
+ name: fakeweb
93
+ requirement: &2156504540 !ruby/object:Gem::Requirement
94
+ none: false
95
+ requirements:
96
+ - - =
97
+ - !ruby/object:Gem::Version
98
+ version: 1.3.0
99
+ type: :development
100
+ prerelease: false
101
+ version_requirements: *2156504540
102
+ description: easily access the scribe api.
103
+ email: ianhenrysmith@gmail.com
104
+ executables: []
105
+ extensions: []
106
+ extra_rdoc_files:
107
+ - LICENSE.txt
108
+ - README.rdoc
109
+ files:
110
+ - .document
111
+ - Gemfile
112
+ - Gemfile.lock
113
+ - LICENSE.txt
114
+ - README.rdoc
115
+ - Rakefile
116
+ - VERSION
117
+ - lib/scribe_api.rb
118
+ - test/fixtures.json
119
+ - test/helper.rb
120
+ - test/test_scribe_api.rb
121
+ homepage: http://github.com/ianisborn/scribe_api
122
+ licenses:
123
+ - MIT
124
+ post_install_message:
125
+ rdoc_options: []
126
+ require_paths:
127
+ - lib
128
+ required_ruby_version: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ segments:
135
+ - 0
136
+ hash: 2392811585307659062
137
+ required_rubygems_version: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubyforge_project:
145
+ rubygems_version: 1.8.6
146
+ signing_key:
147
+ specification_version: 3
148
+ summary: scribe api wrapper
149
+ test_files: []