apis-is 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/Gemfile +14 -0
- data/LICENSE.txt +22 -0
- data/README.md +63 -0
- data/Rakefile +9 -0
- data/apis-is.gemspec +25 -0
- data/examples/bus_example.rb +27 -0
- data/examples/car_example.rb +27 -0
- data/examples/cinema_example.rb +32 -0
- data/examples/company_example.rb +23 -0
- data/examples/currency_example.rb +25 -0
- data/examples/cyclecounter_example.rb +20 -0
- data/examples/earthquake_example.rb +23 -0
- data/examples/flights_example.rb +25 -0
- data/examples/lottery_example.rb +23 -0
- data/examples/particulates_example.rb +21 -0
- data/examples/tv_example.rb +37 -0
- data/examples/weather_example.rb +34 -0
- data/lib/apis.rb +109 -0
- data/lib/apis/client.rb +30 -0
- data/lib/apis/endpoints/bus.rb +15 -0
- data/lib/apis/endpoints/cars.rb +14 -0
- data/lib/apis/endpoints/cinema.rb +22 -0
- data/lib/apis/endpoints/companies.rb +38 -0
- data/lib/apis/endpoints/currency.rb +27 -0
- data/lib/apis/endpoints/cyclecounter.rb +14 -0
- data/lib/apis/endpoints/earthquake.rb +13 -0
- data/lib/apis/endpoints/flights.rb +24 -0
- data/lib/apis/endpoints/lottery.rb +27 -0
- data/lib/apis/endpoints/particulates.rb +13 -0
- data/lib/apis/endpoints/tv.rb +69 -0
- data/lib/apis/endpoints/weather.rb +37 -0
- data/lib/apis/response/feed_parser.rb +16 -0
- data/lib/apis/version.rb +6 -0
- data/spec/fixtures/bus_all.yml +216 -0
- data/spec/fixtures/bus_selective.yml +82 -0
- data/spec/fixtures/car.yml +53 -0
- data/spec/fixtures/cinema_showtimes.yml +319 -0
- data/spec/fixtures/cinema_theaters.yml +192 -0
- data/spec/fixtures/companies_by_address.yml +141 -0
- data/spec/fixtures/companies_by_name.yml +84 -0
- data/spec/fixtures/companies_by_socialnumber.yml +50 -0
- data/spec/fixtures/companies_by_vsknr.yml +50 -0
- data/spec/fixtures/currency_arion.yml +83 -0
- data/spec/fixtures/currency_lb.yml +104 -0
- data/spec/fixtures/currency_m5.yml +77 -0
- data/spec/fixtures/cyclecounter.yml +50 -0
- data/spec/fixtures/earthquake.yml +1311 -0
- data/spec/fixtures/flights_arrivals.yml +269 -0
- data/spec/fixtures/flights_departure.yml +247 -0
- data/spec/fixtures/lottery_eurojackpot.yml +57 -0
- data/spec/fixtures/lottery_lotto.yml +57 -0
- data/spec/fixtures/lottery_vikingalotto.yml +57 -0
- data/spec/fixtures/particulates.yml +49 -0
- data/spec/fixtures/tv_ruv.yml +380 -0
- data/spec/fixtures/tv_ruvithrottir.yml +47 -0
- data/spec/fixtures/tv_skjar1.yml +317 -0
- data/spec/fixtures/tv_stod2.yml +491 -0
- data/spec/fixtures/tv_stod2bio.yml +217 -0
- data/spec/fixtures/tv_stod2gull.yml +284 -0
- data/spec/fixtures/tv_stod2sport.yml +105 -0
- data/spec/fixtures/tv_stod2sport2.yml +118 -0
- data/spec/fixtures/tv_stod3.yml +301 -0
- data/spec/fixtures/weather_forecast.yml +215 -0
- data/spec/fixtures/weather_observations.yml +215 -0
- data/spec/fixtures/weather_texts.yml +79 -0
- data/spec/helper.rb +18 -0
- data/spec/specs/bus_spec.rb +17 -0
- data/spec/specs/car_spec.rb +10 -0
- data/spec/specs/cinema_spec.rb +19 -0
- data/spec/specs/company_spec.rb +40 -0
- data/spec/specs/currency_spec.rb +30 -0
- data/spec/specs/cyclecounter_spec.rb +10 -0
- data/spec/specs/earthquake_spec.rb +10 -0
- data/spec/specs/flights_spec.rb +22 -0
- data/spec/specs/lottery_spec.rb +30 -0
- data/spec/specs/particulates_spec.rb +10 -0
- data/spec/specs/tv_spec.rb +84 -0
- data/spec/specs/weather_spec.rb +31 -0
- metadata +205 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d65c7211a6102c167ded2302467bfb7935abf0ca
|
4
|
+
data.tar.gz: d1a788670490ff8e64ed2af0051b26f472929471
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 49886c482f42d6e29cd28d1fb56e74057a2a9c64944c3ddffbf8b332367f939484c1ac8225d993beee38e3a719a95b4313f802f0646ac88125480dbfa406025e
|
7
|
+
data.tar.gz: 64626b33878613947ae4fa70d33489127ccf03fbe34d57d643488d1788084b2f05f5b9f139d4760451d4abb11c85e55e29cea9096a553743523ec370d381745e
|
data/.gitignore
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
23
|
+
rubocop.*
|
24
|
+
.rubocop.*
|
25
|
+
reek.*
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Skuli Oskarsson
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
# # Ruby wrapper for the apis.is API
|
2
|
+
|
3
|
+
This gem wraps the apis.is API in a simple wrapper that is easy to use within your ruby projects
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
To install this gem you can either type:
|
8
|
+
|
9
|
+
gem install apis-is
|
10
|
+
|
11
|
+
in the terminal or you can add this to your gemfile
|
12
|
+
|
13
|
+
gem 'apis-is'
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
## Making requests
|
20
|
+
|
21
|
+
Using this wrapper is very simple, and you can use it for the following apis.is endpoints
|
22
|
+
|
23
|
+
+ Icelandic Bus System
|
24
|
+
+ Cars in Iceland
|
25
|
+
+ Icelandic cinema
|
26
|
+
+ Icelandic companies
|
27
|
+
+ Currency in relation to ISK
|
28
|
+
+ Bicyclecounter in Reykjavik
|
29
|
+
+ Earthquakes in Iceland
|
30
|
+
+ International flights in Iceland
|
31
|
+
+ Icelandic lottery
|
32
|
+
+ Particulates in Reykjavik
|
33
|
+
+ Icelandic Weather
|
34
|
+
+ Icelandic television schedules
|
35
|
+
|
36
|
+
## Ruby Example
|
37
|
+
```ruby
|
38
|
+
require 'apis'
|
39
|
+
|
40
|
+
# Fetch all active busses
|
41
|
+
response = Apis.busses
|
42
|
+
|
43
|
+
# prints out all active busses
|
44
|
+
puts response[:results]
|
45
|
+
|
46
|
+
# Fetch all busses by bus number
|
47
|
+
response = Apis.busses([1, 4, 14])
|
48
|
+
|
49
|
+
# prints out active busses number 1, 4 and 14
|
50
|
+
puts response[:results]
|
51
|
+
```
|
52
|
+
|
53
|
+
## Rails Example
|
54
|
+
```ruby
|
55
|
+
# in your Gemfile add
|
56
|
+
gem 'apis-is', require: 'apis'
|
57
|
+
|
58
|
+
# Then in your controller you can do
|
59
|
+
@response = Apis.busses
|
60
|
+
|
61
|
+
# And in your view file
|
62
|
+
<%= @response[:results] %>
|
63
|
+
```
|
data/Rakefile
ADDED
data/apis-is.gemspec
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'apis/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'apis-is'
|
8
|
+
spec.version = Apis::VERSION
|
9
|
+
spec.authors = ['Skuli Oskarsson']
|
10
|
+
spec.email = ['skuli@codeiak.io']
|
11
|
+
spec.summary = 'Ruby toolkit for the apis.is API'
|
12
|
+
spec.description = 'A simple API wrapper for the apis.is API'
|
13
|
+
spec.homepage = 'https://github.com/SkuliOskarsson/apis-is-gem'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($RS)
|
17
|
+
spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(/^spec\//)
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
22
|
+
|
23
|
+
spec.add_dependency 'faraday', '~> 0.9', '>= 0.9.0'
|
24
|
+
|
25
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Busses calls
|
4
|
+
#
|
5
|
+
# Apis.busses <- Fetches all active busses
|
6
|
+
# Apis.busses(Array) <- Fetches all busses by bus number
|
7
|
+
|
8
|
+
response = Apis.busses([1, 4, 14])
|
9
|
+
|
10
|
+
# prints out active busses number 1, 4 and 14
|
11
|
+
puts response[:results]
|
12
|
+
|
13
|
+
# Result:
|
14
|
+
# [
|
15
|
+
# {
|
16
|
+
# busNr: String,
|
17
|
+
# busses: [
|
18
|
+
# {
|
19
|
+
# unixTime: Integer,
|
20
|
+
# x: Float,
|
21
|
+
# y: Float,
|
22
|
+
# from: String,
|
23
|
+
# to: String
|
24
|
+
# }
|
25
|
+
# ]
|
26
|
+
# }
|
27
|
+
# ]
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Car calls
|
4
|
+
#
|
5
|
+
# Apis.car(string) <- Searches for car by number
|
6
|
+
|
7
|
+
response = Apis.car('SomeCarNumber')
|
8
|
+
|
9
|
+
# prints out all results
|
10
|
+
puts response[:results]
|
11
|
+
|
12
|
+
# Result:
|
13
|
+
# [
|
14
|
+
# {
|
15
|
+
# registryNumber: String,
|
16
|
+
# number: String,
|
17
|
+
# factoryNumber: String,
|
18
|
+
# type: String,
|
19
|
+
# subType: String,
|
20
|
+
# color: String,
|
21
|
+
# registeredAt: String,
|
22
|
+
# status: String,
|
23
|
+
# nextCheck: String,
|
24
|
+
# pollution: String,
|
25
|
+
# weight: String
|
26
|
+
# }
|
27
|
+
# ]
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Cinema calls
|
4
|
+
#
|
5
|
+
# Apis.cinema.showtimes <- Fetches all showtimes in iceland sorted by movies
|
6
|
+
# Apis.cinema.theaters <- Fetches all theaters in iceland
|
7
|
+
|
8
|
+
response = Apis.cinema.showtimes
|
9
|
+
|
10
|
+
# prints out all results
|
11
|
+
puts response[:results]
|
12
|
+
|
13
|
+
# Result:
|
14
|
+
# [
|
15
|
+
# {
|
16
|
+
# title: String,
|
17
|
+
# released: String,
|
18
|
+
# restricted: String,
|
19
|
+
# imdb: String,
|
20
|
+
# imdbLink: String,
|
21
|
+
# image: String,
|
22
|
+
# showtimes: [
|
23
|
+
# {
|
24
|
+
# theater: String,
|
25
|
+
# schedule: [
|
26
|
+
# String,
|
27
|
+
# String
|
28
|
+
# ]
|
29
|
+
# }
|
30
|
+
# ]
|
31
|
+
# }
|
32
|
+
# ]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Company calls
|
4
|
+
#
|
5
|
+
# Apis.companies.by_name(String) <- Fetches all active busses
|
6
|
+
# Apis.companies.by_address(String) <- Fetches all busses by bus number
|
7
|
+
# Apis.companies.by_sn(String) <- Fetches all active busses
|
8
|
+
# Apis.companies.by_vsknr(String) <- Fetches all busses by bus number
|
9
|
+
|
10
|
+
response = Apis.companies.by_name('SomeName')
|
11
|
+
|
12
|
+
# prints out all results
|
13
|
+
puts response[:results]
|
14
|
+
|
15
|
+
# Result:
|
16
|
+
# [
|
17
|
+
# {
|
18
|
+
# name: String,
|
19
|
+
# sn: String,
|
20
|
+
# active: Integer,
|
21
|
+
# address: String
|
22
|
+
# }
|
23
|
+
# ]
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Currency calls
|
4
|
+
#
|
5
|
+
# Apis.currency.m5 <- Get currency data from M5
|
6
|
+
# Apis.currency.arion <- Get currency data from Arion
|
7
|
+
# Apis.currency.lb <- Get currency data from Landsbankinn
|
8
|
+
|
9
|
+
response = Apis.currency.m5
|
10
|
+
|
11
|
+
# prints out all results
|
12
|
+
puts response[:results]
|
13
|
+
|
14
|
+
# Result:
|
15
|
+
# [
|
16
|
+
# {
|
17
|
+
# shortName: String,
|
18
|
+
# longName: String,
|
19
|
+
# value: Float,
|
20
|
+
# askValue: Integer,
|
21
|
+
# bidValue: Integer,
|
22
|
+
# changeCur: Float,
|
23
|
+
# changePer: Float
|
24
|
+
# }
|
25
|
+
# ]
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible CycleCounter calls
|
4
|
+
#
|
5
|
+
# Apis.cyclecounter <- Fetches data from the CycleCounter in Reykjavik
|
6
|
+
|
7
|
+
response = Apis.cyclecounter
|
8
|
+
|
9
|
+
# prints out all results
|
10
|
+
puts response[:results]
|
11
|
+
|
12
|
+
# Result:
|
13
|
+
# [
|
14
|
+
# {
|
15
|
+
# DayCount: String,
|
16
|
+
# YearCount: String,
|
17
|
+
# Time: String,
|
18
|
+
# Date: String
|
19
|
+
# }
|
20
|
+
# ]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Earthquake calls
|
4
|
+
#
|
5
|
+
# Apis.earthquake <- Fetches all earthquake activity from the last 48hours
|
6
|
+
|
7
|
+
response = Apis.earthquake
|
8
|
+
|
9
|
+
# prints out all results
|
10
|
+
puts response[:results]
|
11
|
+
|
12
|
+
# Result:
|
13
|
+
# [
|
14
|
+
# {
|
15
|
+
# timestamp: Date,
|
16
|
+
# latitude: Float,
|
17
|
+
# longitude: Float,
|
18
|
+
# depth: Float,
|
19
|
+
# size: Float,
|
20
|
+
# quality: Float,
|
21
|
+
# humanReadableLocation: String
|
22
|
+
# }
|
23
|
+
# ]
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Flights calls
|
4
|
+
#
|
5
|
+
# Apis.flights.departure(lang = 'is') <- Fetches all departure flights
|
6
|
+
# Apis.flights.arrivals(lang = 'is') <- Fetches all arrivals
|
7
|
+
|
8
|
+
response = Apis.flights.departure
|
9
|
+
|
10
|
+
# prints out all results
|
11
|
+
puts response[:results]
|
12
|
+
|
13
|
+
# Result:
|
14
|
+
# [
|
15
|
+
# {
|
16
|
+
# date: String,
|
17
|
+
# flightNumber: String,
|
18
|
+
# airline: String,
|
19
|
+
# from: String,
|
20
|
+
# plannedArrival: String,
|
21
|
+
# realArrival: String,
|
22
|
+
# status: String,
|
23
|
+
# to: String
|
24
|
+
# }
|
25
|
+
# ]
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Lottery calls
|
4
|
+
#
|
5
|
+
# Apis.lottery.lotto <- Fetch all lotto results
|
6
|
+
# Apis.lottery.vikingalotto <- Fetch all vikingalotto results
|
7
|
+
# Apis.lottery.eurojackpot <- Fetch all eurojackpot results
|
8
|
+
|
9
|
+
response = Apis.lottery.lotto
|
10
|
+
|
11
|
+
# prints out all results
|
12
|
+
puts response[:results]
|
13
|
+
|
14
|
+
# Result:
|
15
|
+
# [
|
16
|
+
# {
|
17
|
+
# date:String,
|
18
|
+
# lotto:String,
|
19
|
+
# joker:String,
|
20
|
+
# prize:String,
|
21
|
+
# link:String
|
22
|
+
# }
|
23
|
+
# ]
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'apis'
|
2
|
+
|
3
|
+
# Possible Particulates calls
|
4
|
+
#
|
5
|
+
# Apis.particulates <- Get Particulates data in Reykjavik
|
6
|
+
|
7
|
+
response = Apis.particulates
|
8
|
+
|
9
|
+
# prints out all results
|
10
|
+
puts response[:results]
|
11
|
+
|
12
|
+
# Result:
|
13
|
+
# [
|
14
|
+
# {
|
15
|
+
# PM10nuna: String,
|
16
|
+
# PM10medaltal: String,
|
17
|
+
# Counter: String,
|
18
|
+
# Dags: String,
|
19
|
+
# nanariuppl: String
|
20
|
+
# }
|
21
|
+
# ]
|