sixarm_ruby_uspto 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Binary file
File without changes
@@ -0,0 +1,88 @@
1
+ # SixArm.com » Ruby » <br> USPTO: United State Patent and Trademark Office
2
+
3
+ * Doc: <http://sixarm.com/sixarm_ruby_uspto/doc>
4
+ * Gem: <http://rubygems.org/gems/sixarm_ruby_uspto>
5
+ * Repo: <http://github.com/sixarm/sixarm_ruby_uspto>
6
+ * Email: Joel Parker Henderson, <joel@sixarm.com>
7
+
8
+ ## Introduction
9
+
10
+ Provides a "Patent" class for working with USPTO Gazette XML.
11
+
12
+ See USPTO Bulk Downloads: Patent Grant Full Text http://www.google.com/googlebooks/uspto-patents-grants-text.html
13
+
14
+
15
+ ## Install quickstart
16
+
17
+ Install:
18
+
19
+ gem install sixarm_ruby_uspto
20
+
21
+ Bundler:
22
+
23
+ gem "sixarm_ruby_uspto", "~> 1.0.0"
24
+
25
+ Require:
26
+
27
+ require "sixarm_ruby_uspto"
28
+
29
+
30
+ ## Install with security (optional)
31
+
32
+ To enable high security for all our gems:
33
+
34
+ wget http://sixarm.com/sixarm.pem
35
+ gem cert --add sixarm.pem
36
+ gem sources --add http://sixarm.com
37
+
38
+ To install with high security:
39
+
40
+ gem install sixarm_ruby_uspto --test --trust-policy HighSecurity
41
+
42
+
43
+ ## Examples
44
+
45
+ require "sixarm_ruby_uspto"
46
+ require "nokogiri"
47
+
48
+ text = File.read("patent.xml")
49
+ doc = Nokogiri.XML(text)
50
+ patent = Patent.new(:doc => doc)
51
+
52
+ patent.id #=> "US1234"
53
+ patent.date #=> "20120101"
54
+ patent.claims #=> XML element of claim items
55
+
56
+
57
+ ## Changes
58
+
59
+ * 2012-05-10 1.0.0 Publish
60
+
61
+
62
+ ## License
63
+
64
+ You may choose any of these open source licenses:
65
+
66
+ * Apache License
67
+ * BSD License
68
+ * CreativeCommons License, Non-commercial Share Alike
69
+ * GNU General Public License Version 2 (GPL 2)
70
+ * GNU Lesser General Public License (LGPL)
71
+ * MIT License
72
+ * Perl Artistic License
73
+ * Ruby License
74
+
75
+ The software is provided "as is", without warranty of any kind,
76
+ express or implied, including but not limited to the warranties of
77
+ merchantability, fitness for a particular purpose and noninfringement.
78
+
79
+ In no event shall the authors or copyright holders be liable for any
80
+ claim, damages or other liability, whether in an action of contract,
81
+ tort or otherwise, arising from, out of or in connection with the
82
+ software or the use or other dealings in the software.
83
+
84
+ This license is for the included software that is created by SixArm;
85
+ some of the included software may have its own licenses, copyrights,
86
+ authors, etc. and these do take precedence over the SixArm license.
87
+
88
+ Copyright (c) 2012 Joel Parker Henderson
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new(:test) do |t|
6
+ t.libs << 'lib' << 'test'
7
+ t.pattern = 'test/*.rb'
8
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ =begin rdoc
3
+ Please see README
4
+ =end
5
+
6
+ ['patent'].map{|x|
7
+ require File.dirname(__FILE__) + "/sixarm_ruby_uspto/#{x}.rb"
8
+ }
@@ -0,0 +1,28 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'nokogiri'
3
+
4
+ class Patent
5
+
6
+ attr_accessor :doc, :xml_file_name, :id, :date, :claims
7
+
8
+ def initialize(ops)
9
+ @doc = ops[:doc]
10
+ end
11
+
12
+ def xml_file_name
13
+ @xml_file_name ||= doc.xpath("//us-patent-grant").first.attribute("file").to_s
14
+ end
15
+
16
+ def id
17
+ @id ||= xml_file_name.split(/\W/)[0]
18
+ end
19
+
20
+ def date
21
+ @date ||= xml_file_name.split(/\W/)[1]
22
+ end
23
+
24
+ def claims
25
+ @claims ||= doc.xpath("//claims").first
26
+ end
27
+
28
+ end
@@ -0,0 +1,9 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+
6
+ ['patent'].map{|x|
7
+ require "sixarm_ruby_uspto_test/#{x}_test.rb"
8
+ }
9
+
@@ -0,0 +1,67 @@
1
+ # -*- coding: utf-8 -*-
2
+ require 'minitest/autorun'
3
+ require 'simplecov'
4
+ SimpleCov.start
5
+ require 'sixarm_ruby_uspto'
6
+ require 'nokogiri'
7
+
8
+ describe Patent do
9
+
10
+ attr_accessor :doc, :xml_file_name, :id, :date, :claims
11
+
12
+ describe "#initialize(ops)" do
13
+
14
+ before do
15
+ @doc = Nokogiri.XML('<a>b</a>')
16
+ end
17
+
18
+ it "sets doc" do
19
+ @patent = Patent.new(:doc => @doc)
20
+ @patent.doc.must_equal @doc
21
+ end
22
+
23
+ end
24
+
25
+ describe "with U.S. patent grant file name attribute" do
26
+
27
+ before do
28
+ @doc = Nokogiri.XML('<us-patent-grant file="123-456.XML">...</us-patent-grant>')
29
+ @patent = Patent.new(:doc => doc)
30
+ end
31
+
32
+ describe "#xml_file_name" do
33
+ it "returns the file name attribute" do
34
+ @patent.xml_file_name.must_equal "123-456.XML"
35
+ end
36
+ end
37
+
38
+ describe "#id" do
39
+ it "returns the first part of the file name attribute" do
40
+ @patent.id.must_equal "123"
41
+ end
42
+ end
43
+
44
+ describe "#date" do
45
+ it "returns the second part of the file name attribute" do
46
+ @patent.date.must_equal "456"
47
+ end
48
+ end
49
+
50
+ end
51
+
52
+ describe "#claims" do
53
+
54
+ before do
55
+ @doc = Nokogiri.XML('<claims>foo</claims>')
56
+ @patent = Patent.new(:doc => doc)
57
+ end
58
+
59
+ it "returns the claims list" do
60
+ @patent.claims.name.must_equal "claims"
61
+ @patent.claims.children.first.text.must_equal "foo"
62
+ end
63
+
64
+ end
65
+
66
+ end
67
+
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sixarm_ruby_uspto
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - SixArm
9
+ aut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N6RFF3cjlUQUxLRmtwR0l3WURFTE1B
29
+ a0dBMVVFQmhNQ1ZWTXhFekFSQmdOVgpCQWdUQ2tOaGJHbG1iM0p1YVdFeEZq
30
+ QVVCZ05WQkFjVERWTmhiaUJHY21GdVkybHpZMjh4RHpBTkJnTlZCQW9UCkJs
31
+ TnBlRUZ5YlRFVE1CRUdBMVVFQXhNS2MybDRZWEp0TG1OdmJZSUpBS1B3RUVU
32
+ VTViSG9NQXdHQTFVZEV3UUYKTUFNQkFmOHdEUVlKS29aSWh2Y05BUUVGQlFB
33
+ RGdZRUFvb0VleFAvb1BhbTFUUDcxU3l1aHhNYit1VHJaYlNRZQpqVkIrRXhS
34
+ d1dhZEd3YU5QVUE1NmQzOXF3YXZ3UCtpdSszSnBlb25OTVZ2YldYRjVuYUNY
35
+ L2RORkllUkVIekVSClpEUlFZTXFydTlURU1uYTZIRDl6cGNzdEY3dndUaEdv
36
+ dmxPUSszWTZwbFE0bk16aXBYY1o5VEhxczY1UElMMHEKZWFid3BDYkFvcG89
37
+ Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K
38
+ date: 2012-05-19 00:00:00.000000000 Z
39
+ dependencies:
40
+ - !ruby/object:Gem::Dependency
41
+ name: nokogiri
42
+ requirement: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ description:
57
+ email: sixarm@sixarm.com
58
+ executables: []
59
+ extensions: []
60
+ extra_rdoc_files: []
61
+ files:
62
+ - .gemtest
63
+ - Rakefile
64
+ - README.md
65
+ - VERSION
66
+ - lib/sixarm_ruby_uspto.rb
67
+ - lib/sixarm_ruby_uspto/patent.rb
68
+ - test/sixarm_ruby_uspto_test.rb
69
+ - test/sixarm_ruby_uspto_test/patent_test.rb
70
+ homepage: http://sixarm.com/
71
+ licenses: []
72
+ post_install_message:
73
+ rdoc_options: []
74
+ require_paths:
75
+ - lib
76
+ required_ruby_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ! '>='
86
+ - !ruby/object:Gem::Version
87
+ version: '0'
88
+ requirements: []
89
+ rubyforge_project:
90
+ rubygems_version: 1.8.23
91
+ signing_key:
92
+ specification_version: 3
93
+ summary: ! 'SixArm.com » Ruby » USPTO: U.S. Patent and Trademark Office'
94
+ test_files:
95
+ - test/sixarm_ruby_uspto_test.rb
96
+ - test/sixarm_ruby_uspto_test/patent_test.rb
@@ -0,0 +1 @@
1
+ E�����|�rĆt �=�KU��2���:��:9�&H�<}2D�cD�l�2h��j�U4 E����ޠ~���