Skip to content

dirble/dirble-api-ruby

This branch is 3 commits ahead of Lackoftactics/dirble:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Håkan Nylén
Jul 20, 2015
bf3cf9a · Jul 20, 2015

History

45 Commits
Jul 20, 2015
Dec 19, 2014
Dec 5, 2014
Dec 4, 2014
Dec 4, 2014
Dec 4, 2014
Dec 29, 2014
Dec 4, 2014
Dec 4, 2014
Jul 20, 2015
Dec 19, 2014
Dec 19, 2014

Repository files navigation

Code Climate Build Status Coverage Status

Dirble

Gem to make interacting with http://api.dirble.com/ amazingly easy. Using familiar Rails syntax. It uses Faraday and Typhoeus as adapter.

Compatibility

  • Ruby 1.9.3 and 2
  • Rubinius

Installation

Add this line to your application's Gemfile:

gem 'dirble'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dirble

Usage

In Rails: Put this quick configuration block in environment file. Beyond Rails: Put this in initialization or config file.

Dirble.configure do |config|
  config.api_key = "valid_api_key_from_dirble"
end

Now you are ready to go.

Category

  • Fetch all categories with

    Dirble::Category.all

  • Fetch primary categories with

    Dirble::Category.primary or Dirble::PrimaryCategory.all

  • Find category by id

    Dirble::Category.find(2)

  • Get first category

    Dirble::Category.first

  • Find children of primary category

  primary_category = Dirble::PrimaryCategory.first
  children = primary_category.children
  • Find stations of category

    category.stations

  • Category details

  category.id
  category.name
  category.description

Station

  • Search stations

    Dirble::Station.search('pop')

  • Stations by continent

    Dirble::Station.by_continent('Asia')

  • Stations by country using iso code

    Dirble::Station.by_country('us')

  • Stations by country name

    Dirbel::Station.by_country_name('United States')

  • Find station by id

    Dirble::Station.find(100)

  • Get similar stations

    Dirble::Station.similar(100)

  • Station details

station.name
station.website
station.bitrate
station.directory
station.description
station.stream_url
station.status
  • Accessing song history by station, information available only after Dirble::Station.find(id)

    station.song_history

Song

Songs in song history have many interesting informations.

  • Name and title

    song.name song.title

  • Spotify url

    song.spotify_url

  • When last played on particular station

    song.played_on

Coming features

  • Add parallel connections with Typhoeus

Contributing

  1. Fork it ( https://github.com/[my-github-username]/dirble/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

About

radio directory api

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%