copyscape 0.0.5 → 0.0.6

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 9c700898cb6d3da096bcda1d5501d58f1ee30651
4
+ data.tar.gz: f4014a5a2212cac7d6dfe5e007d8ca2aaaa32e01
5
+ SHA512:
6
+ metadata.gz: b0b761a7678a82efe312d02ece946971edb212ba315115c98d434dd609753fad7314d039932d16190fe3d2f8ff0f91eb905c65be997336d0b25740c0e77f7650
7
+ data.tar.gz: 80f3d7b47c50c4db6be4f021affab0cc73d4ddc15b4748e149be4f7605d8678b5edc987e9db98a45e1b01db348dc1e98772650b7626411b8508404ad264641f7
data/.gitignore CHANGED
@@ -1,3 +1,3 @@
1
1
  pkg/
2
2
  .DS_store
3
- .rbenv-version
3
+ .rbenv-version
data/Gemfile CHANGED
@@ -1,2 +1,2 @@
1
- source :rubygems
1
+ source "https://rubygems.org"
2
2
  gemspec
@@ -1,23 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- copyscape (0.0.3)
4
+ copyscape (0.0.6)
5
5
  httparty (>= 0.8.1)
6
- nokogiri (= 1.4.1)
6
+ nokogiri (>= 1.4)
7
7
 
8
8
  GEM
9
- remote: http://rubygems.org/
9
+ remote: https://rubygems.org/
10
10
  specs:
11
- httparty (0.10.0)
12
- multi_json (~> 1.0)
13
- multi_xml
14
- mocha (0.9.8)
15
- rake
16
- multi_json (1.5.0)
17
- multi_xml (0.5.2)
18
- nokogiri (1.4.1)
19
- rake (0.8.7)
20
- shoulda-context (1.0.0.beta1)
11
+ httparty (0.13.5)
12
+ json (~> 1.8)
13
+ multi_xml (>= 0.5.2)
14
+ json (1.8.3)
15
+ metaclass (0.0.4)
16
+ mini_portile (0.6.2)
17
+ minitest (5.7.0)
18
+ mocha (1.1.0)
19
+ metaclass (~> 0.0.1)
20
+ multi_xml (0.5.5)
21
+ nokogiri (1.6.6.2)
22
+ mini_portile (~> 0.6.0)
23
+ rake (10.4.2)
21
24
 
22
25
  PLATFORMS
23
26
  ruby
@@ -25,6 +28,6 @@ PLATFORMS
25
28
  DEPENDENCIES
26
29
  bundler (>= 1.0.0)
27
30
  copyscape!
31
+ minitest
28
32
  mocha
29
- rake (= 0.8.7)
30
- shoulda-context
33
+ rake
data/LICENSE ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2014 Ben VandenBos
2
+
3
+ MIT License
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
+
data/README.md CHANGED
@@ -3,6 +3,8 @@ copyscape
3
3
 
4
4
  Ruby wrapper for the Copyscape API.
5
5
 
6
+ [![Build Status](https://travis-ci.org/bvandenbos/copyscape-rb.svg)](https://travis-ci.org/bvandenbos/copyscape-rb)
7
+
6
8
 
7
9
  Usage
8
10
  -----
@@ -16,32 +18,38 @@ Next, install the gem.
16
18
 
17
19
  And then you can do things like this...
18
20
 
19
- Copyscape.username = 'yourname'
20
- Copyscape.api_key = 'abc123'
21
-
22
- # URL search
23
- search = Copyscape.url_search("http://www.copyscape.com/example.html")
24
- search.duplicate? # => true
25
- search.count # => 81
26
- search.duplicates.each do |duplicate|
27
- puts duplciate['title']
28
- puts duplicate['url']
29
- puts duplicate['textsnippet']
30
- puts duplicate['htmlsnippet']
31
- puts duplicate['minwordsmatched']
32
- end
33
-
34
- # Text search
35
- search = Copyscape.text_search('This is some text I want to check for plagurism')
36
- search.duplicate? # => false
37
-
38
-
21
+ ```ruby
22
+ Copyscape.username = 'yourname'
23
+ Copyscape.api_key = 'abc123'
24
+
25
+ # URL search
26
+ search = Copyscape.url_search("http://www.copyscape.com/example.html")
27
+ search.duplicate? # => true
28
+ search.count # => 81
29
+ search.duplicates.each do |duplicate|
30
+ puts duplciate['title']
31
+ puts duplicate['url']
32
+ puts duplicate['textsnippet']
33
+ puts duplicate['htmlsnippet']
34
+ puts duplicate['minwordsmatched']
35
+ end
36
+
37
+ # Text search
38
+ search = Copyscape.text_search('This is some text I want to check for plagurism')
39
+ search.duplicate? # => false
40
+ ```
41
+
39
42
  Currently, there is no support in the gem for "private index" searching, though
40
43
  it would be pretty easy to add.
41
44
 
42
-
45
+
43
46
  More...
44
47
  -------
45
48
 
46
49
  I'm in no way associated with Copyscape.
47
50
 
51
+
52
+ License
53
+ -------
54
+
55
+ See [LICENSE](LICENSE)
@@ -10,19 +10,19 @@ Gem::Specification.new do |s|
10
10
  s.homepage = "http://github.com/bvandenbos/copyscape-rb"
11
11
  s.summary = "Ruby wrapper for Copyscape API"
12
12
  s.description = "Ruby wrapper for Copyscape API"
13
-
13
+
14
14
  s.required_rubygems_version = ">= 1.3.6"
15
15
  s.add_development_dependency "bundler", ">= 1.0.0"
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
18
18
  s.executables = `git ls-files`.split("\n").map{|f| f =~ /^bin\/(.*)/ ? $1 : nil}.compact
19
19
  s.require_path = 'lib'
20
-
21
- s.add_dependency("nokogiri", "1.4.1")
20
+
21
+ s.add_dependency("nokogiri", ">= 1.4")
22
22
  s.add_dependency("httparty", ">= 0.8.1")
23
- s.add_development_dependency("rake", "0.8.7")
24
- s.add_development_dependency("shoulda-context")
23
+ s.add_development_dependency("rake")
24
+ s.add_development_dependency("minitest")
25
25
  s.add_development_dependency("mocha")
26
-
26
+
27
27
  end
28
28
 
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Copyscape
3
- Version = '0.0.5' unless defined?(Version)
4
- end
3
+ Version = '0.0.6' unless defined?(Version)
4
+ end
@@ -1,25 +1,25 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
- class BalanceTest < Test::Unit::TestCase
3
+ describe Copyscape::Balance do
4
4
 
5
- context "request balance in xml" do
6
- setup do
5
+ describe "request balance in xml" do
6
+ before do
7
7
  Copyscape::Balance.expects(:get).once.returns(balance_response_duplicate(:xml))
8
8
  @balance = Copyscape::Balance.new(:xml)
9
9
  end
10
-
11
- should "have the correct url" do
10
+
11
+ it "has the correct url" do
12
12
  assert_match raw_response_duplicate(:xml), @balance.raw_response
13
13
  end
14
14
  end
15
15
 
16
- context "request balance in html" do
17
- setup do
16
+ describe "request balance in html" do
17
+ before do
18
18
  Copyscape::Balance.expects(:get).once.returns(balance_response_duplicate(:html))
19
19
  @balance = Copyscape::Balance.new(:html)
20
20
  end
21
-
22
- should "have the correct url" do
21
+
22
+ it "has the correct url" do
23
23
  assert_match raw_response_duplicate(:html), @balance.raw_response
24
24
  end
25
25
  end
@@ -35,4 +35,4 @@ class BalanceTest < Test::Unit::TestCase
35
35
  def raw_response_duplicate(format)
36
36
  balance_response_duplicate(format).body
37
37
  end
38
- end
38
+ end
@@ -1,41 +1,40 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
- require 'copyscape/response'
3
2
 
4
- class ResponseTest < Test::Unit::TestCase
5
-
6
- context "response" do
7
- setup do
3
+ describe Copyscape::Response do
4
+
5
+ describe "response" do
6
+ before do
8
7
  @response = Copyscape::Response.new(url_search_response_duplicate)
9
8
  end
10
-
11
- should "include query" do
9
+
10
+ it "includes query" do
12
11
  assert_equal "http://www.copyscape.com/example.html", @response.query
13
12
  end
14
-
15
- should "include query words" do
13
+
14
+ it "includes query words" do
16
15
  assert_equal 1340, @response.query_words
17
16
  end
18
-
19
- should "not be an error" do
17
+
18
+ it "is not an error" do
20
19
  assert !@response.error?
21
20
  end
22
21
  end
23
-
24
- context "duplicate" do
25
-
26
- setup do
22
+
23
+ describe "duplicate" do
24
+
25
+ before do
27
26
  @response = Copyscape::Response.new(url_search_response_duplicate)
28
27
  end
29
-
30
- should "include count" do
28
+
29
+ it "includes count" do
31
30
  assert_equal 81, @response.count
32
31
  end
33
-
34
- should "be a duplicate" do
32
+
33
+ it "is a duplicate" do
35
34
  assert @response.duplicate?
36
35
  end
37
-
38
- should "include duplicates" do
36
+
37
+ it "includes duplicates" do
39
38
  dup = @response.duplicates.first
40
39
  assert_equal 'http://www.archives.gov/exhibits/charters/declaration_transcript.html', dup['url']
41
40
  assert_equal "Declaration of Independence - Transcript", dup['title']
@@ -45,53 +44,53 @@ class ResponseTest < Test::Unit::TestCase
45
44
  dup['htmlsnippet']
46
45
  assert_equal 134, dup['minwordsmatched']
47
46
  end
48
-
49
- should "have the right amount of duplicates" do
47
+
48
+ it "has the right amount of duplicates" do
50
49
  assert_equal @response.count, @response.duplicates.length
51
50
  end
52
-
51
+
53
52
  end
54
-
55
- context "not duplicate" do
56
- setup do
53
+
54
+ describe "not duplicate" do
55
+ before do
57
56
  @response = Copyscape::Response.new(url_search_response_not_duplicate)
58
57
  end
59
-
60
- should "include count" do
58
+
59
+ it "includes count" do
61
60
  assert_equal 0, @response.count
62
61
  end
63
-
64
- should "be a duplicate" do
62
+
63
+ it "is no a duplicate" do
65
64
  assert !@response.duplicate?
66
65
  end
67
-
68
- should "include duplicates" do
66
+
67
+ it "includes duplicates" do
69
68
  assert @response.duplicates.empty?
70
69
  end
71
-
70
+
72
71
  end
73
-
74
- context "error" do
75
- setup do
72
+
73
+ describe "error" do
74
+ before do
76
75
  @response = Copyscape::Response.new(error_response)
77
76
  end
78
-
79
- should "be an error" do
77
+
78
+ it "is an error" do
80
79
  assert @response.error?
81
80
  end
82
-
83
- should "return error message" do
81
+
82
+ it "returns an error message" do
84
83
  assert_equal "connection failed (2) - please ensure you entered the URL correctly", @response.error
85
84
  end
86
-
85
+
87
86
  end
88
-
87
+
89
88
  private
90
-
89
+
91
90
  def url_search_response_duplicate
92
91
  File.read(File.expand_path('../url_search_response_duplicate.xml', __FILE__))
93
92
  end
94
-
93
+
95
94
  def url_search_response_not_duplicate
96
95
  File.read(File.expand_path('../url_search_response_not_duplicate.xml', __FILE__))
97
96
  end
@@ -99,5 +98,5 @@ class ResponseTest < Test::Unit::TestCase
99
98
  def error_response
100
99
  File.read(File.expand_path('../error_response.xml', __FILE__))
101
100
  end
102
-
103
- end
101
+
102
+ end
@@ -1,7 +1,7 @@
1
1
  require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda-context'
4
- require 'mocha'
2
+ require 'minitest/spec'
3
+ require 'minitest/autorun'
4
+ require 'mocha/setup'
5
5
 
6
6
  $LOAD_PATH.unshift File.dirname(File.expand_path(__FILE__)) + '/../lib'
7
7
 
@@ -1,10 +1,10 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
- class TextSearchTest < Test::Unit::TestCase
3
+ describe Copyscape::TextSearch do
4
4
 
5
- context "request_url" do
6
-
7
- should "have the correct url" do
5
+ describe "request_url" do
6
+
7
+ it "has the correct url" do
8
8
  Copyscape::TextSearch.expects(:post).once.returns(url_search_response_duplicate).with do |path, options|
9
9
  params = options[:body]
10
10
  assert_equal '/', path
@@ -17,7 +17,7 @@ class TextSearchTest < Test::Unit::TestCase
17
17
  @search = Copyscape::TextSearch.new('this is some text')
18
18
  end
19
19
  end
20
-
20
+
21
21
  private
22
22
 
23
23
  def url_search_response_duplicate
@@ -26,4 +26,4 @@ class TextSearchTest < Test::Unit::TestCase
26
26
  o
27
27
  end
28
28
 
29
- end
29
+ end
@@ -1,10 +1,10 @@
1
1
  require File.dirname(__FILE__) + '/test_helper'
2
2
 
3
- class UrlSearchTest < Test::Unit::TestCase
3
+ describe Copyscape::UrlSearch do
4
4
 
5
- context "request_url" do
6
-
7
- should "have the correct url" do
5
+ describe "request_url" do
6
+
7
+ it "has the correct url" do
8
8
  Copyscape::UrlSearch.expects(:get).once.returns(url_search_response_duplicate).with do |path, options|
9
9
  params = options[:query]
10
10
  assert_equal '/', path
@@ -16,7 +16,7 @@ class UrlSearchTest < Test::Unit::TestCase
16
16
  @search = Copyscape::UrlSearch.new('http://www.someurl.com/blah.html')
17
17
  end
18
18
  end
19
-
19
+
20
20
  private
21
21
 
22
22
  def url_search_response_duplicate
@@ -25,4 +25,4 @@ class UrlSearchTest < Test::Unit::TestCase
25
25
  o
26
26
  end
27
27
 
28
- end
28
+ end
metadata CHANGED
@@ -1,112 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: copyscape
3
3
  version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.5
4
+ version: 0.0.6
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ben VandenBos
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-01-26 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- version_requirements: !ruby/object:Gem::Requirement
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ! '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 1.0.0
20
- none: false
21
- name: bundler
22
20
  type: :development
23
21
  prerelease: false
24
- requirement: !ruby/object:Gem::Requirement
22
+ version_requirements: !ruby/object:Gem::Requirement
25
23
  requirements:
26
- - - ! '>='
24
+ - - ">="
27
25
  - !ruby/object:Gem::Version
28
26
  version: 1.0.0
29
- none: false
30
27
  - !ruby/object:Gem::Dependency
31
- version_requirements: !ruby/object:Gem::Requirement
28
+ name: nokogiri
29
+ requirement: !ruby/object:Gem::Requirement
32
30
  requirements:
33
- - - '='
31
+ - - ">="
34
32
  - !ruby/object:Gem::Version
35
- version: 1.4.1
36
- none: false
37
- name: nokogiri
33
+ version: '1.4'
38
34
  type: :runtime
39
35
  prerelease: false
40
- requirement: !ruby/object:Gem::Requirement
36
+ version_requirements: !ruby/object:Gem::Requirement
41
37
  requirements:
42
- - - '='
38
+ - - ">="
43
39
  - !ruby/object:Gem::Version
44
- version: 1.4.1
45
- none: false
40
+ version: '1.4'
46
41
  - !ruby/object:Gem::Dependency
47
- version_requirements: !ruby/object:Gem::Requirement
42
+ name: httparty
43
+ requirement: !ruby/object:Gem::Requirement
48
44
  requirements:
49
- - - ! '>='
45
+ - - ">="
50
46
  - !ruby/object:Gem::Version
51
47
  version: 0.8.1
52
- none: false
53
- name: httparty
54
48
  type: :runtime
55
49
  prerelease: false
56
- requirement: !ruby/object:Gem::Requirement
50
+ version_requirements: !ruby/object:Gem::Requirement
57
51
  requirements:
58
- - - ! '>='
52
+ - - ">="
59
53
  - !ruby/object:Gem::Version
60
54
  version: 0.8.1
61
- none: false
62
55
  - !ruby/object:Gem::Dependency
63
- version_requirements: !ruby/object:Gem::Requirement
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
64
58
  requirements:
65
- - - '='
59
+ - - ">="
66
60
  - !ruby/object:Gem::Version
67
- version: 0.8.7
68
- none: false
69
- name: rake
61
+ version: '0'
70
62
  type: :development
71
63
  prerelease: false
72
- requirement: !ruby/object:Gem::Requirement
64
+ version_requirements: !ruby/object:Gem::Requirement
73
65
  requirements:
74
- - - '='
66
+ - - ">="
75
67
  - !ruby/object:Gem::Version
76
- version: 0.8.7
77
- none: false
68
+ version: '0'
78
69
  - !ruby/object:Gem::Dependency
79
- version_requirements: !ruby/object:Gem::Requirement
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
80
72
  requirements:
81
- - - ! '>='
73
+ - - ">="
82
74
  - !ruby/object:Gem::Version
83
75
  version: '0'
84
- none: false
85
- name: shoulda-context
86
76
  type: :development
87
77
  prerelease: false
88
- requirement: !ruby/object:Gem::Requirement
78
+ version_requirements: !ruby/object:Gem::Requirement
89
79
  requirements:
90
- - - ! '>='
80
+ - - ">="
91
81
  - !ruby/object:Gem::Version
92
82
  version: '0'
93
- none: false
94
83
  - !ruby/object:Gem::Dependency
95
- version_requirements: !ruby/object:Gem::Requirement
84
+ name: mocha
85
+ requirement: !ruby/object:Gem::Requirement
96
86
  requirements:
97
- - - ! '>='
87
+ - - ">="
98
88
  - !ruby/object:Gem::Version
99
89
  version: '0'
100
- none: false
101
- name: mocha
102
90
  type: :development
103
91
  prerelease: false
104
- requirement: !ruby/object:Gem::Requirement
92
+ version_requirements: !ruby/object:Gem::Requirement
105
93
  requirements:
106
- - - ! '>='
94
+ - - ">="
107
95
  - !ruby/object:Gem::Version
108
96
  version: '0'
109
- none: false
110
97
  description: Ruby wrapper for Copyscape API
111
98
  email:
112
99
  - bvandenbos@gmail.com
@@ -114,9 +101,10 @@ executables: []
114
101
  extensions: []
115
102
  extra_rdoc_files: []
116
103
  files:
117
- - .gitignore
104
+ - ".gitignore"
118
105
  - Gemfile
119
106
  - Gemfile.lock
107
+ - LICENSE
120
108
  - README.md
121
109
  - Rakefile
122
110
  - copyscape.gemspec
@@ -139,27 +127,25 @@ files:
139
127
  - test/url_search_test.rb
140
128
  homepage: http://github.com/bvandenbos/copyscape-rb
141
129
  licenses: []
130
+ metadata: {}
142
131
  post_install_message:
143
132
  rdoc_options: []
144
133
  require_paths:
145
134
  - lib
146
135
  required_ruby_version: !ruby/object:Gem::Requirement
147
136
  requirements:
148
- - - ! '>='
137
+ - - ">="
149
138
  - !ruby/object:Gem::Version
150
139
  version: '0'
151
- none: false
152
140
  required_rubygems_version: !ruby/object:Gem::Requirement
153
141
  requirements:
154
- - - ! '>='
142
+ - - ">="
155
143
  - !ruby/object:Gem::Version
156
144
  version: 1.3.6
157
- none: false
158
145
  requirements: []
159
146
  rubyforge_project:
160
- rubygems_version: 1.8.23
147
+ rubygems_version: 2.2.2
161
148
  signing_key:
162
- specification_version: 3
149
+ specification_version: 4
163
150
  summary: Ruby wrapper for Copyscape API
164
151
  test_files: []
165
- has_rdoc: