Giter Club home page Giter Club logo

radiodns-ruby's Introduction

RadioDNS Ruby Library

Summary

This Ruby Gem provides utilities for working with RadioDNS. It supports service CNAME resolution from bearer parameters and application discovery, corresponding to v0.6.1 of the RadioDNS spec.

Installation

gem install radiodns

Usage

Add this to the top of your script

require 'radiodns'

Then if you already have the Fully Qualified Domain Name as specified in the RadioDNS spec, you can resolve it into a CNAME like so

service = RadioDNS::Resolver.resolve('09580.c586.ce1.fm.radiodns.org')
puts service.cname #=> 'rdns.musicradio.com'

You can also pass in the parameters required to construct the FQDN to the resolve method

params = {
  :freq => '09580',
  :pi => 'c586',
  :ecc => 'ce1',
  :bearer => 'fm'
}
service = RadioDNS::Resolver.resolve(params)

The bearers fm, dab, drm, amss and hd are supported.

Once you have a service you can perform application discovery

radiovis_application = service.radiovis

radiovis_application.host #=> "rdns.musicradio.com"
radiovis_application.port #=> 61613
radiovis_application.type #=> :radiovis

Or to get an array of supported applications

service.applications

which returns

[#<RadioDNS::Application @host="rdns.musicradio.com", @port=61613, @type=:radioepg>,
 #<RadioDNS::Application @host="rdns.musicradio.com", @port=61613, @type=:radiovis>]

In the future these may become instances of specific classes that implement application-specific behaviour, but I might make those separate gems.

TODO

  • better error checking of supplied parameters. The code current checks for mandatory parameters but not if the parameters themselves conform to the spec (e.g. pa should be between 0 and 1023)

  • return an appropriate error if DNS look-up does not resolve to CNAME.

radiodns-ruby's People

Contributors

chrislo avatar samstarling avatar

Watchers

Rajesh Banoth avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.