kvv-liveapi 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fa8d1e2ba1e608f32e6eddc0a3bc47dc489ac8f1818a6071e5f217fdd5d37ab8
4
- data.tar.gz: 61e669c130154bcb1aee0c7d96cb573b3c80261eba0a520627079b63794cd4ac
3
+ metadata.gz: 8760c14231f6e30c643943b5ea3a4d2f1c17a874e8e0a8227406a08d389e20e3
4
+ data.tar.gz: 7e01d427ef3baada33488a12147a47f5a9e9718f4aaca1f0fc805cfb4c0d0741
5
5
  SHA512:
6
- metadata.gz: 77169131ecf884d796b78953a760e60923ee49a4cc659fa303bdb691a0504fc780801c4899428564144bf8f8179f01f7035812eb2f278889674eea1cba561dbf
7
- data.tar.gz: 15ce5b5371fc02412e9703756c04e67f437efb53173052bac8c18270bc8b11002a82ed3ab7d08d0255cb793520c42060ebfb5a01717437bfd307fa85c0823282
6
+ metadata.gz: 3de0535451bf3314c606b13b9b087b311cda706e6204467e4e34376f0d131cec5dbf0d013859b9144c3dd44bce69c6aadcb3b5e9a9c4503661a63d703613bad1
7
+ data.tar.gz: 5f7d14f21a95d7234f5addad8c34275defc45ee3a13459172d23fc83dccb70a8c0383b05309eba3d318863d7355b8d4a3ea6f01b34f6841669f04a34e1d03021
data/Gemfile CHANGED
@@ -2,34 +2,5 @@ source "https://rubygems.org"
2
2
 
3
3
  gemspec
4
4
 
5
- git_source(:github) do |repo_name|
6
- repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
7
- "https://github.com/#{repo_name}.git"
8
- end
9
-
10
- group :development, :test do
11
- # Call 'byebug' anywhere in the code to stop execution and get a debugger console
12
- gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
13
- end
14
-
15
- group :development do
16
- gem 'listen', '>= 3.0.5', '< 3.2'
17
- # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
18
- gem 'spring'
19
- gem 'spring-watcher-listen', '~> 2.0.0'
20
- end
21
-
22
- group :test do
23
- # gem 'minitest', '5.10.3'
24
- # # gem 'minitest-rails'
25
- # gem 'minitest-spec-context'
26
- # gem 'minitest-matchers'
27
- # gem 'minitest-reporters'
28
- # gem 'webmock'
29
- # gem 'vcr'
30
- # gem "minitest-vcr"
31
- # gem 'simplecov'
32
- end
33
-
34
5
  # Windows does not include zoneinfo files, so bundle the tzinfo-data gem
35
6
  gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
data/README.md CHANGED
@@ -44,8 +44,6 @@ TODO: Explain details where not obvious
44
44
 
45
45
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
46
46
 
47
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
48
-
49
47
  ## Contributing
50
48
 
51
49
  Bug reports and pull requests are welcome on GitHub at https://github.com/buggle/kvv-liveapi.
data/Rakefile CHANGED
@@ -6,7 +6,5 @@ Rake::TestTask.new(:test) do |t|
6
6
  t.libs << "test"
7
7
  t.libs << "lib"
8
8
  t.test_files = FileList["test/**/*_test.rb"]
9
- t.verbose = true
9
+ # t.verbose = true
10
10
  end
11
-
12
- task :default => :test
@@ -7,6 +7,8 @@ require "kvv/liveapi/version"
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = "kvv-liveapi"
9
9
  spec.version = KVV::Liveapi::VERSION
10
+ spec.licenses = ['MIT']
11
+
10
12
  spec.authors = ["Christian Buggle"]
11
13
  spec.email = ["christian@buggle.net"]
12
14
 
@@ -30,5 +32,9 @@ Gem::Specification.new do |spec|
30
32
  spec.add_development_dependency "minitest-reporters", "~> 1.1"
31
33
  spec.add_development_dependency 'webmock', '~> 3.3'
32
34
  spec.add_development_dependency "simplecov", '~> 0.15'
