sncf 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/lib/sncf/api_client.rb +10 -8
- data/lib/sncf/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0ebb101165159e3c8179e93f18a4891e222b655
|
4
|
+
data.tar.gz: 96b4e851249d3686a9dc2ae3a1c269512e29c3bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a142907f567191d2d6828043feb4ec8f9cf172821368b4bf156c6b671d9d600413946c326063aea9f4642f3ec94dc3f88571feb40f3782447ba6edbc183543a2
|
7
|
+
data.tar.gz: c2f5c562650e5a118f769dde5a5d7a2955518ce1ff736c2913f25ee89b888682903689b7abb91bafc65c238287645ae74c2c33047e0524c53bc8544f55ef5256
|
data/README.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
#
|
1
|
+
# SNCF Open Data API Ruby wrapper
|
2
|
+
|
3
|
+
# This gem in currently in beta, it may contains bugs, do not use in production.
|
4
|
+
|
5
|
+
# 1.0.0 release is due to Fri, 03 Jul 2015
|
6
|
+
|
7
|
+
[![Gem Version](https://badge.fury.io/rb/sncf.svg)](http://badge.fury.io/rb/sncf)
|
2
8
|
|
3
9
|
Ruby gem to use easily the SNCF Open Data API with Ruby.
|
4
10
|
|
data/lib/sncf/api_client.rb
CHANGED
@@ -3,9 +3,9 @@ require 'oj'
|
|
3
3
|
|
4
4
|
module Sncf
|
5
5
|
class ApiClient
|
6
|
-
|
7
|
-
|
8
|
-
PLAN
|
6
|
+
BASE_URL = 'https://api.sncf.com'
|
7
|
+
VERSION_PATH = 'v1'
|
8
|
+
PLAN = {
|
9
9
|
name: 'Free',
|
10
10
|
limits: {
|
11
11
|
per_day: 3_000,
|
@@ -13,8 +13,6 @@ module Sncf
|
|
13
13
|
}
|
14
14
|
}
|
15
15
|
|
16
|
-
# => 3aa53f6d-13f1-486b-8a68-a781842cbe73
|
17
|
-
|
18
16
|
attr_reader :api_key
|
19
17
|
|
20
18
|
def initialize(api_key)
|
@@ -27,7 +25,10 @@ module Sncf
|
|
27
25
|
|
28
26
|
def quotas
|
29
27
|
@quotas ||= begin
|
30
|
-
{
|
28
|
+
{
|
29
|
+
per_day: PLAN[:limits][:per_day],
|
30
|
+
per_month: PLAN[:limits][:per_month]
|
31
|
+
}
|
31
32
|
end
|
32
33
|
end
|
33
34
|
|
@@ -45,9 +46,10 @@ module Sncf
|
|
45
46
|
|
46
47
|
def construct_formated_url(path, additional_params)
|
47
48
|
if additional_params.nil?
|
48
|
-
"#{
|
49
|
+
"#{BASE_URL}/#{VERSION_PATH}/#{path}"
|
49
50
|
else
|
50
|
-
"#{
|
51
|
+
"#{BASE_URL}/#{VERSION_PATH}/#{path}?#{additional_params.to_query}"
|
51
52
|
end
|
53
|
+
end
|
52
54
|
end
|
53
55
|
end
|
data/lib/sncf/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sncf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rémi Delhaye
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|