dopic_passport_specs 1.0.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,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+
5
+ # Official passport, visa, and ID photo specifications for 121 countries.
6
+ # Maintained by Dopic.app (https://dopic.app/)
7
+ module DopicPassportSpecs
8
+ VERSION = '1.0.0'
9
+ DATA_PATH = File.expand_path('../data/specs.json', __dir__)
10
+
11
+ def self.all
12
+ @all ||= JSON.parse(File.read(DATA_PATH))
13
+ end
14
+
15
+ def self.countries
16
+ all['countries'] || []
17
+ end
18
+
19
+ def self.get_country(code)
20
+ needle = code.to_s.strip.upcase
21
+ countries.find { |c| c['country_code'].to_s.upcase == needle }
22
+ end
23
+
24
+ def self.get_primary_spec(code)
25
+ country = get_country(code)
26
+ country ? country['primary_spec'] : nil
27
+ end
28
+
29
+ def self.search(query)
30
+ q = query.to_s.strip.downcase
31
+ return countries if q.empty?
32
+
33
+ countries.select do |c|
34
+ c['country_code'].to_s.downcase.include?(q) ||
35
+ c['country_name'].to_s.downcase.include?(q) ||
36
+ c.dig('primary_spec', 'name').to_s.downcase.include?(q)
37
+ end
38
+ end
39
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dopic_passport_specs
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Dopic Studio
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2026-12-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Official passport, visa, and ID photo specifications for 121 countries (dimensions in mm/px, DPI, head ratio, and background hex) maintained by Dopic.app.
14
+ email: []
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - LICENSE
20
+ - README.md
21
+ - data/specs.json
22
+ - lib/dopic_passport_specs.rb
23
+ homepage: https://dopic.app/
24
+ licenses:
25
+ - MIT
26
+ metadata:
27
+ homepage_uri: https://dopic.app/
28
+ source_code_uri: https://github.com/zc4414194/global-passport-photo-specs
29
+ documentation_uri: https://dopic.app/
30
+ bug_tracker_uri: https://github.com/zc4414194/global-passport-photo-specs/issues
31
+ post_install_message:
32
+ rdoc_options: []
33
+ require_paths:
34
+ - lib
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - '>='
38
+ - !ruby/object:Gem::Version
39
+ version: 2.7.0
40
+ required_rubygems_version: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - '>='
43
+ - !ruby/object:Gem::Version
44
+ version: '0'
45
+ requirements: []
46
+ rubygems_version: 3.5.0
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: Official passport, visa, and ID photo specs for 121 countries by Dopic.app.
50
+ test_files: []