35
+
36
+ spec.add_development_dependency 'listen', '>= 3.0.5', '< 3.2'
37
+ spec.add_development_dependency 'spring', '~> 2.0'
38
+ spec.add_development_dependency 'spring-watcher-listen', '~> 2.0'
33
39
  end
34
40
 
@@ -7,10 +7,10 @@ module KVV
7
7
  API_KEY = '?key=377d840e54b59adbe53608ba1aad70e8'
8
8
  API_BASE = 'https://live.kvv.de/webapp/'
9
9
 
10
- URL_PATH_STOPS_BY_NAME = 'stops/byname/'
11
- URL_PATH_DEPARTURES_BY_STOP = 'departures/bystop/'
12
- URL_PATH_DEPARTURES_BY_LATLON = 'stops/bylatlon/'
13
- URL_PATH_DEPARTURES_BY_ROUTE = 'departures/byroute/'
10
+ URL_PATH_STOPS_BY_NAME = [ 'stops', 'byname']
11
+ URL_PATH_DEPARTURES_BY_STOP = ['departures', 'bystop']
12
+ URL_PATH_DEPARTURES_BY_LATLON = ['stops', 'bylatlon']
13
+ URL_PATH_DEPARTURES_BY_ROUTE = ['departures', 'byroute']
14
14
 
15
15
  def self.departures_bystop_name name
16
16
  self.departures_bystop guess_stop_id_by_name(name)
@@ -23,7 +23,7 @@ module KVV
23
23
 
24
24
  def self.departures_by_route route: nil, stop_id: nil
25
25
  return {} unless route && stop_id
26
- fetch_api_path [URL_PATH_DEPARTURES_BY_ROUTE, route, "/", stop_id]
26
+ fetch_api_path [URL_PATH_DEPARTURES_BY_ROUTE, route, stop_id]
27
27
  end
28
28
 
29
29
  def self.stops_by_name name
@@ -34,14 +34,15 @@ module KVV
34
34
 
35
35
  def self.stops_by_latlon lat: nil, lon: nil
36
36
  return [] unless lat && lon
37
- response = fetch_api_path [URL_PATH_DEPARTURES_BY_LATLON, lat, "/", lon]
37
+ response = fetch_api_path [URL_PATH_DEPARTURES_BY_LATLON, String(lat), String(lon)]
38
38
  response["stops"] || {}
39
39
  end
40
40
 
41
41
  private
42
42
 
43
43
  def self.fetch_api_path *path
44
- fetch [API_BASE, path, API_KEY].join
44
+ path = [ path ].flatten.map{ |p| CGI.escape p }.join("/")
45
+ fetch [API_BASE, path , API_KEY].join
45
46
  end
46
47
 
47
48
  def self.fetch url
@@ -1,5 +1,5 @@
1
1
  module KVV
2
2
  class Liveapi
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kvv-liveapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christian Buggle
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-02-13 00:00:00.000000000 Z
11
+ date: 2018-04-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,6 +108,54 @@ dependencies:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0.15'
111
+ - !ruby/object:Gem::Dependency
112
+ name: listen
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ">="
116
+ - !ruby/object:Gem::Version
117
+ version: 3.0.5
118
+ - - "<"
119
+ - !ruby/object:Gem::Version
120
+ version: '3.2'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ">="
126
+ - !ruby/object:Gem::Version
127
+ version: 3.0.5
128
+ - - "<"
129
+ - !ruby/object:Gem::Version
130
+ version: '3.2'
131
+ - !ruby/object:Gem::Dependency
132
+ name: spring
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '2.0'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '2.0'
145
+ - !ruby/object:Gem::Dependency
146
+ name: spring-watcher-listen
147
+ requirement: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '2.0'
152
+ type: :development
153
+ prerelease: false
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: '2.0'
111
159
  description: A simple adapter to query the KVV API (Karlsruher Verkehrsverbund - Karlsruhe
112
160
  Transport Agency) for live timetable data and stop information
113
161
  email:
@@ -128,7 +176,8 @@ files:
128
176
  - lib/kvv/liveapi.rb
129
177
  - lib/kvv/liveapi/version.rb
130
178
  homepage: https://github.com//kvv-liveapi
131
- licenses: []
179
+ licenses:
180
+ - MIT
132
181
  metadata: {}
133
182
  post_install_message:
134
183
  rdoc_options: []