https://github.com/peterhellberg/riksteatern
Ruby client for the Riksteatern API
https://github.com/peterhellberg/riksteatern
Last synced: 12 months ago
JSON representation
Ruby client for the Riksteatern API
- Host: GitHub
- URL: https://github.com/peterhellberg/riksteatern
- Owner: peterhellberg
- License: mit
- Created: 2013-03-15T09:32:42.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2013-03-19T22:08:16.000Z (almost 13 years ago)
- Last Synced: 2025-02-14T15:04:35.887Z (12 months ago)
- Language: Ruby
- Size: 133 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Riksteatern
A small Ruby client for the Riksteatern API.
You can find out more about the API (In Swedish) on [http://data.riksteatern.se/](http://data.riksteatern.se/).
[](https://travis-ci.org/peterhellberg/riksteatern)
[](http://badge.fury.io/rb/riksteatern)
## Dependencies
No runtime dependencies. Bundler, Rake and Minitest are required for development.
## Installation
Add this line to your application's Gemfile:
gem 'riksteatern'
And then execute:
$ bundle
Or install it yourself as:
$ gem install riksteatern
## Usage
*You need to be authenticated to use the API.*
**Access request: [http://data.riksteatern.se/ansokan/](http://data.riksteatern.se/ansokan/)**
```ruby
Riksteatern.account('', '')
```
Now you are ready to start fetching data :)
```ruby
# Find an event by id
e = Riksteatern::Event.find(992423)
e.name #=> "En mans föreställning"
# Number of events in Stockholms län
Riksteatern::Event.all(regionName: 'Stockholms län').size #=> 46
# Find a venue by id
v = Riksteatern::Venue.find(2260101)
## The region name of the location
v.location.region #=> "Västernorrlands län"
## Print the address of the venue
puts v.address
# Find a production by id
p = Riksteatern::Production.find(42)
## Get the number of pictures
p.pictures.size #=> 4
## Get the categories of the production
p.categories #=> ["Barn/Skola", "Teater", "Mim", "Musikteater"]
```
You might also want to take a look at the `specs`
## Suggestions for improving the API
* Correct the spelling of `accesibility` *sic*
* Change `category` to `categories` since it is a list
* Upper limit on how many results to return
* Pagination of results
## Contributing
1. Fork it
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 new Pull Request