Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pnnl-building_id

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pnnl-building_id

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Unique Building Identification (UBID)

Website: https://buildingid.pnnl.gov/

Documentation

Install

Add this line to your application's Gemfile:

gem 'pnnl-building_id'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pnnl-building_id

Usage

The pnnl-building_id package supports one usage:

  • Application programming interface (API)

The API

UBID codecs are encapsulated in separate modules:

  • PNNL::BuildingId::V3 (format: "C-n-e-s-w")

Modules export the same API:

  • decode(String) ~> PNNL::BuildingId::CodeArea
  • encode(Float, Float, Float, Float, Float, Float, Integer) ~> String
  • encode_code_area(PNNL::BuildingId::CodeArea) ~> String
  • valid?(String) ~> Boolean

In the following example, a UBID code is decoded and then re-encoded:

# Use the "C-n-e-s-w" format for UBID codes.
require 'pnnl/building_id'

# Initialize UBID code.
code = '849VQJH6+95J-51-58-42-50'
$stdout.puts(code)

# Decode the UBID code.
code_area = PNNL::BuildingId::V3.decode(code)
$stdout.puts(code_area)

# Resize the resulting UBID code area.
#
# The effect of this operation is that the height and width of the UBID code
# area are reduced by half an OLC code area.
new_code_area = code_area.resize
$stdout.puts(new_code_area)

# Encode the new UBID code area.
new_code = PNNL::BuildingId::V3.encode_code_area(new_code_area)
$stdout.puts(new_code)

# Test that the new UBID code matches the original.
$stdout.puts(code == newCode)

License

The gem is available as open source under the terms of The 2-Clause BSD License.

Contributions

Contributions are accepted on GitHub via the fork and pull request workflow. See here for more information.

FAQs

Package last updated on 03 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc