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

notams

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

notams

  • 0.2.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Notams

A ruby gem for retrieving the currently active NOTAMs for an airport or a region. Supports multiple airports/regions in one request. Pulls data from FAA website. Depends on nokogiri for the heavy lifting.

Build Status Gemnasium Gem Version Code Climate

Requirements

Ruby 1.9.3 or higher | Supports Ruby 2.0!

Installation

Add this line to your application's Gemfile:

gem 'notams'

And then execute:

$ bundle

Or install it yourself as:

$ gem install notams

Usage

Easy mode

The .notams method can be applied to any string literal or variable, representing a valid ICAO code of an airport or FIR, or a comma-separated list of airports/regions. It will return an array, containing all the currently active NOTAMs for your selection. You can loop through the array to display or parse individual notams. I figured this would be the most common use case. For advanced usage and possible customizations see below.

icao = "lowi"
icao.notams # => returns an array containing all NOTAMs for Innsbruck airport

"lowi".notams # => same as above

icao = "lqsa,lqsb"
icao.notams # => returns an array containing all NOTAMs for Sarajevo Airport
            #    and Bosnia and Herzegovina FIR

Advanced usage

The .notams method can be customized by passing an optional hash of arguments.

The :objects => true option will cause the .notams method to return an array of notam objects instead of strings. Thus each notam is parsed and encapuslated in an instance of the Notam class and exposes a number of attributes:

icao = "lqsa"
icao.notams(:objects => true) # => returns an array of notam objects

notam = icao.notams.first # => returns the first notam as an object

# Notam object attributes

notam.raw       # => returns the raw (unprocessed) notam as a string
notam.icao      # => returns the icao code of the airport or area, covered by the notam;
                #    useful when iterating over multiple notams, covering a collection of airports or areas
notam.message   # => returns the actual information message of the notam as a string

Example Ruby on Rails implementation

Here's a possible scenario of using this gem in a Ruby on Rails application. Verbosity is kept on purpose for clarity.

In your controller:

def action

 # We define the airpots and/or areas that we're interested in.
 # In this case this is Sarajevo Airport and the entire Bosnia & Herzegovina FIR

 icao = "lqsa, lqsb"

 # Now we want to pull all the latest notams for both these areas.
 # We also want to pull them as objects, so that we can process their attributes
 # separately in our views. We're assigning the result to the @notams instance
 # variable which we will use in our views

 @notams = icao.notams(:objects => true)

end

In your view (HAML is used for clarity):

// We could play with the attributes individually if we need to:
- for notam in @notams
  %li
   = notam.icao
   = notam.message

// Or we could just loop through the raw notams:
- for notam in @notams
  %li= notam.raw

Changelog

v. 0.2.0 27 February 2013

  • Ruby 2.0 support
  • dependencies update
  • classes refactored

v. 0.1.0 28 July 2012

  • added optional arguments customization to the .notams method (see Advanced Usage)
  • code refactored into classes for flexibility

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Make sure all tests pass!
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

Credits

Copyright © 2013 Svilen Vassilev

If you find my work useful or time-saving, you can endorse it or buy me a cup of coffee:

endorse Donate

Released under the MIT LICENSE

FAQs

Package last updated on 27 Feb 2013

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