patento 0.2.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.
@@ -0,0 +1,169 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Patent do
4
+
5
+ before { Patento.stub(:download_html).and_return(File.read("#{$LOAD_PATH[0]}/data/US6000000.html"))}
6
+ let(:patent) { Patent.new(6000000) }
7
+ subject { patent }
8
+
9
+ describe "attributes" do
10
+ it { should respond_to(:number) }
11
+ it { should respond_to(:title) }
12
+ it { should respond_to(:abstract) }
13
+ it { should respond_to(:inventors) }
14
+ it { should respond_to(:assignee) }
15
+ it { should respond_to(:us_classifications) }
16
+ it { should respond_to(:intl_classification) }
17
+ it { should respond_to(:filing_date) }
18
+ it { should respond_to(:issue_date) }
19
+ it { should respond_to(:claims) }
20
+ end
21
+
22
+
23
+ describe 'downloading' do
24
+
25
+ context "from Google", :slow => true do
26
+ xit "should download a patent from the Internets" do
27
+ remote_html = Nokogiri::HTML(Downloader.download_html(6000000))
28
+ end
29
+ end
30
+
31
+ context "from local file" do
32
+ let(:patent) { Patent.new(6000000, local_path: "#{$LOAD_PATH[0]}/data/US6000000.html")}
33
+ its(:html) { should be_an_instance_of Nokogiri::HTML::Document}
34
+ end
35
+
36
+ end
37
+
38
+ describe 'parsing U.S. Patent No. 6,000,000' do
39
+
40
+ its(:number) { should == '6000000'}
41
+
42
+ describe "general information" do
43
+ its(:title) { should == 'Extendible method and apparatus for synchronizing multiple files on two different computer systems'}
44
+ its(:abstract) { should == 'Many users of handheld computer systems maintain databases on the handheld computer systems. To share the information, it is desirable to have a simple method of sharing the information with personal computer systems. An easy to use extendible file synchronization system is introduced for sharing information between a handheld computer system and a personal computer system. The synchronization system is activated by a single button press. The synchronization system proceeds to synchronize data for several different applications that run on the handheld computer system and the personal computer system. If the user gets a new application for the handheld computer system and the personal computer system, then a new library of code is added for synchronizing the databases associate with the new application. The synchronization system automatically recognizes the new library of code and uses it during the next synchronization.'}
45
+ its(:inventors) { should include('Jeffrey C. Hawkins', 'Michael Albanese')}
46
+ its(:assignee) { should == '3Com Corporation'}
47
+ its(:us_classifications) { should include('707/610', '707/758', '707/822', '707/922', '707/999.201', '714/E11.128', '714/E11.129')}
48
+ its(:intl_classification) { should == 'G06F 1730' }
49
+ its(:filing_date) { should == Date.parse('May 4, 1998')}
50
+ its(:issue_date) { should == Date.parse('Dec 7, 1999')}
51
+ end
52
+
53
+ describe "claims" do
54
+
55
+ its(:claims) { should have(27).items}
56
+
57
+ describe "claim 1" do
58
+
59
+ it "should have a preamble" do
60
+ patent.claims.first.preamble.should == 'A method of sharing information on a first computer system and a second computer system, said method comprising:'
61
+ end
62
+
63
+ it "should have body elements" do
64
+ patent.claims.first.body.count.should == 5
65
+ end
66
+
67
+ it "should have text for the body elements" do
68
+ patent.claims.first.body[0].should == 'connecting said first computer system to said second computer system with a data communications link;'
69
+ patent.claims.first.body[1].should == 'providing a library of functions in said second computer system for accessing information on said first computer system;'
70
+ patent.claims.first.body[2].should == 'creating a conduit program database, said conduit program database for storing a list of conduit programs that may be executed,'
71
+ patent.claims.first.body[3].should == 'registering a first conduit program by placing an identifier for said first conduit program in said conduit program database, said first conduit program comprising a computer program on said second computer system for performing a specific data transfer task;'
72
+ patent.claims.first.body[4].should == 'successively executing a set of conduit programs identified within said conduit program database from a manager program, each of said conduit programs accessing said library of functions for communicating with said first computer system.'
73
+ end
74
+
75
+ end
76
+
77
+ describe "claim 2" do
78
+ it "should have a preamble" do
79
+ patent.claims[1].preamble.should == 'The method of sharing information as claimed in claim 1 further comprising:'
80
+ end
81
+ it "should have body elements" do
82
+ patent.claims[1].body.count.should == 1
83
+ end
84
+
85
+ it "should have text for the body element" do
86
+ patent.claims[1].body[0].should == 'registering a second conduit program by placing an identifier for said second conduit program in said conduit program database, said second conduit program comprising a computer program on said second computer system for performing a specific data transfer task.'
87
+ end
88
+ end
89
+
90
+ end
91
+
92
+ describe "backward citations" do
93
+
94
+ describe "list" do
95
+ its(:backward_citations) { should be_an_instance_of Array }
96
+ its(:backward_citations) { should have(57).items}
97
+ end
98
+
99
+ describe "individual citation" do
100
+ let(:citation) { patent.backward_citations.first}
101
+ subject { citation }
102
+ it { should be_an_instance_of Hash }
103
+ it "should have a number" do
104
+ citation[:number].should == '4432057'
105
+ end
106
+ it "should have a filing date" do
107
+ citation[:filing].should == Date.parse('Nov 27, 1981')
108
+ end
109
+ it "should have an issue date" do
110
+ citation[:issue].should == Date.parse('Feb 14, 1984')
111
+ end
112
+ it "should have an assignee" do
113
+ citation[:assignee].should == 'International Business Machines Corporation'
114
+ end
115
+ it "should have a title" do
116
+ citation[:title].should == 'Method for the dynamic replication of data under distributed system control to control utilization of resources in a multiprocessing, distributed data base system'
117
+ end
118
+ end
119
+
120
+ end
121
+
122
+
123
+
124
+ describe "forward citations" do
125
+
126
+ describe "list" do
127
+ its(:forward_citations) { should be_an_instance_of Array }
128
+ its(:forward_citations) { should have(252).items}
129
+ end
130
+
131
+ describe "individual citation" do
132
+ let(:citation) { patent.forward_citations.first}
133
+ subject { citation }
134
+ it { should be_an_instance_of Hash }
135
+ it "should have a number" do
136
+ citation[:number].should == '6098100'
137
+ end
138
+ it "should have a filing date" do
139
+ citation[:filing].should == Date.parse('Jun 8, 1998')
140
+ end
141
+ it "should have an issue date" do
142
+ citation[:issue].should == Date.parse('Aug 1, 2000')
143
+ end
144
+ it "should have an assignee" do
145
+ citation[:assignee].should == 'Silicon Integrated Systems Corp.'
146
+ end
147
+ it "should have a title" do
148
+ citation[:title].should == 'Method and apparatus for detecting a wake packet issued by a network device to a sleeping node'
149
+ end
150
+ end
151
+
152
+ end
153
+
154
+ end
155
+
156
+ describe "parsing a patent with multi-level claims" do
157
+ let(:patent) { Patent.new(6000015, local_path: "#{$LOAD_PATH[0]}/data/US6000015.html")}
158
+
159
+ it "should have a preamble for claim 1" do
160
+ patent.claims.first.preamble.should == 'In a digital network connected by a system bus means having a snoop logic module to retrieve addresses being modified, a central processor and processor bus having a multi-level cache system which reduces traffic on the processor bus of a central processor and allows different cache fill algorithms for a first and second level cache memory, said multi-level cache system comprising:'
161
+ end
162
+
163
+ it "should have a nested body" do
164
+ patent.claims.first.body.count.should == 4
165
+ end
166
+
167
+ end
168
+
169
+ end
@@ -0,0 +1,21 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe Publication do
4
+
5
+ before { Patento.stub(:download_html).and_return(File.read("#{$LOAD_PATH[0]}/data/US20100268739.html"))}
6
+
7
+ let(:publication) { Publication.new(20100268739) }
8
+
9
+ subject { publication }
10
+
11
+ it { should respond_to(:number) }
12
+ it { should respond_to(:title) }
13
+ it { should respond_to(:abstract) }
14
+ it { should respond_to(:inventors) }
15
+ it { should respond_to(:assignee) }
16
+ it { should respond_to(:us_classifications) }
17
+ it { should respond_to(:filing_date) }
18
+ it { should respond_to(:claims) }
19
+
20
+
21
+ end
@@ -0,0 +1,13 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'patento'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ include Patento
13
+ end
metadata ADDED
@@ -0,0 +1,143 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: patento
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - George Zalepa
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-07-12 00:00:00.000000000Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: nokogiri
16
+ requirement: &70246569400660 !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: *70246569400660
25
+ - !ruby/object:Gem::Dependency
26
+ name: rspec
27
+ requirement: &70246569399880 !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: *70246569399880
36
+ - !ruby/object:Gem::Dependency
37
+ name: rdoc
38
+ requirement: &70246569398900 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ type: :development
45
+ prerelease: false
46
+ version_requirements: *70246569398900
47
+ - !ruby/object:Gem::Dependency
48
+ name: bundler
49
+ requirement: &70246569398240 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: *70246569398240
58
+ - !ruby/object:Gem::Dependency
59
+ name: jeweler
60
+ requirement: &70246569397280 !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: *70246569397280
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: &70246569396300 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70246569396300
80
+ description: Patento is a simple gem for scraping Google Patents and formatting the
81
+ visible data into objects and hashes. See the README for more details
82
+ email: george.zalepa@gmail.com
83
+ executables: []
84
+ extensions: []
85
+ extra_rdoc_files:
86
+ - LICENSE.txt
87
+ - README.mdown
88
+ files:
89
+ - .document
90
+ - .rspec
91
+ - Gemfile
92
+ - Gemfile.lock
93
+ - Guardfile
94
+ - LICENSE.txt
95
+ - README.mdown
96
+ - Rakefile
97
+ - VERSION
98
+ - lib/patento.rb
99
+ - lib/patento/claim.rb
100
+ - lib/patento/document.rb
101
+ - lib/patento/patent.rb
102
+ - lib/patento/publication.rb
103
+ - patento.gemspec
104
+ - spec/claim_spec.rb
105
+ - spec/data/US20100268739.html
106
+ - spec/data/US6000000.html
107
+ - spec/data/US6000015.html
108
+ - spec/data/US7114060.html
109
+ - spec/data/US7130991.html
110
+ - spec/data/US7143273.html
111
+ - spec/patent_spec.rb
112
+ - spec/publication_spec.rb
113
+ - spec/spec_helper.rb
114
+ homepage: http://github.com/aosik/patento
115
+ licenses:
116
+ - MIT
117
+ post_install_message:
118
+ rdoc_options: []
119
+ require_paths:
120
+ - lib
121
+ required_ruby_version: !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ! '>='
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ segments:
128
+ - 0
129
+ hash: 4561840681773977763
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ none: false
132
+ requirements:
133
+ - - ! '>='
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
136
+ requirements: []
137
+ rubyforge_project:
138
+ rubygems_version: 1.8.10
139
+ signing_key:
140
+ specification_version: 3
141
+ summary: Patento is a simple gem for scraping Google Patents and formatting the visible
142
+ data into objects and hashes.
143
+ test_files: []