scribe_api 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,7 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  gem "httparty", ">= 0"
4
+ gem "json", ">= 0"
4
5
 
5
6
  group :development do
6
7
  gem "shoulda", ">= 0"
@@ -19,7 +19,7 @@ GEM
19
19
  ruby_core_source (>= 0.1.4)
20
20
  multi_json (1.3.4)
21
21
  multi_xml (0.4.4)
22
- rake (0.9.2.2)
22
+ rake (0.9.2.0)
23
23
  rdoc (3.12)
24
24
  json (~> 1.4)
25
25
  ruby-debug-base19 (0.11.25)
@@ -47,6 +47,7 @@ DEPENDENCIES
47
47
  httparty
48
48
  jeweler (~> 1.8.3)
49
49
  jnunemaker-matchy (= 0.4.0)
50
+ json
50
51
  rdoc (~> 3.12)
51
52
  ruby-debug19
52
53
  shoulda
data/Rakefile CHANGED
@@ -20,7 +20,7 @@ Jeweler::Tasks.new do |gem|
20
20
  gem.summary = %Q{scribe api wrapper}
21
21
  gem.description = %Q{easily access the scribe api.}
22
22
  gem.email = "ianhenrysmith@gmail.com"
23
- gem.authors = ["Ian Smith"]
23
+ gem.authors = ["Ian Henry Smith"]
24
24
  # dependencies defined in Gemfile
25
25
  end
26
26
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.2.0
@@ -1,34 +1,43 @@
1
1
  require 'httparty'
2
+ require 'json'
2
3
 
3
4
  class ScribeAPI
4
5
  include HTTParty
6
+ headers 'Content-Type' => 'application/json'
7
+ default_params :output => 'json'
8
+ format :json
9
+
10
+ # un-comment the next line to enable debug output from httparty
11
+ # debug_output $stdout
12
+
5
13
  base_uri "api.scribeseo.com"
6
14
 
7
15
  def initialize( key )
8
16
  @key = key
9
17
  end
10
18
 
11
- def keyword_suggestions( params )
12
- options = { :body => { :query => params[:keyword] } }
19
+ def keyword_suggestions( params={} )
20
+ options = { :body => { :query => params[:keyword] }.to_json }
13
21
  self.class.post( "/analysis/kw/suggestions?apikey=#{@key}", options )
14
22
  end
15
23
 
16
- def keyword_details( params )
17
- options = { :body => { :query => params[:keyword], :domain => params[:domain] } }
24
+ def keyword_details( params={} )
25
+ options = { :body => { :query => params[:keyword], :domain => params[:domain] }.to_json }
18
26
  self.class.post( "/analysis/kw/detail?apikey=#{@key}", options )
19
27
  end
20
28
 
21
- def content_analysis( params )
22
- options = { :body => { :htmlTitle => params[:title], :htmlDescription => params[:description], :htmlHeadline => params[:headline], :htmlBody => params[:body], :targetedKeyword => params[:keyword] } }
29
+ def content_analysis( params={} )
30
+ options = { :body => { :htmlTitle => params[:title], :htmlDescription => params[:description], :htmlHeadline => params[:headline], :htmlBody => params[:body], :targetedKeyword => params[:keyword], :domain => params[:domain] }.to_json }
23
31
  self.class.post( "/analysis/content?apikey=#{@key}", options )
24
32
  end
25
33
 
26
- def link_building( params )
27
- options = { :body => { :query => params[:keyword], :domain => params[:domain] } }
28
- self.class.post( "/analysis/link?apikey=#{@key}", options )
34
+ def link_building( params={} )
35
+ options = { :body => { :query => params[:keyword], :domain => params[:domain] }.to_json }
36
+ # this is disabled cause scribe is working on this endpt.
37
+ # self.class.post( "/analysis/link?apikey=#{@key}", options )
29
38
  end
30
39
 
31
- def user_information( )
40
+ def user_information( params={} )
32
41
  self.class.get( "/membership/user/detail?apikey=#{@key}" )
