upu_s10_generator 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ec151c540a6f90d54e9646df98113d5d2d0ae2a4e3d5aa45196bae69a89751bc
4
+ data.tar.gz: 416cc67a2e6bfa74e4734ed834029d161a45c2eb4f2f35b48b88efe5db5f7ddb
5
+ SHA512:
6
+ metadata.gz: 8f254c87990a164516d6fc6bc8f8aeb213292741346ec288be28f6c275a31209298735d2ba1a98cb9daae8200c771517bbaa14eeb9b24036fa83e467aec7fb61
7
+ data.tar.gz: 864330ee206e7a1346a5589ab29a9e9b3ff40968b4d9edae40c46663bee98cbd28ceb8cc4c73f8342e17d41fdf27f32f00200af733912fded2242a5352c872e4
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2024-02-08
4
+
5
+ - Initial release
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at yanhao153@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2024 Evan Yan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # UpuS10Generator
2
+
3
+ UPC S10 identifier generator
4
+
5
+ ## Usage
6
+ ```
7
+ g = UpuS10Generator.new(service_indicator, sequence, country_code)
8
+ s10 = g.generate
9
+ ```
10
+
11
+ ## Contributing
12
+
13
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/upu_s10_generator. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/upu_s10_generator/blob/master/CODE_OF_CONDUCT.md).
14
+
15
+ ## License
16
+
17
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
18
+
19
+ ## Code of Conduct
20
+
21
+ Everyone interacting in the UpuS10Generator project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/upu_s10_generator/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,4 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ task default: %i[]
@@ -0,0 +1,340 @@
1
+ module UpuS10Generator
2
+ class Base
3
+ attr_accessor :service_indicator, :sequence, :country_code
4
+
5
+ def initialize(service_indicator, sequence, country_code)
6
+ @service_indicator = service_indicator
7
+ @sequence = sequence
8
+ @country_code = country_code
9
+ end
10
+
11
+ def generate
12
+ validate_params
13
+ check_digit = generate_check_digit
14
+ serial_number = @sequence + check_digit
15
+
16
+ return @service_indicator + serial_number + @country_code
17
+ end
18
+
19
+ def generate_check_digit
20
+ weighting = [8,6,4,2,3,5,9,7]
21
+
22
+ total = 0
23
+ @sequence.chars.to_a.zip(weighting).each do |(a,b)|
24
+ total += a.to_i * b.to_i
25
+ end
26
+
27
+ remainder = total % 11
28
+ check = case remainder
29
+ when 1
30
+ 0
31
+ when 0
32
+ 5
33
+ else
34
+ 11 - remainder
35
+ end
36
+
37
+ return check.to_s
38
+ end
39
+
40
+ def validate_params
41
+ validate_service_indicator
42
+ validate_sequence
43
+ validate_country_code
44
+ end
45
+
46
+ def validate_service_indicator
47
+ if @service_indicator.length != 2
48
+ raise Exception.new "Service Indicator length should be 2"
49
+ end
50
+ end
51
+
52
+ def validate_sequence
53
+ if @sequence.length != 12
54
+ raise Exception.new "Sequence length should be 12"
55
+ end
56
+ end
57
+
58
+ def validate_country_code
59
+ if @country_code.length != 2
60
+ raise Exception.new "Country code length should be 2"
61
+ elsif not ISOCountries.key?(@country_code)
62
+ raise Exception.new "Country code does not exist"
63
+ end
64
+ end
65
+
66
+ SICodes = [
67
+ {['AV','AZ'],'domestic, bilateral, multilateral use only, identifing RFID-tracked e-commerce items'},
68
+ {['BA','BZ'],'domestic, bilateral, multilateral use only'},
69
+ {['CA','CZ'],'Parcel post; the use of CZ requires bilateral agreement. It is not required to use CV for insured parcels but if the service indicator CV is used, then it is recommended that it be used only on insured parcels.'},
70
+ {['DA','DZ'],'for domestic, bilateral, multilateral use only'},
71
+ {['EA','EZ'],'EMS; the use of EX-EZ requires bilateral agreement'},
72
+ {['GA','GA'],'for domestic, bilateral, multilateral use only'},
73
+ {['GD','GD'],'for domestic, bilateral, multilateral use only'},
74
+ {['HA','HZ'],'e-commerce parcels; the use of HX-HY requires multilateral agreement; the use of HZ requires bilateral agreement'},
75
+ {['JA','JZ'],'reserved; cannot be assigned as valid service indicator values'},
76
+ {['KA','KZ'],'reserved; cannot be assigned as valid service indicator values'},
77
+ {['LA','LZ'],'Letter post express; the use of LZ requires bilateral agreement'},
78
+ {['MA','MZ'],'Letter post: M bags'},
79
+ {['NA','NZ'],'for domestic, bilateral, multilateral use only'},
80
+ {['PA','PZ'],'for domestic, bilateral, multilateral use only'},
81
+ {['QA','QM'],'Letter post: IBRS (International Business Reply Service)'},
82
+ {['RA','RZ'],'Letter post: registered, but not insured delivery. The use of RZ requires bilateral agreement.'},
83
+ {['SA','SZ'],'reserved; cannot be assigned as valid service indicator values'},
84
+ {['TA','TZ'],'reserved; cannot be assigned as valid service indicator values'},
85
+ {['UA','UZ'],'Letter post: items other than LA-LZ (Express), MA-MZ (M bags), QA-QM (IBRS), RA-RZ (registered), VA-VZ (insured), subject to customs control, i.e. bearing a CN 22 or CN 23'},
86
+ {['VA','VZ'],'Letter post insured; the use of VZ requires bilateral agreement'},
87
+ {['WA','WZ'],'reserved; cannot be assigned as valid service indicator values'},
88
+ {['ZA','ZZ'],'domestic, bilateral, multilateral use only'}
89
+ ];
90
+
91
+ ISOCountries = {
92
+ 'AF' => 'Afghanistan',
93
+ 'AX' => 'Aland Islands',
94
+ 'AL' => 'Albania',
95
+ 'DZ' => 'Algeria',
96
+ 'AS' => 'American Samoa',
97
+ 'AD' => 'Andorra',
98
+ 'AO' => 'Angola',
99
+ 'AI' => 'Anguilla',
100
+ 'AQ' => 'Antarctica',
101
+ 'AG' => 'Antigua And Barbuda',
102
+ 'AR' => 'Argentina',
103
+ 'AM' => 'Armenia',
104
+ 'AW' => 'Aruba',
105
+ 'AU' => 'Australia',
106
+ 'AT' => 'Austria',
107
+ 'AZ' => 'Azerbaijan',
108
+ 'BS' => 'Bahamas',
109
+ 'BH' => 'Bahrain',
110
+ 'BD' => 'Bangladesh',
111
+ 'BB' => 'Barbados',
112
+ 'BY' => 'Belarus',
113
+ 'BE' => 'Belgium',
114
+ 'BZ' => 'Belize',
115
+ 'BJ' => 'Benin',
116
+ 'BM' => 'Bermuda',
117
+ 'BT' => 'Bhutan',
118
+ 'BO' => 'Bolivia',
119
+ 'BA' => 'Bosnia And Herzegovina',
120
+ 'BW' => 'Botswana',
121
+ 'BV' => 'Bouvet Island',
122
+ 'BR' => 'Brazil',
123
+ 'IO' => 'British Indian Ocean Territory',
124
+ 'BN' => 'Brunei Darussalam',
125
+ 'BG' => 'Bulgaria',
126
+ 'BF' => 'Burkina Faso',
127
+ 'BI' => 'Burundi',
128
+ 'KH' => 'Cambodia',
129
+ 'CM' => 'Cameroon',
130
+ 'CA' => 'Canada',
131
+ 'CV' => 'Cape Verde',
132
+ 'KY' => 'Cayman Islands',
133
+ 'CF' => 'Central African Republic',
134
+ 'TD' => 'Chad',
135
+ 'CL' => 'Chile',
136
+ 'CN' => 'China',
137
+ 'CX' => 'Christmas Island',
138
+ 'CC' => 'Cocos (Keeling) Islands',
139
+ 'CO' => 'Colombia',
140
+ 'KM' => 'Comoros',
141
+ 'CG' => 'Congo',
142
+ 'CD' => 'Congo, Democratic Republic',
143
+ 'CK' => 'Cook Islands',
144
+ 'CR' => 'Costa Rica',
145
+ 'CI' => 'Cote D\'Ivoire',
146
+ 'HR' => 'Croatia',
147
+ 'CU' => 'Cuba',
148
+ 'CY' => 'Cyprus',
149
+ 'CZ' => 'Czech Republic',
150
+ 'DK' => 'Denmark',
151
+ 'DJ' => 'Djibouti',
152
+ 'DM' => 'Dominica',
153
+ 'DO' => 'Dominican Republic',
154
+ 'EC' => 'Ecuador',
155
+ 'EG' => 'Egypt',
156
+ 'SV' => 'El Salvador',
157
+ 'GQ' => 'Equatorial Guinea',
158
+ 'ER' => 'Eritrea',
159
+ 'EE' => 'Estonia',
160
+ 'ET' => 'Ethiopia',
161
+ 'FK' => 'Falkland Islands (Malvinas)',
162
+ 'FO' => 'Faroe Islands',
163
+ 'FJ' => 'Fiji',
164
+ 'FI' => 'Finland',
165
+ 'FR' => 'France',
166
+ 'GF' => 'French Guiana',
167
+ 'PF' => 'French Polynesia',
168
+ 'TF' => 'French Southern Territories',
169
+ 'GA' => 'Gabon',
170
+ 'GM' => 'Gambia',
171
+ 'GE' => 'Georgia',
172
+ 'DE' => 'Germany',
173
+ 'GH' => 'Ghana',
174
+ 'GI' => 'Gibraltar',
175
+ 'GR' => 'Greece',
176
+ 'GL' => 'Greenland',
177
+ 'GD' => 'Grenada',
178
+ 'GP' => 'Guadeloupe',
179
+ 'GU' => 'Guam',
180
+ 'GT' => 'Guatemala',
181
+ 'GG' => 'Guernsey',
182
+ 'GN' => 'Guinea',
183
+ 'GW' => 'Guinea-Bissau',
184
+ 'GY' => 'Guyana',
185
+ 'HT' => 'Haiti',
186
+ 'HM' => 'Heard Island & Mcdonald Islands',
187
+ 'VA' => 'Holy See (Vatican City State)',
188
+ 'HN' => 'Honduras',
189
+ 'HK' => 'Hong Kong',
190
+ 'HU' => 'Hungary',
191
+ 'IS' => 'Iceland',
192
+ 'IN' => 'India',
193
+ 'ID' => 'Indonesia',
194
+ 'IR' => 'Iran, Islamic Republic Of',
195
+ 'IQ' => 'Iraq',
196
+ 'IE' => 'Ireland',
197
+ 'IM' => 'Isle Of Man',
198
+ 'IL' => 'Israel',
199
+ 'IT' => 'Italy',
200
+ 'JM' => 'Jamaica',
201
+ 'JP' => 'Japan',
202
+ 'JE' => 'Jersey',
203
+ 'JO' => 'Jordan',
204
+ 'KZ' => 'Kazakhstan',
205
+ 'KE' => 'Kenya',
206
+ 'KI' => 'Kiribati',
207
+ 'KR' => 'Korea',
208
+ 'KW' => 'Kuwait',
209
+ 'KG' => 'Kyrgyzstan',
210
+ 'LA' => 'Lao People\'s Democratic Republic',
211
+ 'LV' => 'Latvia',
212
+ 'LB' => 'Lebanon',
213
+ 'LS' => 'Lesotho',
214
+ 'LR' => 'Liberia',
215
+ 'LY' => 'Libyan Arab Jamahiriya',
216
+ 'LI' => 'Liechtenstein',
217
+ 'LT' => 'Lithuania',
218
+ 'LU' => 'Luxembourg',
219
+ 'MO' => 'Macao',
220
+ 'MK' => 'Macedonia',
221
+ 'MG' => 'Madagascar',
222
+ 'MW' => 'Malawi',
223
+ 'MY' => 'Malaysia',
224
+ 'MV' => 'Maldives',
225
+ 'ML' => 'Mali',
226
+ 'MT' => 'Malta',
227
+ 'MH' => 'Marshall Islands',
228
+ 'MQ' => 'Martinique',
229
+ 'MR' => 'Mauritania',
230
+ 'MU' => 'Mauritius',
231
+ 'YT' => 'Mayotte',
232
+ 'MX' => 'Mexico',
233
+ 'FM' => 'Micronesia, Federated States Of',
234
+ 'MD' => 'Moldova',
235
+ 'MC' => 'Monaco',
236
+ 'MN' => 'Mongolia',
237
+ 'ME' => 'Montenegro',
238
+ 'MS' => 'Montserrat',
239
+ 'MA' => 'Morocco',
240
+ 'MZ' => 'Mozambique',
241
+ 'MM' => 'Myanmar',
242
+ 'NA' => 'Namibia',
243
+ 'NR' => 'Nauru',
244
+ 'NP' => 'Nepal',
245
+ 'NL' => 'Netherlands',
246
+ 'AN' => 'Netherlands Antilles',
247
+ 'NC' => 'New Caledonia',
248
+ 'NZ' => 'New Zealand',
249
+ 'NI' => 'Nicaragua',
250
+ 'NE' => 'Niger',
251
+ 'NG' => 'Nigeria',
252
+ 'NU' => 'Niue',
253
+ 'NF' => 'Norfolk Island',
254
+ 'MP' => 'Northern Mariana Islands',
255
+ 'NO' => 'Norway',
256
+ 'OM' => 'Oman',
257
+ 'PK' => 'Pakistan',
258
+ 'PW' => 'Palau',
259
+ 'PS' => 'Palestinian Territory, Occupied',
260
+ 'PA' => 'Panama',
261
+ 'PG' => 'Papua New Guinea',
262
+ 'PY' => 'Paraguay',
263
+ 'PE' => 'Peru',
264
+ 'PH' => 'Philippines',
265
+ 'PN' => 'Pitcairn',
266
+ 'PL' => 'Poland',
267
+ 'PT' => 'Portugal',
268
+ 'PR' => 'Puerto Rico',
269
+ 'QA' => 'Qatar',
270
+ 'RE' => 'Reunion',
271
+ 'RO' => 'Romania',
272
+ 'RU' => 'Russian Federation',
273
+ 'RW' => 'Rwanda',
274
+ 'BL' => 'Saint Barthelemy',
275
+ 'SH' => 'Saint Helena',
276
+ 'KN' => 'Saint Kitts And Nevis',
277
+ 'LC' => 'Saint Lucia',
278
+ 'MF' => 'Saint Martin',
279
+ 'PM' => 'Saint Pierre And Miquelon',
280
+ 'VC' => 'Saint Vincent And Grenadines',
281
+ 'WS' => 'Samoa',
282
+ 'SM' => 'San Marino',
283
+ 'ST' => 'Sao Tome And Principe',
284
+ 'SA' => 'Saudi Arabia',
285
+ 'SN' => 'Senegal',
286
+ 'RS' => 'Serbia',
287
+ 'SC' => 'Seychelles',
288
+ 'SL' => 'Sierra Leone',
289
+ 'SG' => 'Singapore',
290
+ 'SK' => 'Slovakia',
291
+ 'SI' => 'Slovenia',
292
+ 'SB' => 'Solomon Islands',
293
+ 'SO' => 'Somalia',
294
+ 'ZA' => 'South Africa',
295
+ 'GS' => 'South Georgia And Sandwich Isl.',
296
+ 'ES' => 'Spain',
297
+ 'LK' => 'Sri Lanka',
298
+ 'SD' => 'Sudan',
299
+ 'SR' => 'Suriname',
300
+ 'SJ' => 'Svalbard And Jan Mayen',
301
+ 'SZ' => 'Swaziland',
302
+ 'SE' => 'Sweden',
303
+ 'CH' => 'Switzerland',
304
+ 'SY' => 'Syrian Arab Republic',
305
+ 'TW' => 'Taiwan',
306
+ 'TJ' => 'Tajikistan',
307
+ 'TZ' => 'Tanzania',
308
+ 'TH' => 'Thailand',
309
+ 'TL' => 'Timor-Leste',
310
+ 'TG' => 'Togo',
311
+ 'TK' => 'Tokelau',
312
+ 'TO' => 'Tonga',
313
+ 'TT' => 'Trinidad And Tobago',
314
+ 'TN' => 'Tunisia',
315
+ 'TR' => 'Turkey',
316
+ 'TM' => 'Turkmenistan',
317
+ 'TC' => 'Turks And Caicos Islands',
318
+ 'TV' => 'Tuvalu',
319
+ 'UG' => 'Uganda',
320
+ 'UA' => 'Ukraine',
321
+ 'AE' => 'United Arab Emirates',
322
+ 'GB' => 'United Kingdom',
323
+ 'US' => 'United States',
324
+ 'UM' => 'United States Outlying Islands',
325
+ 'UY' => 'Uruguay',
326
+ 'UZ' => 'Uzbekistan',
327
+ 'VU' => 'Vanuatu',
328
+ 'VE' => 'Venezuela',
329
+ 'VN' => 'Viet Nam',
330
+ 'VG' => 'Virgin Islands, British',
331
+ 'VI' => 'Virgin Islands, U.S.',
332
+ 'WF' => 'Wallis And Futuna',
333
+ 'EH' => 'Western Sahara',
334
+ 'YE' => 'Yemen',
335
+ 'ZM' => 'Zambia',
336
+ 'ZW' => 'Zimbabwe'
337
+ }
338
+
339
+ end
340
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module UpuS10Generator
4
+ VERSION = "0.1.0"
5
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "upu_s10_generator/version"
4
+ require_relative "upu_s10_generator/base"
5
+
6
+ module UpuS10Generator
7
+ class Error < StandardError; end
8
+
9
+ def new(service_indicator, sequence, country_code)
10
+ return new Base(service_indicator, sequence, country_code)
11
+ end
12
+
13
+ end
@@ -0,0 +1,4 @@
1
+ module UpuS10Generator
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/upu_s10_generator/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "upu_s10_generator"
7
+ spec.version = UpuS10Generator::VERSION
8
+ spec.authors = ["Evan Yan"]
9
+ spec.email = ["evanyanrock@gmail.com"]
10
+
11
+ spec.summary = "Generate UPC S10 identifier"
12
+ spec.homepage = "https://github.com/yanhao-eng/upu_s10_generator"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.6.0"
15
+
16
+
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = "https://github.com/yanhao-eng/upu_s10_generator"
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(__dir__) do
23
+ `git ls-files -z`.split("\x0").reject do |f|
24
+ (File.expand_path(f) == __FILE__) ||
25
+ f.start_with?(*%w[bin/ test/ spec/ features/ .git appveyor Gemfile])
26
+ end
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: upu_s10_generator
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Evan Yan
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2024-02-08 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email:
15
+ - evanyanrock@gmail.com
16
+ executables: []
17
+ extensions: []
18
+ extra_rdoc_files: []
19
+ files:
20
+ - CHANGELOG.md
21
+ - CODE_OF_CONDUCT.md
22
+ - LICENSE.txt
23
+ - README.md
24
+ - Rakefile
25
+ - lib/upu_s10_generator.rb
26
+ - lib/upu_s10_generator/base.rb
27
+ - lib/upu_s10_generator/version.rb
28
+ - sig/upu_s10_generator.rbs
29
+ - upu_s10_generator.gemspec
30
+ homepage: https://github.com/yanhao-eng/upu_s10_generator
31
+ licenses:
32
+ - MIT
33
+ metadata:
34
+ homepage_uri: https://github.com/yanhao-eng/upu_s10_generator
35
+ source_code_uri: https://github.com/yanhao-eng/upu_s10_generator
36
+ post_install_message:
37
+ rdoc_options: []
38
+ require_paths:
39
+ - lib
40
+ required_ruby_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: 2.6.0
45
+ required_rubygems_version: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - ">="
48
+ - !ruby/object:Gem::Version
49
+ version: '0'
50
+ requirements: []
51
+ rubygems_version: 3.1.2
52
+ signing_key:
53
+ specification_version: 4
54
+ summary: Generate UPC S10 identifier
55
+ test_files: []