Sha256: 516301660157feaede9417e95a26f57d68a4f27d26dec64ce73e9c23d4729f20

Contents?: true

Size: 1.65 KB

Versions: 2

Compression:

Stored size: 1.65 KB

Contents

Yet Another NS API [![Build Status](https://travis-ci.org/stefanhendriks/ns-api.png?branch=master)](https://travis-ci.org/stefanhendriks/ns-api) [![Coverage Status](https://coveralls.io/repos/stefanhendriks/ns-api/badge.png)](https://coveralls.io/r/stefanhendriks/ns-api)
==================
A Ruby client for the NS API.

Goal
====
I'd like to write a comprehensive, yet very thin implementation of the NS API. For now I have limited access therefor this gem is limited.

If you have credentials that work with the prices-api calls, and are willing to share them with me so I can expand this gem. Please contact me.

You can also send me an example response, so I can work from there. Although I would like to see it working for real as well.

Pull requests are welcome.

Usage
=====
First, make sure you have a username and password from the NS API website. (at: http://www.ns.nl/api)

You can use the NSYAPI singleton, you can configure it by using a configuration block:
```ruby
require 'ns_client'

NSYapi::configure do |config|
  config.username = "some-username"
  config.password = "some-password"
end

client = NSYapi::client

client.stations
```

or, you can instantiate the NSClient yourself, providing a username and password. You can then regulate the instance yourself.

```ruby
require 'ns_client'

# get username/password from NS site
client = NSClient.new("my-username", "my-password")

```

After you have created a client, you can use it for several operations

Retrieve all stations
=====================

```ruby
# get all known stations
stations = client.stations
station = stations.first
station.name # 's-Hertogenbosch
station.lat # 51.69048
station.long # 5.29362
```

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ns-yapi-0.1.2 README.md
ns-yapi-0.1.1 README.md