spbus 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://200.189.189.54/InternetServices/BuscaLinhasSIM?termosBusca=6450-10
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - '*/*; q=0.5, application/xml'
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Length:
22
+ - '361'
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Server:
26
+ - Microsoft-HTTPAPI/2.0
27
+ Date:
28
+ - Sat, 07 Sep 2013 04:49:02 GMT
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{"BuscaLinhasSIMResult":[{"Circular":false,"CodigoLinha":59,"DenominacaoTPTS":"TERM.
32
+ BANDEIRA","DenominacaoTSTP":"TERM. CAPELINHA","Informacoes":null,"Letreiro":"6450","Sentido":1,"Tipo":10},{"Circular":false,"CodigoLinha":32827,"DenominacaoTPTS":"TERM.
33
+ BANDEIRA","DenominacaoTSTP":"TERM. CAPELINHA","Informacoes":null,"Letreiro":"6450","Sentido":2,"Tipo":10}]}'
34
+ http_version:
35
+ recorded_at: Sat, 07 Sep 2013 04:49:04 GMT
36
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://200.189.189.54/InternetServices/BuscaLinhasSIM?termosBusca=6450-10
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - '*/*; q=0.5, application/xml'
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Length:
22
+ - '361'
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Server:
26
+ - Microsoft-HTTPAPI/2.0
27
+ Date:
28
+ - Sat, 07 Sep 2013 04:49:02 GMT
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{"BuscaLinhasSIMResult":[{"Circular":false,"CodigoLinha":59,"DenominacaoTPTS":"TERM.
32
+ BANDEIRA","DenominacaoTSTP":"TERM. CAPELINHA","Informacoes":null,"Letreiro":"6450","Sentido":1,"Tipo":10},{"Circular":false,"CodigoLinha":32827,"DenominacaoTPTS":"TERM.
33
+ BANDEIRA","DenominacaoTSTP":"TERM. CAPELINHA","Informacoes":null,"Letreiro":"6450","Sentido":2,"Tipo":10}]}'
34
+ http_version:
35
+ recorded_at: Sat, 07 Sep 2013 04:49:04 GMT
36
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,36 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://200.189.189.54/InternetServices/BuscaLinhasSIM?termosBusca=6450-10
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - '*/*; q=0.5, application/xml'
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Length:
22
+ - '361'
23
+ Content-Type:
24
+ - application/json; charset=utf-8
25
+ Server:
26
+ - Microsoft-HTTPAPI/2.0
27
+ Date:
28
+ - Sat, 07 Sep 2013 04:49:02 GMT
29
+ body:
30
+ encoding: UTF-8
31
+ string: '{"BuscaLinhasSIMResult":[{"Circular":false,"CodigoLinha":59,"DenominacaoTPTS":"TERM.
32
+ BANDEIRA","DenominacaoTSTP":"TERM. CAPELINHA","Informacoes":null,"Letreiro":"6450","Sentido":1,"Tipo":10},{"Circular":false,"CodigoLinha":32827,"DenominacaoTPTS":"TERM.
33
+ BANDEIRA","DenominacaoTSTP":"TERM. CAPELINHA","Informacoes":null,"Letreiro":"6450","Sentido":2,"Tipo":10}]}'
34
+ http_version:
35
+ recorded_at: Sat, 07 Sep 2013 04:49:03 GMT
36
+ recorded_with: VCR 2.5.0
@@ -0,0 +1,20 @@
1
+ require "spec_helper"
2
+
3
+ describe SpBus::Crawler do
4
+
5
+ describe "#fetch_routes", :vcr do
6
+
7
+ before { subject.fetch_routes }
8
+
9
+ it "returns all bus routes" do
10
+ expect(subject.routes.size).to eql(1320)
11
+ end
12
+
13
+ it "returns creates a Route object for every found route" do
14
+ subject.routes.each do |l|
15
+ expect(l).to be_kind_of(SpBus::Route)
16
+ end
17
+ end
18
+ end
19
+ end
20
+
@@ -0,0 +1,32 @@
1
+ require "spec_helper"
2
+
3
+ describe SpBus::Route do
4
+
5
+ subject { described_class.new("5704-10") }
6
+
7
+ it { should respond_to(:number) }
8
+ it { should respond_to(:origin) }
9
+ it { should respond_to(:destination) }
10
+ it { should respond_to(:code_for_origin) }
11
+ it { should respond_to(:code_for_destination) }
12
+
13
+ describe "#fetch_details", :vcr do
14
+
15
+ subject { described_class.new("6450-10") }
16
+ before { subject.fetch_details }
17
+
18
+ it "sets route position codes" do
19
+ expect(subject.code_for_origin).to eql(59)
20
+ expect(subject.code_for_destination).to eql(32827)
21
+ end
22
+
23
+ it "sets origin attribute" do
24
+ expect(subject.origin).to eql("TERM. CAPELINHA")
25
+ end
26
+
27
+ it "sets destination attribute" do
28
+ expect(subject.destination).to eql("TERM. BANDEIRA")
29
+ end
30
+ end
31
+ end
32
+
@@ -0,0 +1,16 @@
1
+ require "spbus"
2
+ require "vcr"
3
+
4
+ VCR.configure do |c|
5
+ c.cassette_library_dir = "spec/cassettes"
6
+ c.hook_into :webmock
7
+ c.configure_rspec_metadata!
8
+ end
9
+
10
+ RSpec.configure do |c|
11
+ c.treat_symbols_as_metadata_keys_with_true_values = true
12
+ c.run_all_when_everything_filtered = true
13
+ c.filter_run :focus
14
+ c.order = 'random'
15
+ end
16
+
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: spbus
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Lenon Marcel
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2013-09-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.3'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: webmock
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: vcr
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: nokogiri
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rest-client
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Easily retrieve information about São Paulo bus routes
112
+ email:
113
+ - lenon.marcel@gmail.com
114
+ executables: []
115
+ extensions: []
116
+ extra_rdoc_files: []
117
+ files:
118
+ - .gitignore
119
+ - .rspec
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - example.rb
125
+ - lib/spbus.rb
126
+ - lib/spbus/crawler.rb
127
+ - lib/spbus/route.rb
128
+ - lib/spbus/version.rb
129
+ - spbus.gemspec
130
+ - spec/cassettes/SpBus_Crawler/_fetch_routes/returns_all_bus_routes.yml
131
+ - spec/cassettes/SpBus_Crawler/_fetch_routes/returns_creates_a_Route_object_for_every_found_route.yml
132
+ - spec/cassettes/SpBus_Route/_fetch_details/sets_destination_attribute.yml
133
+ - spec/cassettes/SpBus_Route/_fetch_details/sets_origin_attribute.yml
134
+ - spec/cassettes/SpBus_Route/_fetch_details/sets_route_position_codes.yml
135
+ - spec/crawler_spec.rb
136
+ - spec/route_spec.rb
137
+ - spec/spec_helper.rb
138
+ homepage: http://github.com/lenon/spbus
139
+ licenses:
140
+ - MIT
141
+ metadata: {}
142
+ post_install_message:
143
+ rdoc_options: []
144
+ require_paths:
145
+ - lib
146
+ required_ruby_version: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - '>='
149
+ - !ruby/object:Gem::Version
150
+ version: '0'
151
+ required_rubygems_version: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - '>='
154
+ - !ruby/object:Gem::Version
155
+ version: '0'
156
+ requirements: []
157
+ rubyforge_project:
158
+ rubygems_version: 2.0.6
159
+ signing_key:
160
+ specification_version: 4
161
+ summary: A gem to easily retrieve information about São Paulo bus routes, numbers,
162
+ location, etc using SPTrans web services.
163
+ test_files:
164
+ - spec/cassettes/SpBus_Crawler/_fetch_routes/returns_all_bus_routes.yml
165
+ - spec/cassettes/SpBus_Crawler/_fetch_routes/returns_creates_a_Route_object_for_every_found_route.yml
166
+ - spec/cassettes/SpBus_Route/_fetch_details/sets_destination_attribute.yml
167
+ - spec/cassettes/SpBus_Route/_fetch_details/sets_origin_attribute.yml
168
+ - spec/cassettes/SpBus_Route/_fetch_details/sets_route_position_codes.yml
169
+ - spec/crawler_spec.rb
170
+ - spec/route_spec.rb
171
+ - spec/spec_helper.rb