0.01
No release in over 3 years
Low commit activity in last 3 years
Gem to look up agency names for GB standards.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 13.0
~> 3.0
 Project Readme

gb-agencies

Gem Version Build Status Code Climate Pull Requests Commits since latest

Gem to look up agency names for GB standards

# hash of localised labels
LABELS = { "PRC" => "PRC", # People's Republic of China
           "industry_standard" => "Industry Standard",
           "local_standard" => "Local Standard",
           "enterprise_standard" => "Enterprise Standard",
           "social_standard" => "Social Standard" }

# language (only "en", "zh" defined)
# LABELS: hash of localised labels
# issuer: name of organisation issuing the standard (only used for enterprise and social-group standards;
#          this gem provides lookup for local, sector, and national agency names)
gba = GbAgencies::Agencies.new("en", LABELS, "My Org")

# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
# mandate: "mandatory", "recommended", "guide"
gba.standard_class("national", "GB", "mandatory")
=> "National standard"

gba.standard_class("local", "81", "guide")
=> "Hong Kong Special Administrative Region Local Standard"

# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
# mandate: "mandatory", "recommended", "guide"
gba.standard_agency("national", "GB", "mandatory")
=> "General Administration of Quality Supervision, Inspection and Quarantine; Standardization Administration of China"

# return agency as single string
GbAgencies::Agencies.new("zh", LABELS, "My Org").standard_agency1("national", "GB", "mandatory")

# return agency as array (where there is more than one body involved)
GbAgencies::Agencies.new("zh", LABELS, "My Org").standard_agency("national", "GB", "mandatory")
=> "["中华人民共和国国家质量监督检验检疫总局 中国国家标准化管理委员会"]

# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
# mandate: "mandatory", "recommended", "guide"
# year: year of publication
# nunumber: the number of the standard
gba.docidentifier("social-group", "PREFIX", "guide", "2002", "123")
=> "T/Z/PREFIX 123—2002"

# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
gba.gbtype_validate("national", "GB")
=> true

# scope: "national", "sector", "local", "enterprise", "social-group"
# prefix: the prefix of the standard
gba.gbtype_validate("national", "ZZ")
ZZ is not a recognised national prefix
=> false