= CnCcs: Ruby gem for using CCS codes image:https://img.shields.io/gem/v/cnccs.svg["Gem Version", link="https://rubygems.org/gems/cnccs"] image:https://img.shields.io/travis/metanorma/cnccs/master.svg["Build Status", link="https://travis-ci.com/metanorma/cnccs"] image:https://codeclimate.com/github/metanorma/cnccs/badges/gpa.svg["Code Climate", link="https://codeclimate.com/github/metanorma/cnccs"] The categories used in the Classification of Chinese Standards ("CCS") are accessible via this gem. == Installation Add this line to your application's Gemfile: [source,ruby] ---- gem 'cnccs' ---- And then execute: [source] ---- $ bundle ---- Or install it yourself as: [source] ---- $ gem install cnccs ---- == Usage Fetching CCS data: [source,ruby] ---- # Fetch field ccs = Cnccs.fetch fieldcode: "J" ccs.code # => "J" ccs.fieldcode # => "J" ccs.description "机械" ccs.notes # => "" # Fetch group ccs = Cnccs.fetch fieldcode: "J", groupcode: "90/99" ccs.code # => "J90/99" ccs.groupcode # => "90/99" ccs.description # => "活塞式内燃机与其他动力设备" ccs.description_full # => "机械;活塞式内燃机与其他动力设备" ccs.fieldcode # => "J" ccs.notes # => [ #, #, #, #, #, #, ] J98,,J90/99, # Fetch subgroup ccs = Cnccs.fetch subgroupcode: "J98" ccs.code # => "J98" ccs.fieldcode # => "J" ccs.groupcode # => "90/99" ccs.subgroupcode # => "98" ccs.description # => "锅炉及其辅助设备" ccs.description_full # => "机械;活塞式内燃机与其他动力设备:锅炉及其辅助设备" ccs.notes # => [ #, #, #, ] note = ccs.notes[1] note.text # => "锅炉高能点火器入 {ccs-code}" note.ccs_code # => "T37" note.ccs.description # => "点火装置" # Fetch by code ccs = Cnccs.fetch "J98" ccs.description_full # => "机械;活塞式内燃机与其他动力设备:锅炉及其辅助设备" ---- == Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). == Contributing Bug reports and pull requests are welcome on GitHub at https://github.com/metanorma/cnccs. == License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).