usps_intelligent_barcode 0.3.1 → 1.1.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.
- checksums.yaml +5 -13
- data/.gitignore +6 -0
- data/.ruby-version +1 -0
- data/.travis.yml +2 -1
- data/{CHANGELOG.markdown → CHANGELOG.md} +27 -12
- data/Gemfile +2 -12
- data/Gemfile.lock +74 -81
- data/LICENSE.md +7 -0
- data/README.md +92 -0
- data/Rakefile +4 -28
- data/VERSION +1 -1
- data/doc/font_installation.md +55 -0
- data/doc/migration.md +47 -0
- data/doc/publishing.md +75 -0
- data/examples/example.rb +4 -4
- data/examples/generate_pdf.rb +70 -0
- data/fonts/LICENSE +47 -0
- data/fonts/USPSIMBCompact.ttf +0 -0
- data/fonts/USPSIMBStandard.ttf +0 -0
- data/lib/usps_intelligent_barcode/bar_map.rb +10 -8
- data/lib/usps_intelligent_barcode/bar_position.rb +14 -10
- data/lib/usps_intelligent_barcode/bar_symbol.rb +42 -12
- data/lib/usps_intelligent_barcode/bar_to_character_mapping.yml +24 -0
- data/lib/usps_intelligent_barcode/barcode.rb +83 -39
- data/lib/usps_intelligent_barcode/barcode_id.rb +19 -12
- data/lib/usps_intelligent_barcode/character_position.rb +10 -8
- data/lib/usps_intelligent_barcode/codeword_map.rb +0 -1
- data/lib/usps_intelligent_barcode/codeword_to_character_mapping.yml +7 -0
- data/lib/usps_intelligent_barcode/crc.rb +3 -3
- data/lib/usps_intelligent_barcode/mailer_id.rb +18 -14
- data/lib/usps_intelligent_barcode/numeric_conversions.rb +7 -6
- data/lib/usps_intelligent_barcode/project_dirs.rb +19 -0
- data/lib/usps_intelligent_barcode/routing_code.rb +38 -27
- data/lib/usps_intelligent_barcode/serial_number.rb +16 -11
- data/lib/usps_intelligent_barcode/service_type.rb +14 -12
- data/lib/usps_intelligent_barcode/usps_fonts.rb +48 -0
- data/lib/usps_intelligent_barcode.rb +2 -0
- data/rake/bundler.rb +1 -0
- data/rake/default.rb +1 -0
- data/rake/rspec.rb +2 -0
- data/rake/version.rb +33 -0
- data/rake/yard.rb +9 -0
- data/usps_intelligent_barcode.gemspec +24 -99
- metadata +68 -71
- data/README.markdown +0 -69
- data/USPS-intelligent-barcode.gemspec +0 -95
- data/spec/bar_map_spec.rb +0 -30
- data/spec/bar_position_spec.rb +0 -40
- data/spec/bar_symbol_spec.rb +0 -39
- data/spec/barcode_id_spec.rb +0 -106
- data/spec/barcode_spec.rb +0 -213
- data/spec/character_position_spec.rb +0 -25
- data/spec/codeword_map_spec.rb +0 -22
- data/spec/crc_spec.rb +0 -21
- data/spec/mailer_id_spec.rb +0 -124
- data/spec/numeric_conversions_spec.rb +0 -23
- data/spec/routing_code_spec.rb +0 -180
- data/spec/serial_number_spec.rb +0 -117
- data/spec/service_type_spec.rb +0 -93
- data/spec/spec_helper.rb +0 -8
metadata
CHANGED
|
@@ -1,147 +1,152 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: usps_intelligent_barcode
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 1.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Wayne Conrad
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: andand
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - ~>
|
|
16
|
+
- - "~>"
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
18
|
version: '1.3'
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
|
-
- - ~>
|
|
23
|
+
- - "~>"
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
25
|
version: '1.3'
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: memoizer
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
30
29
|
requirements:
|
|
31
|
-
- - ~>
|
|
30
|
+
- - "~>"
|
|
32
31
|
- !ruby/object:Gem::Version
|
|
33
32
|
version: '1.0'
|
|
34
33
|
type: :runtime
|
|
35
34
|
prerelease: false
|
|
36
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
36
|
requirements:
|
|
38
|
-
- - ~>
|
|
37
|
+
- - "~>"
|
|
39
38
|
- !ruby/object:Gem::Version
|
|
40
39
|
version: '1.0'
|
|
41
40
|
- !ruby/object:Gem::Dependency
|
|
42
|
-
name:
|
|
41
|
+
name: prawn
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
|
-
- - ~>
|
|
44
|
+
- - "~>"
|
|
46
45
|
- !ruby/object:Gem::Version
|
|
47
|
-
version: '2.
|
|
46
|
+
version: '2.5'
|
|
48
47
|
type: :development
|
|
49
48
|
prerelease: false
|
|
50
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
51
50
|
requirements:
|
|
52
|
-
- - ~>
|
|
51
|
+
- - "~>"
|
|
53
52
|
- !ruby/object:Gem::Version
|
|
54
|
-
version: '2.
|
|
53
|
+
version: '2.5'
|
|
55
54
|
- !ruby/object:Gem::Dependency
|
|
56
|
-
name:
|
|
55
|
+
name: rake
|
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
|
58
57
|
requirements:
|
|
59
|
-
- - ~>
|
|
58
|
+
- - "~>"
|
|
60
59
|
- !ruby/object:Gem::Version
|
|
61
|
-
version: '
|
|
60
|
+
version: '13.0'
|
|
62
61
|
type: :development
|
|
63
62
|
prerelease: false
|
|
64
63
|
version_requirements: !ruby/object:Gem::Requirement
|
|
65
64
|
requirements:
|
|
66
|
-
- - ~>
|
|
65
|
+
- - "~>"
|
|
67
66
|
- !ruby/object:Gem::Version
|
|
68
|
-
version: '
|
|
67
|
+
version: '13.0'
|
|
69
68
|
- !ruby/object:Gem::Dependency
|
|
70
|
-
name: rspec
|
|
69
|
+
name: rspec
|
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
|
72
71
|
requirements:
|
|
73
|
-
- - ~>
|
|
72
|
+
- - "~>"
|
|
74
73
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
74
|
+
version: '3.12'
|
|
76
75
|
type: :development
|
|
77
76
|
prerelease: false
|
|
78
77
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
78
|
requirements:
|
|
80
|
-
- - ~>
|
|
79
|
+
- - "~>"
|
|
81
80
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
81
|
+
version: '3.12'
|
|
83
82
|
- !ruby/object:Gem::Dependency
|
|
84
|
-
name:
|
|
83
|
+
name: rspec-its
|
|
85
84
|
requirement: !ruby/object:Gem::Requirement
|
|
86
85
|
requirements:
|
|
87
|
-
- - ~>
|
|
86
|
+
- - "~>"
|
|
88
87
|
- !ruby/object:Gem::Version
|
|
89
|
-
version:
|
|
88
|
+
version: '2.0'
|
|
90
89
|
type: :development
|
|
91
90
|
prerelease: false
|
|
92
91
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
92
|
requirements:
|
|
94
|
-
- - ~>
|
|
93
|
+
- - "~>"
|
|
95
94
|
- !ruby/object:Gem::Version
|
|
96
|
-
version:
|
|
95
|
+
version: '2.0'
|
|
97
96
|
- !ruby/object:Gem::Dependency
|
|
98
|
-
name:
|
|
97
|
+
name: simplecov
|
|
99
98
|
requirement: !ruby/object:Gem::Requirement
|
|
100
99
|
requirements:
|
|
101
|
-
- - ~>
|
|
100
|
+
- - "~>"
|
|
102
101
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: 0.
|
|
102
|
+
version: '0.22'
|
|
104
103
|
type: :development
|
|
105
104
|
prerelease: false
|
|
106
105
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
106
|
requirements:
|
|
108
|
-
- - ~>
|
|
107
|
+
- - "~>"
|
|
109
108
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: 0.
|
|
109
|
+
version: '0.22'
|
|
111
110
|
- !ruby/object:Gem::Dependency
|
|
112
|
-
name:
|
|
111
|
+
name: yard
|
|
113
112
|
requirement: !ruby/object:Gem::Requirement
|
|
114
113
|
requirements:
|
|
115
|
-
- - ~>
|
|
114
|
+
- - "~>"
|
|
116
115
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
116
|
+
version: '0.9'
|
|
118
117
|
type: :development
|
|
119
118
|
prerelease: false
|
|
120
119
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
120
|
requirements:
|
|
122
|
-
- - ~>
|
|
121
|
+
- - "~>"
|
|
123
122
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
125
|
-
description: A pure Ruby library to generate a USPS Intelligent Mail barcode.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
email:
|
|
123
|
+
version: '0.9'
|
|
124
|
+
description: A pure Ruby library to generate a USPS Intelligent Mail barcode. It generates
|
|
125
|
+
the string of characters to print with one of the USPS Intelligent Mail barcode
|
|
126
|
+
fonts.
|
|
127
|
+
email: kf7qga@gmail.com
|
|
129
128
|
executables: []
|
|
130
129
|
extensions: []
|
|
131
|
-
extra_rdoc_files:
|
|
132
|
-
- LICENSE.md
|
|
133
|
-
- README.markdown
|
|
130
|
+
extra_rdoc_files: []
|
|
134
131
|
files:
|
|
135
|
-
- .
|
|
136
|
-
-
|
|
132
|
+
- ".gitignore"
|
|
133
|
+
- ".ruby-version"
|
|
134
|
+
- ".travis.yml"
|
|
135
|
+
- CHANGELOG.md
|
|
137
136
|
- Gemfile
|
|
138
137
|
- Gemfile.lock
|
|
139
138
|
- LICENSE.md
|
|
140
|
-
- README.
|
|
139
|
+
- README.md
|
|
141
140
|
- Rakefile
|
|
142
|
-
- USPS-intelligent-barcode.gemspec
|
|
143
141
|
- VERSION
|
|
142
|
+
- doc/font_installation.md
|
|
143
|
+
- doc/migration.md
|
|
144
|
+
- doc/publishing.md
|
|
144
145
|
- examples/example.rb
|
|
146
|
+
- examples/generate_pdf.rb
|
|
147
|
+
- fonts/LICENSE
|
|
148
|
+
- fonts/USPSIMBCompact.ttf
|
|
149
|
+
- fonts/USPSIMBStandard.ttf
|
|
145
150
|
- lib/usps_intelligent_barcode.rb
|
|
146
151
|
- lib/usps_intelligent_barcode/bar_map.rb
|
|
147
152
|
- lib/usps_intelligent_barcode/bar_position.rb
|
|
@@ -155,46 +160,38 @@ files:
|
|
|
155
160
|
- lib/usps_intelligent_barcode/crc.rb
|
|
156
161
|
- lib/usps_intelligent_barcode/mailer_id.rb
|
|
157
162
|
- lib/usps_intelligent_barcode/numeric_conversions.rb
|
|
163
|
+
- lib/usps_intelligent_barcode/project_dirs.rb
|
|
158
164
|
- lib/usps_intelligent_barcode/routing_code.rb
|
|
159
165
|
- lib/usps_intelligent_barcode/serial_number.rb
|
|
160
166
|
- lib/usps_intelligent_barcode/service_type.rb
|
|
161
|
-
-
|
|
162
|
-
-
|
|
163
|
-
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
- spec/codeword_map_spec.rb
|
|
168
|
-
- spec/crc_spec.rb
|
|
169
|
-
- spec/mailer_id_spec.rb
|
|
170
|
-
- spec/numeric_conversions_spec.rb
|
|
171
|
-
- spec/routing_code_spec.rb
|
|
172
|
-
- spec/serial_number_spec.rb
|
|
173
|
-
- spec/service_type_spec.rb
|
|
174
|
-
- spec/spec_helper.rb
|
|
167
|
+
- lib/usps_intelligent_barcode/usps_fonts.rb
|
|
168
|
+
- rake/bundler.rb
|
|
169
|
+
- rake/default.rb
|
|
170
|
+
- rake/rspec.rb
|
|
171
|
+
- rake/version.rb
|
|
172
|
+
- rake/yard.rb
|
|
175
173
|
- usps_intelligent_barcode.gemspec
|
|
176
|
-
homepage:
|
|
174
|
+
homepage: https://github.com/wconrad/usps_intelligent_barcode
|
|
177
175
|
licenses:
|
|
178
176
|
- MIT
|
|
179
|
-
metadata:
|
|
180
|
-
|
|
177
|
+
metadata:
|
|
178
|
+
source_code_uri: https://github.com/wconrad/usps_intelligent_barcode
|
|
179
|
+
bug_tracker_uri: https://github.com/wconrad/usps_intelligent_barcode/issues
|
|
181
180
|
rdoc_options: []
|
|
182
181
|
require_paths:
|
|
183
182
|
- lib
|
|
184
183
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
185
184
|
requirements:
|
|
186
|
-
- -
|
|
185
|
+
- - ">="
|
|
187
186
|
- !ruby/object:Gem::Version
|
|
188
|
-
version:
|
|
187
|
+
version: 3.2.0
|
|
189
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
190
189
|
requirements:
|
|
191
|
-
- -
|
|
190
|
+
- - ">="
|
|
192
191
|
- !ruby/object:Gem::Version
|
|
193
192
|
version: '0'
|
|
194
193
|
requirements: []
|
|
195
|
-
|
|
196
|
-
rubygems_version: 2.4.3
|
|
197
|
-
signing_key:
|
|
194
|
+
rubygems_version: 4.0.3
|
|
198
195
|
specification_version: 4
|
|
199
196
|
summary: Generates a USPS Intelligent Mail Barcode.
|
|
200
197
|
test_files: []
|
data/README.markdown
DELETED
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
[](http://badge.fury.io/rb/usps_intelligent_barcode)
|
|
2
|
-
[](https://gemnasium.com/wconrad/usps_intelligent_barcode)
|
|
3
|
-
[](https://travis-ci.org/wconrad/usps_intelligent_barcode)
|
|
4
|
-
[](https://codeclimate.com/github/wconrad/usps_intelligent_barcode)
|
|
5
|
-
|
|
6
|
-
USPS-intelligent-barcode is a pure ruby gem to generate a USPS IMB
|
|
7
|
-
(Intelligent Mail Barcode). More specifically, it generates the
|
|
8
|
-
string of characters you should print using one of the [USPS
|
|
9
|
-
Intelligent Barcode
|
|
10
|
-
fonts](https://ribbs.usps.gov/onecodesolution/download.cfm).
|
|
11
|
-
|
|
12
|
-
# ORIGIN
|
|
13
|
-
|
|
14
|
-
This project was forked from Ryan Taylor's
|
|
15
|
-
https://github.com/rtlong/USPS-intelligent-barcode Long, in order to
|
|
16
|
-
add tests and refactor. It is _not_ a drop-in replacement: I renamed
|
|
17
|
-
most methods and classes, and eliminated the #draw method.
|
|
18
|
-
|
|
19
|
-
# INSTALL
|
|
20
|
-
|
|
21
|
-
$ gem install USPS-intelligent-barcode
|
|
22
|
-
|
|
23
|
-
# EXAMPLE
|
|
24
|
-
|
|
25
|
-
#!/usr/bin/env ruby
|
|
26
|
-
|
|
27
|
-
require 'rubygems'
|
|
28
|
-
require 'USPS-intelligent-barcode'
|
|
29
|
-
|
|
30
|
-
barcode_id = '01'
|
|
31
|
-
service_type = '234'
|
|
32
|
-
mailer_id = '567094'
|
|
33
|
-
serial_number = '987654321'
|
|
34
|
-
routing_code = '01234567891'
|
|
35
|
-
barcode = Imb::Barcode.new(barcode_id,
|
|
36
|
-
service_type,
|
|
37
|
-
mailer_id,
|
|
38
|
-
serial_number,
|
|
39
|
-
routing_code)
|
|
40
|
-
p barcode.barcode_letters
|
|
41
|
-
# => "AADTFFDFTDADTAADAATFDTDDAAADDTDTTDAFADADDDTFFFDDTTTADFAAADFTDAADA"
|
|
42
|
-
|
|
43
|
-
# STANDARD
|
|
44
|
-
|
|
45
|
-
This gem is based upon standard
|
|
46
|
-
[USPS-B-3200G](https://ribbs.usps.gov/intelligentmail_mailpieces/documents/tech_guides/SPUSPSG.pdf)
|
|
47
|
-
|
|
48
|
-
# RUBY VERSIONS
|
|
49
|
-
|
|
50
|
-
These Ruby versions are supported (these are the rvm platform names):
|
|
51
|
-
|
|
52
|
-
* jruby-1.7
|
|
53
|
-
* ruby-1.9.3
|
|
54
|
-
* ruby-2.0
|
|
55
|
-
* ruby-2.1
|
|
56
|
-
* ruby-2.2
|
|
57
|
-
|
|
58
|
-
For ruby-1.8.7 please see the deprecated
|
|
59
|
-
[USPS-intelligent-barcode](https://rubygems.org/gems/USPS-intelligent-barcode)
|
|
60
|
-
gem.
|
|
61
|
-
|
|
62
|
-
# WHOAMI
|
|
63
|
-
|
|
64
|
-
Wayne Conrad <kf7qga@gmail.com>
|
|
65
|
-
|
|
66
|
-
# CREDITS
|
|
67
|
-
|
|
68
|
-
Thanks to Ryan Taylor Long for his original work, without which I
|
|
69
|
-
would have been lost in the USPS specification.
|
|
@@ -1,95 +0,0 @@
|
|
|
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
|
-
# stub: USPS-intelligent-barcode 0.2.7 ruby lib
|
|
6
|
-
|
|
7
|
-
Gem::Specification.new do |s|
|
|
8
|
-
s.name = "USPS-intelligent-barcode"
|
|
9
|
-
s.version = "0.2.7"
|
|
10
|
-
|
|
11
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
12
|
-
s.require_paths = ["lib"]
|
|
13
|
-
s.authors = ["Wayne Conrad"]
|
|
14
|
-
s.date = "2015-06-13"
|
|
15
|
-
s.description = "A pure Ruby library to generate a USPS Intelligent Mail barcode. It generates the string of characters to print with one of the USPS Intelligent Mail barcode fonts. NOTE: Deprecated. Please use usps_intelligent_barcode instead.\n"
|
|
16
|
-
s.email = "wconrad@yagni.com"
|
|
17
|
-
s.extra_rdoc_files = [
|
|
18
|
-
"LICENSE.md"
|
|
19
|
-
]
|
|
20
|
-
s.files = [
|
|
21
|
-
"Gemfile",
|
|
22
|
-
"Gemfile.lock",
|
|
23
|
-
"LICENSE.md",
|
|
24
|
-
"Rakefile",
|
|
25
|
-
"USPS-intelligent-barcode.gemspec",
|
|
26
|
-
"VERSION",
|
|
27
|
-
"examples/example.rb",
|
|
28
|
-
"lib/USPS-intelligent-barcode.rb",
|
|
29
|
-
"lib/USPS-intelligent-barcode/bar_map.rb",
|
|
30
|
-
"lib/USPS-intelligent-barcode/bar_position.rb",
|
|
31
|
-
"lib/USPS-intelligent-barcode/bar_symbol.rb",
|
|
32
|
-
"lib/USPS-intelligent-barcode/bar_to_character_mapping.yml",
|
|
33
|
-
"lib/USPS-intelligent-barcode/barcode.rb",
|
|
34
|
-
"lib/USPS-intelligent-barcode/barcode_id.rb",
|
|
35
|
-
"lib/USPS-intelligent-barcode/character_position.rb",
|
|
36
|
-
"lib/USPS-intelligent-barcode/codeword_map.rb",
|
|
37
|
-
"lib/USPS-intelligent-barcode/codeword_to_character_mapping.yml",
|
|
38
|
-
"lib/USPS-intelligent-barcode/crc.rb",
|
|
39
|
-
"lib/USPS-intelligent-barcode/mailer_id.rb",
|
|
40
|
-
"lib/USPS-intelligent-barcode/numeric_conversions.rb",
|
|
41
|
-
"lib/USPS-intelligent-barcode/routing_code.rb",
|
|
42
|
-
"lib/USPS-intelligent-barcode/serial_number.rb",
|
|
43
|
-
"lib/USPS-intelligent-barcode/service_type.rb",
|
|
44
|
-
"spec/bar_map_spec.rb",
|
|
45
|
-
"spec/bar_position_spec.rb",
|
|
46
|
-
"spec/bar_symbol_spec.rb",
|
|
47
|
-
"spec/barcode_id_spec.rb",
|
|
48
|
-
"spec/barcode_spec.rb",
|
|
49
|
-
"spec/character_position_spec.rb",
|
|
50
|
-
"spec/codeword_map_spec.rb",
|
|
51
|
-
"spec/crc_spec.rb",
|
|
52
|
-
"spec/mailer_id_spec.rb",
|
|
53
|
-
"spec/numeric_conversions_spec.rb",
|
|
54
|
-
"spec/routing_code_spec.rb",
|
|
55
|
-
"spec/serial_number_spec.rb",
|
|
56
|
-
"spec/service_type_spec.rb",
|
|
57
|
-
"spec/spec_helper.rb"
|
|
58
|
-
]
|
|
59
|
-
s.homepage = "http://github.com/wconrad/USPS-intelligent-barcode"
|
|
60
|
-
s.licenses = ["MIT"]
|
|
61
|
-
s.post_install_message = " The USPS-intelligent-barcode gem has been deprecated and has been\n replaced by usps-intelligent-barcode.\n See: https://rubygems.org/gems/usps_intelligent_barcode\n And: https://github.com/wconrad/usps_intellgent_barcode\n"
|
|
62
|
-
s.rubygems_version = "2.4.3"
|
|
63
|
-
s.summary = "Generates a USPS Intelligent Mail Barcode."
|
|
64
|
-
|
|
65
|
-
if s.respond_to? :specification_version then
|
|
66
|
-
s.specification_version = 4
|
|
67
|
-
|
|
68
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
|
69
|
-
s.add_runtime_dependency(%q<andand>, ["~> 1.3.3"])
|
|
70
|
-
s.add_runtime_dependency(%q<memoizer>, ["~> 1.0.1"])
|
|
71
|
-
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
|
72
|
-
s.add_development_dependency(%q<rspec>, [">= 0"])
|
|
73
|
-
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
|
74
|
-
s.add_development_dependency(%q<yard>, [">= 0"])
|
|
75
|
-
s.add_development_dependency(%q<rake>, [">= 0"])
|
|
76
|
-
else
|
|
77
|
-
s.add_dependency(%q<andand>, ["~> 1.3.3"])
|
|
78
|
-
s.add_dependency(%q<memoizer>, ["~> 1.0.1"])
|
|
79
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
80
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
|
81
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
|
82
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
|
83
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
|
84
|
-
end
|
|
85
|
-
else
|
|
86
|
-
s.add_dependency(%q<andand>, ["~> 1.3.3"])
|
|
87
|
-
s.add_dependency(%q<memoizer>, ["~> 1.0.1"])
|
|
88
|
-
s.add_dependency(%q<jeweler>, [">= 0"])
|
|
89
|
-
s.add_dependency(%q<rspec>, [">= 0"])
|
|
90
|
-
s.add_dependency(%q<simplecov>, [">= 0"])
|
|
91
|
-
s.add_dependency(%q<yard>, [">= 0"])
|
|
92
|
-
s.add_dependency(%q<rake>, [">= 0"])
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
|
data/spec/bar_map_spec.rb
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
2
|
-
|
|
3
|
-
module Imb
|
|
4
|
-
|
|
5
|
-
describe BarMap do
|
|
6
|
-
|
|
7
|
-
let(:characters) do
|
|
8
|
-
[
|
|
9
|
-
0x1FE0, 0x001F, 0x001F, 0x001F, 0x0ADB,
|
|
10
|
-
0x01A3, 0x1BC3, 0x1838, 0x012B, 0x0076,
|
|
11
|
-
]
|
|
12
|
-
end
|
|
13
|
-
let(:codes) do
|
|
14
|
-
[
|
|
15
|
-
2, 0, 0, 3, 2, 0, 0, 1, 0, 0, 2, 1, 0,
|
|
16
|
-
2, 2, 0, 0, 1, 0, 1, 0, 2, 0, 0, 1, 2,
|
|
17
|
-
3, 1, 1, 3, 2, 1, 3, 1, 3, 0, 3, 3, 3,
|
|
18
|
-
3, 3, 0, 2, 0, 3, 2, 2, 2, 2, 0, 1, 3,
|
|
19
|
-
3, 0, 1, 2, 2, 1, 3, 0, 3, 1, 0, 1, 0,
|
|
20
|
-
]
|
|
21
|
-
end
|
|
22
|
-
let(:bar_map) {BarMap.new}
|
|
23
|
-
|
|
24
|
-
specify do
|
|
25
|
-
expect(bar_map.symbols(characters).map(&:code)).to eq(codes)
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
data/spec/bar_position_spec.rb
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
2
|
-
|
|
3
|
-
module Imb
|
|
4
|
-
|
|
5
|
-
describe BarPosition do
|
|
6
|
-
|
|
7
|
-
describe '#map' do
|
|
8
|
-
|
|
9
|
-
let(:ascender_bit) {double 'ascender bit'}
|
|
10
|
-
let(:descender_bit) {double 'descender bit'}
|
|
11
|
-
let(:characters) {double 'array of characters'}
|
|
12
|
-
let(:descender_character_position) {double CharacterPosition}
|
|
13
|
-
let(:ascender_character_position) {double CharacterPosition}
|
|
14
|
-
let(:bar_position) do
|
|
15
|
-
BarPosition.new(descender_character_position,
|
|
16
|
-
ascender_character_position)
|
|
17
|
-
end
|
|
18
|
-
let(:bar_symbol) {double BarSymbol}
|
|
19
|
-
|
|
20
|
-
before(:each) do
|
|
21
|
-
allow(descender_character_position).to receive(:extract_bit_from_characters)\
|
|
22
|
-
.with(characters)\
|
|
23
|
-
.and_return(descender_bit)
|
|
24
|
-
allow(ascender_character_position).to receive(:extract_bit_from_characters)\
|
|
25
|
-
.with(characters)\
|
|
26
|
-
.and_return(ascender_bit)
|
|
27
|
-
allow(BarSymbol).to receive(:make)\
|
|
28
|
-
.with(ascender_bit, descender_bit)\
|
|
29
|
-
.and_return(bar_symbol)
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
specify do
|
|
33
|
-
expect(bar_position.map(characters)).to eq(bar_symbol)
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
end
|
data/spec/bar_symbol_spec.rb
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
2
|
-
|
|
3
|
-
module Imb
|
|
4
|
-
|
|
5
|
-
describe BarSymbol do
|
|
6
|
-
|
|
7
|
-
subject {BarSymbol.make(ascender_bit, descender_bit)}
|
|
8
|
-
|
|
9
|
-
context 'tracker' do
|
|
10
|
-
let(:ascender_bit) {0}
|
|
11
|
-
let(:descender_bit) {0}
|
|
12
|
-
its(:code) {should eq 0}
|
|
13
|
-
its(:letter) {should eq 'T'}
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context 'descender' do
|
|
17
|
-
let(:ascender_bit) {0}
|
|
18
|
-
let(:descender_bit) {1}
|
|
19
|
-
its(:code) {should eq 1}
|
|
20
|
-
its(:letter) {should eq 'D'}
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
context 'ascender' do
|
|
24
|
-
let(:ascender_bit) {1}
|
|
25
|
-
let(:descender_bit) {0}
|
|
26
|
-
its(:code) {should eq 2}
|
|
27
|
-
its(:letter) {should eq 'A'}
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
context 'full' do
|
|
31
|
-
let(:ascender_bit) {1}
|
|
32
|
-
let(:descender_bit) {1}
|
|
33
|
-
its(:code) {should eq 3}
|
|
34
|
-
its(:letter) {should eq 'F'}
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
end
|
data/spec/barcode_id_spec.rb
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
require File.expand_path('spec_helper', File.dirname(__FILE__))
|
|
2
|
-
|
|
3
|
-
module Imb
|
|
4
|
-
|
|
5
|
-
describe BarcodeId do
|
|
6
|
-
|
|
7
|
-
describe '::coerce' do
|
|
8
|
-
|
|
9
|
-
subject {BarcodeId.coerce(o)}
|
|
10
|
-
|
|
11
|
-
context 'BarcodeId' do
|
|
12
|
-
let(:o) {BarcodeId.new(12)}
|
|
13
|
-
its(:to_i) {should == 12}
|
|
14
|
-
end
|
|
15
|
-
|
|
16
|
-
context 'String' do
|
|
17
|
-
let(:o) {'12'}
|
|
18
|
-
its(:to_i) {should == 12}
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
context 'Integer' do
|
|
22
|
-
let(:o) {12}
|
|
23
|
-
its(:to_i) {should == 12}
|
|
24
|
-
end
|
|
25
|
-
|
|
26
|
-
context 'unknown' do
|
|
27
|
-
let(:o) {Object.new}
|
|
28
|
-
specify do
|
|
29
|
-
expect {
|
|
30
|
-
BarcodeId.coerce(o)
|
|
31
|
-
}.to raise_error ArgumentError, 'Cannot coerce to BarcodeId'
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
describe '#to_i' do
|
|
38
|
-
let(:value) {23}
|
|
39
|
-
subject {BarcodeId.new(value)}
|
|
40
|
-
its(:to_i) {should == value}
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
describe '#=' do
|
|
44
|
-
def o1 ; BarcodeId.new(1) ; end
|
|
45
|
-
def o2 ; 1 ; end
|
|
46
|
-
def o3 ; BarcodeId.new(2) ; end
|
|
47
|
-
def o4 ; Object.new ; end
|
|
48
|
-
specify {expect(o1).to eq(o1)}
|
|
49
|
-
specify {expect(o1).to eq(o2)}
|
|
50
|
-
specify {expect(o1).not_to eq(o3)}
|
|
51
|
-
specify {expect(o1).not_to eq(o4)}
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
describe '#validate' do
|
|
55
|
-
|
|
56
|
-
let(:long_mailer_id?) {double 'long_mailer_id?'}
|
|
57
|
-
|
|
58
|
-
def validate(value)
|
|
59
|
-
BarcodeId.new(value).validate(long_mailer_id?)
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
def self.is_valid(value)
|
|
63
|
-
context "#{value}" do
|
|
64
|
-
specify {validate(value)}
|
|
65
|
-
end
|
|
66
|
-
end
|
|
67
|
-
|
|
68
|
-
def self.is_out_of_range(value)
|
|
69
|
-
context "#{value}" do
|
|
70
|
-
specify do
|
|
71
|
-
expect {
|
|
72
|
-
validate(value)
|
|
73
|
-
}.to raise_error ArgumentError, 'Must be 0..94'
|
|
74
|
-
end
|
|
75
|
-
end
|
|
76
|
-
end
|
|
77
|
-
|
|
78
|
-
def self.has_bad_least_significant_digit(value)
|
|
79
|
-
context "#{value}" do
|
|
80
|
-
specify do
|
|
81
|
-
expect {
|
|
82
|
-
validate(value)
|
|
83
|
-
}.to raise_error(ArgumentError,
|
|
84
|
-
'Least significant digit must be 0..4')
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
is_out_of_range -1
|
|
90
|
-
is_valid 0
|
|
91
|
-
is_valid 4
|
|
92
|
-
has_bad_least_significant_digit 5
|
|
93
|
-
is_valid 94
|
|
94
|
-
is_out_of_range 95
|
|
95
|
-
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
describe '#shift_and_add_to' do
|
|
99
|
-
let(:barcode_id) {BarcodeId.new(12)}
|
|
100
|
-
let(:long_mailer_id?) {double 'long mailer id'}
|
|
101
|
-
specify {expect(barcode_id.shift_and_add_to(1, long_mailer_id?)).to eq(57)}
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
end
|
|
105
|
-
|
|
106
|
-
end
|