33
42
  end
34
43
  end
@@ -0,0 +1,75 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = %q{scribe_api}
8
+ s.version = "0.2.0"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = [%q{Ian Henry Smith}]
12
+ s.date = %q{2012-05-09}
13
+ s.description = %q{easily access the scribe api.}
14
+ s.email = %q{ianhenrysmith@gmail.com}
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.rdoc"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ "Gemfile",
22
+ "Gemfile.lock",
23
+ "LICENSE.txt",
24
+ "README.rdoc",
25
+ "Rakefile",
26
+ "VERSION",
27
+ "lib/scribe_api.rb",
28
+ "scribe_api.gemspec",
29
+ "test/fixtures.json",
30
+ "test/helper.rb",
31
+ "test/test_scribe_api.rb"
32
+ ]
33
+ s.homepage = %q{http://github.com/ianisborn/scribe_api}
34
+ s.licenses = [%q{MIT}]
35
+ s.require_paths = [%q{lib}]
36
+ s.rubygems_version = %q{1.8.6}
37
+ s.summary = %q{scribe api wrapper}
38
+
39
+ if s.respond_to? :specification_version then
40
+ s.specification_version = 3
41
+
42
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
43
+ s.add_runtime_dependency(%q<httparty>, [">= 0"])
44
+ s.add_runtime_dependency(%q<json>, [">= 0"])
45
+ s.add_development_dependency(%q<shoulda>, [">= 0"])
46
+ s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
47
+ s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
+ s.add_development_dependency(%q<ruby-debug19>, [">= 0"])
49
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.3"])
50
+ s.add_development_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
51
+ s.add_development_dependency(%q<fakeweb>, ["= 1.3.0"])
52
+ else
53
+ s.add_dependency(%q<httparty>, [">= 0"])
54
+ s.add_dependency(%q<json>, [">= 0"])
55
+ s.add_dependency(%q<shoulda>, [">= 0"])
56
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
57
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
58
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
59
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
60
+ s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
61
+ s.add_dependency(%q<fakeweb>, ["= 1.3.0"])
62
+ end
63
+ else
64
+ s.add_dependency(%q<httparty>, [">= 0"])
65
+ s.add_dependency(%q<json>, [">= 0"])
66
+ s.add_dependency(%q<shoulda>, [">= 0"])
67
+ s.add_dependency(%q<rdoc>, ["~> 3.12"])
68
+ s.add_dependency(%q<bundler>, ["~> 1.0.0"])
69
+ s.add_dependency(%q<ruby-debug19>, [">= 0"])
70
+ s.add_dependency(%q<jeweler>, ["~> 1.8.3"])
71
+ s.add_dependency(%q<jnunemaker-matchy>, ["= 0.4.0"])
72
+ s.add_dependency(%q<fakeweb>, ["= 1.3.0"])
73
+ end
74
+ end
75
+
@@ -5,7 +5,7 @@ keyword details:
5
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
6
 
7
7
  content analysis:
8
- (need this to work)
8
+ {"docScore":59,"docScoreE":["BodyLen","Hyper"],"fleschScore":"very difficult","keywords":[{"kwc":4.59,"kwd":4.38,"kwe":[],"kwf":7,"kwl":1,"kwlText":"Primary","kwo":"A","kwod":"Congratulations, this term strikes a good balance between search optimization and copywriting best practices.","kwp":"Very High","kwr":1,"kws":13.61,"text":"stocks"},{"kwc":1.22,"kwd":1.88,"kwe":["KwET"],"kwf":3,"kwl":4,"kwlText":"Not Emphasized","kwo":"B","kwod":"To improve the ranking for this term, correct the copywriting and\/or document issues found.","kwp":"Very Low","kwr":2,"kws":10.21,"text":"greece"},{"kwc":1.02,"kwd":1.25,"kwe":["KwET","KwEMP","KwELF"],"kwf":2,"kwl":4,"kwlText":"Not Emphasized","kwo":"B","kwod":"To improve the ranking for this term, correct the copywriting and\/or document issues found.","kwp":"Very Low","kwr":5,"kws":5.21,"text":"sovereign debt"},{"kwc":1.22,"kwd":1.88,"kwe":["KwET"],"kwf":3,"kwl":4,"kwlText":"Not Emphasized","kwo":"B","kwod":"To improve the ranking for this term, correct the copywriting and\/or document issues found.","kwp":"Very Low","kwr":4,"kws":9.69,"text":"france"},{"kwc":1.59,"kwd":1.25,"kwe":["KwELF"],"kwf":2,"kwl":4,"kwlText":"Not Emphasized","kwo":"B","kwod":"To improve the ranking for this term, correct the copywriting and\/or document issues found.","kwp":"Very Low","kwr":3,"kws":9.78,"text":"stock"},{"kwc":3.18,"kwd":1.25,"kwe":["KwEM","KwELF"],"kwf":2,"kwl":2,"kwlText":"Important","kwo":"C","kwod":"While your copywriting is strong, consider writing more about this topic on your site and\/or use this term more frequently in your content.","kwp":"Very High","kwr":6,"kws":3.61,"text":"claw"},{"kwc":1.02,"kwd":1.25,"kwe":["KwET","KwEMP","KwELF"],"kwf":2,"kwl":4,"kwlText":"Not Emphasized","kwo":"D","kwod":"You will need to do some work for this term, including improving your copywriting and writing more about this topic on your site.","kwp":"Very Low","kwr":7,"kws":4.03,"text":"ability"}],"scribeScore":92,"tags":["stocks","greece","sovereign debt","france","stock","claw","ability","economic history of the united kingdom","fuel","economics","reverse","loss","election"]}
9
9
 
10
10
  link building:
11
11
  (need this to work)
@@ -7,42 +7,43 @@ class TestScribeApi < Test::Unit::TestCase
7
7
  @key = "scribe-2c81aaba77ca4fc4bcf0a94812dd5e32"
8
8
  end
9
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
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
34
16
 
35
- should "have link building" do
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
36
25
  @scribe = ScribeAPI.new( @key )
37
- params = { :keyword => "llama", :domain => "simcity.com" }
38
- link_building = @scribe.link_building( params )
39
- puts link_building
26
+ params = { :title => "Stocks Claw Back" }
27
+ params[:description] = "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] = "Stocks Claw Back"
30
+ params[:domain] = "http://online.wsj.com"
31
+ params[:body] = "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."
32
+ analysis = @scribe.content_analysis( params )
33
+ puts analysis
40
34
  end
41
35
 
42
- # should "have user info" do
36
+ # should "have link building" do
43
37
  # @scribe = ScribeAPI.new( @key )
44
- # info = @scribe.user_information
45
- # puts info
38
+ # params = { :keyword => "llama", :domain => "simcity.com" }
39
+ # link_building = @scribe.link_building( params )
40
+ # puts link_building
46
41
  # end
42
+
43
+ should "have user info" do
44
+ @scribe = ScribeAPI.new( @key )
45
+ info = @scribe.user_information
46
+ puts info
47
+ end
47
48
  end
48
49
  end
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scribe_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
- - Ian Smith
8
+ - Ian Henry Smith
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-08 00:00:00.000000000Z
12
+ date: 2012-05-09 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &2156514340 !ruby/object:Gem::Requirement
16
+ requirement: &2152366840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,21 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2156514340
24
+ version_requirements: *2152366840
25
+ - !ruby/object:Gem::Dependency
26
+ name: json
27
+ requirement: &2152362220 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ! '>='
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2152362220
25
36
  - !ruby/object:Gem::Dependency
26
37
  name: shoulda
27
- requirement: &2156513380 !ruby/object:Gem::Requirement
38
+ requirement: &2152361400 !ruby/object:Gem::Requirement
28
39
  none: false
29
40
  requirements:
30
41
  - - ! '>='
@@ -32,10 +43,10 @@ dependencies:
32
43
  version: '0'
33
44
  type: :development
34
45
  prerelease: false
35
- version_requirements: *2156513380
46
+ version_requirements: *2152361400
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: rdoc
38
- requirement: &2156512580 !ruby/object:Gem::Requirement
49
+ requirement: &2152360440 !ruby/object:Gem::Requirement
39
50
  none: false
40
51
  requirements:
41
52
  - - ~>
@@ -43,10 +54,10 @@ dependencies:
43
54
  version: '3.12'
44
55
  type: :development
45
56
  prerelease: false
46
- version_requirements: *2156512580
57
+ version_requirements: *2152360440
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: bundler
49
- requirement: &2156511660 !ruby/object:Gem::Requirement
60
+ requirement: &2152359780 !ruby/object:Gem::Requirement
50
61
  none: false
51
62
  requirements:
52
63
  - - ~>
@@ -54,10 +65,10 @@ dependencies:
54
65
  version: 1.0.0
55
66
  type: :development
56
67
  prerelease: false
57
- version_requirements: *2156511660
68
+ version_requirements: *2152359780
58
69
  - !ruby/object:Gem::Dependency
59
70
  name: ruby-debug19
60
- requirement: &2156510520 !ruby/object:Gem::Requirement
71
+ requirement: &2152359100 !ruby/object:Gem::Requirement
61
72
  none: false
62
73
  requirements:
63
74
  - - ! '>='
@@ -65,10 +76,10 @@ dependencies:
65
76
  version: '0'
66
77
  type: :development
67
78
  prerelease: false
68
- version_requirements: *2156510520
79
+ version_requirements: *2152359100
69
80
  - !ruby/object:Gem::Dependency
70
81
  name: jeweler
71
- requirement: &2156508680 !ruby/object:Gem::Requirement
82
+ requirement: &2152358100 !ruby/object:Gem::Requirement
72
83
  none: false
73
84
  requirements:
74
85
  - - ~>
@@ -76,10 +87,10 @@ dependencies:
76
87
  version: 1.8.3
77
88
  type: :development
78
89
  prerelease: false
79
- version_requirements: *2156508680
90
+ version_requirements: *2152358100
80
91
  - !ruby/object:Gem::Dependency
81
92
  name: jnunemaker-matchy
82
- requirement: &2156505500 !ruby/object:Gem::Requirement
93
+ requirement: &2152356960 !ruby/object:Gem::Requirement
83
94
  none: false
84
95
  requirements:
85
96
  - - =
@@ -87,10 +98,10 @@ dependencies:
87
98
  version: 0.4.0
88
99
  type: :development
89
100
  prerelease: false
90
- version_requirements: *2156505500
101
+ version_requirements: *2152356960
91
102
  - !ruby/object:Gem::Dependency
92
103
  name: fakeweb
93
- requirement: &2156504540 !ruby/object:Gem::Requirement
104
+ requirement: &2152356100 !ruby/object:Gem::Requirement
94
105
  none: false
95
106
  requirements:
96
107
  - - =
@@ -98,7 +109,7 @@ dependencies:
98
109
  version: 1.3.0
99
110
  type: :development
100
111
  prerelease: false
101
- version_requirements: *2156504540
112
+ version_requirements: *2152356100
102
113
  description: easily access the scribe api.
103
114
  email: ianhenrysmith@gmail.com
104
115
  executables: []
@@ -115,6 +126,7 @@ files:
115
126
  - Rakefile
116
127
  - VERSION
117
128
  - lib/scribe_api.rb
129
+ - scribe_api.gemspec
118
130
  - test/fixtures.json
119
131
  - test/helper.rb
120
132
  - test/test_scribe_api.rb
@@ -133,7 +145,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
133
145
  version: '0'
134
146
  segments:
135
147
  - 0
136
- hash: 2392811585307659062
148
+ hash: 1460378721273916177
137
149
  required_rubygems_version: !ruby/object:Gem::Requirement
138
150
  none: false
139
151
  requirements: