ns-api 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/Gemfile +9 -0
- data/Gemfile.lock +40 -0
- data/README.md +82 -0
- data/Rakefile +1 -0
- data/lib/ns.rb +29 -0
- data/lib/ns/api/request/base.rb +58 -0
- data/lib/ns/api/request/disruption_collection.rb +30 -0
- data/lib/ns/api/request/travel_advice.rb +34 -0
- data/lib/ns/api/response/disruption_collection.rb +58 -0
- data/lib/ns/api/response/parser.rb +22 -0
- data/lib/ns/api/response/travel_advice.rb +46 -0
- data/lib/ns/configuration.rb +14 -0
- data/lib/ns/disruption.rb +26 -0
- data/lib/ns/disruption_collection.rb +45 -0
- data/lib/ns/model.rb +13 -0
- data/lib/ns/station.rb +8 -0
- data/lib/ns/travel_option.rb +28 -0
- data/lib/ns/trip.rb +80 -0
- data/lib/version.rb +3 -0
- data/ns.gemspec +24 -0
- data/spec/fixtures/ns_disruptions_no_results.xml +10 -0
- data/spec/fixtures/ns_disruptions_with_results.xml +23 -0
- data/spec/fixtures/ns_travel_advice_response.xml +2444 -0
- data/spec/ns/api/request/base_spec.rb +67 -0
- data/spec/ns/api/request/disruption_collection_spec.rb +34 -0
- data/spec/ns/api/request/travel_advice_spec.rb +53 -0
- data/spec/ns/api/response/disruption_collection_spec.rb +43 -0
- data/spec/ns/api/response/parser_spec.rb +17 -0
- data/spec/ns/api/response/travel_advice_spec.rb +61 -0
- data/spec/ns/disruption_collection_spec.rb +32 -0
- data/spec/ns/disruption_spec.rb +33 -0
- data/spec/ns/station_spec.rb +11 -0
- data/spec/ns/travel_option_spec.rb +41 -0
- data/spec/ns/trip_spec.rb +85 -0
- data/spec/ns_spec.rb +17 -0
- data/spec/spec_helper.rb +19 -0
- metadata +147 -0
data/spec/ns_spec.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Ns do
|
4
|
+
|
5
|
+
let(:configuration) { Ns::Configuration.new }
|
6
|
+
|
7
|
+
it 'should be configurable' do
|
8
|
+
Ns.configure do |config|
|
9
|
+
config.username = 'john'
|
10
|
+
config.password = 'secret'
|
11
|
+
end
|
12
|
+
|
13
|
+
Ns.configuration.username.should == 'john'
|
14
|
+
Ns.configuration.password.should == 'secret'
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
|
4
|
+
require 'fakeweb'
|
5
|
+
FakeWeb.allow_net_connect = false
|
6
|
+
|
7
|
+
require 'httpi'
|
8
|
+
|
9
|
+
spec_helper = Pathname.new(__FILE__).realpath
|
10
|
+
lib_path = File.expand_path("../../lib", spec_helper)
|
11
|
+
$:.unshift(lib_path)
|
12
|
+
|
13
|
+
$ROOT = File.expand_path("../", lib_path)
|
14
|
+
|
15
|
+
require 'ns/model'
|
16
|
+
|
17
|
+
Dir.glob(File.join(lib_path, '/**/*.rb')).each do |file|
|
18
|
+
require file
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,147 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ns-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Marcel de Graaf
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-20 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httpi
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: nori
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: nokogiri
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
description: A Ruby implementation of the NS (Dutch Railways) API
|
63
|
+
email:
|
64
|
+
- mail@marceldegraaf.net
|
65
|
+
executables: []
|
66
|
+
extensions: []
|
67
|
+
extra_rdoc_files: []
|
68
|
+
files:
|
69
|
+
- .gitignore
|
70
|
+
- Gemfile
|
71
|
+
- Gemfile.lock
|
72
|
+
- README.md
|
73
|
+
- Rakefile
|
74
|
+
- lib/ns.rb
|
75
|
+
- lib/ns/api/request/base.rb
|
76
|
+
- lib/ns/api/request/disruption_collection.rb
|
77
|
+
- lib/ns/api/request/travel_advice.rb
|
78
|
+
- lib/ns/api/response/disruption_collection.rb
|
79
|
+
- lib/ns/api/response/parser.rb
|
80
|
+
- lib/ns/api/response/travel_advice.rb
|
81
|
+
- lib/ns/configuration.rb
|
82
|
+
- lib/ns/disruption.rb
|
83
|
+
- lib/ns/disruption_collection.rb
|
84
|
+
- lib/ns/model.rb
|
85
|
+
- lib/ns/station.rb
|
86
|
+
- lib/ns/travel_option.rb
|
87
|
+
- lib/ns/trip.rb
|
88
|
+
- lib/version.rb
|
89
|
+
- ns.gemspec
|
90
|
+
- spec/fixtures/ns_disruptions_no_results.xml
|
91
|
+
- spec/fixtures/ns_disruptions_with_results.xml
|
92
|
+
- spec/fixtures/ns_travel_advice_response.xml
|
93
|
+
- spec/ns/api/request/base_spec.rb
|
94
|
+
- spec/ns/api/request/disruption_collection_spec.rb
|
95
|
+
- spec/ns/api/request/travel_advice_spec.rb
|
96
|
+
- spec/ns/api/response/disruption_collection_spec.rb
|
97
|
+
- spec/ns/api/response/parser_spec.rb
|
98
|
+
- spec/ns/api/response/travel_advice_spec.rb
|
99
|
+
- spec/ns/disruption_collection_spec.rb
|
100
|
+
- spec/ns/disruption_spec.rb
|
101
|
+
- spec/ns/station_spec.rb
|
102
|
+
- spec/ns/travel_option_spec.rb
|
103
|
+
- spec/ns/trip_spec.rb
|
104
|
+
- spec/ns_spec.rb
|
105
|
+
- spec/spec_helper.rb
|
106
|
+
homepage: https://github.com/marceldegraaf/ns
|
107
|
+
licenses: []
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options: []
|
110
|
+
require_paths:
|
111
|
+
- lib
|
112
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
114
|
+
requirements:
|
115
|
+
- - ! '>='
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
|
+
none: false
|
120
|
+
requirements:
|
121
|
+
- - ! '>='
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: '0'
|
124
|
+
requirements: []
|
125
|
+
rubyforge_project:
|
126
|
+
rubygems_version: 1.8.23
|
127
|
+
signing_key:
|
128
|
+
specification_version: 3
|
129
|
+
summary: A Ruby implementation of the NS (Dutch Railways) API
|
130
|
+
test_files:
|
131
|
+
- spec/fixtures/ns_disruptions_no_results.xml
|
132
|
+
- spec/fixtures/ns_disruptions_with_results.xml
|
133
|
+
- spec/fixtures/ns_travel_advice_response.xml
|
134
|
+
- spec/ns/api/request/base_spec.rb
|
135
|
+
- spec/ns/api/request/disruption_collection_spec.rb
|
136
|
+
- spec/ns/api/request/travel_advice_spec.rb
|
137
|
+
- spec/ns/api/response/disruption_collection_spec.rb
|
138
|
+
- spec/ns/api/response/parser_spec.rb
|
139
|
+
- spec/ns/api/response/travel_advice_spec.rb
|
140
|
+
- spec/ns/disruption_collection_spec.rb
|
141
|
+
- spec/ns/disruption_spec.rb
|
142
|
+
- spec/ns/station_spec.rb
|
143
|
+
- spec/ns/travel_option_spec.rb
|
144
|
+
- spec/ns/trip_spec.rb
|
145
|
+
- spec/ns_spec.rb
|
146
|
+
- spec/spec_helper.rb
|
147
|
+
has_rdoc:
|