bus-o-matic 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +17 -0
- data/.travis.yml +19 -0
- data/Gemfile +2 -0
- data/README.md +3 -1
- data/Rakefile +8 -2
- data/bus-o-matic.gemspec +11 -3
- data/lib/bus-o-matic.rb +4 -3
- data/spec/bus-o-matic_spec.rb +65 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/vehicles.xml +22 -0
- metadata +66 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 936a143045e6ff73ce2be0bcc7317d256bed228c
|
4
|
+
data.tar.gz: 56d6896c23dc66050685af758ade0e4bfe6988b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fb56cba3aef288c72fdc089c0b751e6bfe50a920a107e92b4d06119a2c7380052d9468b89a4dca64bc3ec7b4d1e9318ffeb2a6503ae9afc323410f0092bbfc2e
|
7
|
+
data.tar.gz: d1b94aba2552af9c5f71a20abac9ff0b5d343e4f45b7a482bf6134c39e0ee0cca2fe21c1d5a6a8b6993e73854de3d4ce4f02a7c271e752996da6fa4f2703b9d0
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
language: ruby
|
2
|
+
cache: bundler
|
3
|
+
|
4
|
+
rvm:
|
5
|
+
- jruby
|
6
|
+
- 2.0.0
|
7
|
+
|
8
|
+
script: 'bundle exec rake'
|
9
|
+
|
10
|
+
addons:
|
11
|
+
code_climate:
|
12
|
+
repo_token: 2468f6cea21cd23734103a0f4f3bd595d828122daf7fb1b5bd15af2daf07d724
|
13
|
+
|
14
|
+
notifications:
|
15
|
+
email:
|
16
|
+
recipients:
|
17
|
+
- matt@macinstruct.com
|
18
|
+
on_failure: change
|
19
|
+
on_success: never
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
# Bus-o-matic
|
2
2
|
|
3
|
-
[![Code Climate](https://codeclimate.com/
|
3
|
+
[![Code Climate](https://codeclimate.com/github/mattcone/bus-o-matic/badges/gpa.svg)](https://codeclimate.com/github/mattcone/bus-o-matic)
|
4
4
|
[![Dependency Status](https://gemnasium.com/mattcone/bus-o-matic.svg)](https://gemnasium.com/mattcone/bus-o-matic)
|
5
5
|
[![Gem Version](https://badge.fury.io/rb/bus-o-matic.svg)](http://badge.fury.io/rb/bus-o-matic)
|
6
|
+
[![Build Status](https://travis-ci.org/mattcone/bus-o-matic.svg?branch=master)](https://travis-ci.org/mattcone/bus-o-matic)
|
7
|
+
[![Test Coverage](https://codeclimate.com/github/mattcone/bus-o-matic/badges/coverage.svg)](https://codeclimate.com/github/mattcone/bus-o-matic)
|
6
8
|
|
7
9
|
Bus-o-matic is a simple Ruby wrapper for the [Pittsburgh Port Authority API]
|
8
10
|
(http://www.portauthority.org/paac/CompanyInfoProjects/DeveloperResources.aspx).
|
data/Rakefile
CHANGED
data/bus-o-matic.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
|
3
3
|
s.name = "bus-o-matic"
|
4
|
-
s.version = "0.0.
|
4
|
+
s.version = "0.0.5"
|
5
5
|
s.authors = ["Matt Cone"]
|
6
6
|
s.email = ["matt@macinstruct.com"]
|
7
7
|
s.summary = %q{A wrapper for the Pittsburgh Port Authority TrueTime Bus API}
|
@@ -11,7 +11,15 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.platform = Gem::Platform::RUBY
|
12
12
|
|
13
13
|
s.require_paths = ['lib']
|
14
|
-
s.files
|
14
|
+
s.files = `git ls-files`.split("\n")
|
15
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
16
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
17
|
+
|
15
18
|
s.add_dependency "httparty", '~> 0.13.3'
|
16
|
-
s.add_dependency "hashie", '~> 3.
|
19
|
+
s.add_dependency "hashie", '~> 3.4'
|
20
|
+
|
21
|
+
s.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
s.add_development_dependency "rake"
|
23
|
+
s.add_development_dependency "minitest"
|
24
|
+
s.add_development_dependency "minitest-reporters"
|
17
25
|
end
|
data/lib/bus-o-matic.rb
CHANGED
@@ -82,7 +82,7 @@ module PIT
|
|
82
82
|
options.merge!({
|
83
83
|
:key => @@key
|
84
84
|
})
|
85
|
-
options[
|
85
|
+
options[:pid] = options[:pid].join(',') if options[:pid].kind_of?(Array)
|
86
86
|
|
87
87
|
response = get("/getpatterns", :query => options)['bustime_response']
|
88
88
|
check_for_errors response['error']
|
@@ -110,8 +110,8 @@ module PIT
|
|
110
110
|
options.merge!({
|
111
111
|
:key => @@key
|
112
112
|
})
|
113
|
-
options[
|
114
|
-
options[
|
113
|
+
options[:rt] = options[:rt].join(',') if options[:rt].kind_of?(Array)
|
114
|
+
options[:stpid] = options[:stpid].join(',') if options[:stpid].kind_of?(Array)
|
115
115
|
|
116
116
|
response = get("/getservicebulletins", :query => options)['bustime_response']
|
117
117
|
check_for_errors response['error']
|
@@ -129,5 +129,6 @@ module PIT
|
|
129
129
|
def self.check_for_errors(error)
|
130
130
|
puts "API ERROR: #{error['msg']}" if error
|
131
131
|
end
|
132
|
+
|
132
133
|
end
|
133
134
|
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require_relative 'spec_helper'
|
2
|
+
|
3
|
+
describe PIT::Busomatic do
|
4
|
+
|
5
|
+
describe "default attributes" do
|
6
|
+
|
7
|
+
it "must include httparty methods" do
|
8
|
+
PIT::Busomatic.must_include HTTParty
|
9
|
+
end
|
10
|
+
|
11
|
+
it "must have the base url set to the Port Authority API endpoint" do
|
12
|
+
PIT::Busomatic.base_uri.must_equal 'http://realtime.portauthority.org/bustime/api/v2'
|
13
|
+
end
|
14
|
+
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "check methods" do
|
18
|
+
|
19
|
+
it "must have a system time method" do
|
20
|
+
PIT::Busomatic.must_respond_to :time
|
21
|
+
end
|
22
|
+
|
23
|
+
it "must have a vehicles method" do
|
24
|
+
PIT::Busomatic.must_respond_to :vehicles
|
25
|
+
end
|
26
|
+
|
27
|
+
it "must have a routes method" do
|
28
|
+
PIT::Busomatic.must_respond_to :routes
|
29
|
+
end
|
30
|
+
|
31
|
+
it "must have a directions method" do
|
32
|
+
PIT::Busomatic.must_respond_to :directions
|
33
|
+
end
|
34
|
+
|
35
|
+
it "must have a stops method" do
|
36
|
+
PIT::Busomatic.must_respond_to :stops
|
37
|
+
end
|
38
|
+
|
39
|
+
it "must have a patterns method" do
|
40
|
+
PIT::Busomatic.must_respond_to :patterns
|
41
|
+
end
|
42
|
+
|
43
|
+
it "must have a predictions method" do
|
44
|
+
PIT::Busomatic.must_respond_to :predictions
|
45
|
+
end
|
46
|
+
|
47
|
+
it "must have a bulletins method" do
|
48
|
+
PIT::Busomatic.must_respond_to :bulletins
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
|
56
|
+
|
57
|
+
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Let's get coverage reporting from Codeclimate
|
2
|
+
require "codeclimate-test-reporter"
|
3
|
+
CodeClimate::TestReporter.start
|
4
|
+
|
5
|
+
require 'minitest/autorun'
|
6
|
+
require "minitest/reporters"
|
7
|
+
Minitest::Reporters.use!
|
8
|
+
|
9
|
+
# We need the actual library file
|
10
|
+
require_relative '../lib/bus-o-matic.rb'
|
data/spec/vehicles.xml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<bustime-response>
|
3
|
+
|
4
|
+
<vehicle>
|
5
|
+
<vid>5520</vid>
|
6
|
+
<tmstmp>20150201 14:44</tmstmp>
|
7
|
+
<lat>40.478137559157155</lat>
|
8
|
+
<lon>-80.03134366548979</lon>
|
9
|
+
<hdg>201</hdg>
|
10
|
+
<pid>2227</pid>
|
11
|
+
<rt>16</rt>
|
12
|
+
<des>Downtown</des>
|
13
|
+
<pdist>17273</pdist>
|
14
|
+
|
15
|
+
<dly>false</dly>
|
16
|
+
<spd>31</spd>
|
17
|
+
<tablockid>016 -092</tablockid>
|
18
|
+
<tatripid>21291</tatripid>
|
19
|
+
<zone></zone>
|
20
|
+
</vehicle>
|
21
|
+
|
22
|
+
</bustime-response>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bus-o-matic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Cone
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -30,14 +30,70 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '3.
|
33
|
+
version: '3.4'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '3.
|
40
|
+
version: '3.4'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.5'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.5'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: minitest-reporters
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
41
97
|
description: A wrapper for the Pittsburgh Port Authority TrueTime Bus API
|
42
98
|
email:
|
43
99
|
- matt@macinstruct.com
|
@@ -45,12 +101,17 @@ executables: []
|
|
45
101
|
extensions: []
|
46
102
|
extra_rdoc_files: []
|
47
103
|
files:
|
104
|
+
- ".gitignore"
|
105
|
+
- ".travis.yml"
|
48
106
|
- Gemfile
|
49
107
|
- LICENSE.txt
|
50
108
|
- README.md
|
51
109
|
- Rakefile
|
52
110
|
- bus-o-matic.gemspec
|
53
111
|
- lib/bus-o-matic.rb
|
112
|
+
- spec/bus-o-matic_spec.rb
|
113
|
+
- spec/spec_helper.rb
|
114
|
+
- spec/vehicles.xml
|
54
115
|
homepage: https://github.com/mattcone/bus-o-matic
|
55
116
|
licenses:
|
56
117
|
- MIT
|
@@ -71,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
132
|
version: '0'
|
72
133
|
requirements: []
|
73
134
|
rubyforge_project:
|
74
|
-
rubygems_version: 2.4.
|
135
|
+
rubygems_version: 2.4.5
|
75
136
|
signing_key:
|
76
137
|
specification_version: 4
|
77
138
|
summary: A wrapper for the Pittsburgh Port Authority TrueTime Bus API
|