bmtc 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/.gitignore +1 -0
- data/README.md +11 -1
- data/lib/bmtc/version.rb +1 -1
- data/lib/bmtc.rb +17 -4
- 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: 8fd7b040144f15d0a6aa3c56f3e3108b18c5a3cf
|
4
|
+
data.tar.gz: efc96266ce11a1787389cdb2d5f64749c332c749
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa95eba4530bad1d024012d46619986c6aa62bbb1db3e0a88a2274011d7785ecd03de2648c0bd3718e6685bc1f1bb2f63ad37d5d82b61f9f28f9234977b097a6
|
7
|
+
data.tar.gz: 31bf1078aa81a552399cae452aa245a094bc9fe23085215f82cac2b0b2d585cf833f182b698d683f9a4619efb980578ff96fb6444c4dd1318580792df3d3addc
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Bmtc
|
2
2
|
|
3
|
-
Bangalore Metropolitan Transport Corporation BMTC its Intelligent Transport System (ITS) , But as of now there is no public api available . This is an reverse engineering approach to solve the issue
|
3
|
+
Bangalore Metropolitan Transport Corporation BMTC recently released its Intelligent Transport System (ITS) , But as of now there is no public api available . This is an reverse engineering approach to solve the issue
|
4
|
+
|
5
|
+
API Reference : https://github.com/tachyons/bmtc_api
|
4
6
|
|
5
7
|
## Installation
|
6
8
|
|
@@ -47,6 +49,14 @@ Get route map
|
|
47
49
|
BMTC::route_map <route_id>
|
48
50
|
BMTC::route_map "171"
|
49
51
|
```
|
52
|
+
|
53
|
+
Get Trip fare
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
BMTC.trip_fare(source: "HSR CPWD Quarters",destination:"Shanthinagara TTMC",service_type: :ordinary,no_adults: 1)
|
57
|
+
```
|
58
|
+
|
59
|
+
Service types can be oridninary,vajra,vayu_vajra,atal_sarige,nice_service and bengaluru_darshini
|
50
60
|
## Development
|
51
61
|
|
52
62
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/bmtc/version.rb
CHANGED
data/lib/bmtc.rb
CHANGED
@@ -4,6 +4,15 @@ require 'bmtc/ttmc'
|
|
4
4
|
require 'httparty'
|
5
5
|
BMTC = Bmtc
|
6
6
|
module Bmtc
|
7
|
+
SERVICE_TYPES = {
|
8
|
+
ordinary: 1,
|
9
|
+
vayu_vajra: 2,
|
10
|
+
vajra: 3,
|
11
|
+
atal_sarige: 5,
|
12
|
+
nice_service: 11,
|
13
|
+
bengaluru_darshini: 14
|
14
|
+
|
15
|
+
}.freeze
|
7
16
|
include HTTParty
|
8
17
|
base_uri 'http://bmtcmob.hostg.in/api/'
|
9
18
|
def self.post_request(path, options)
|
@@ -26,13 +35,17 @@ module Bmtc
|
|
26
35
|
Bmtc.post_request('/routemap/details', options)
|
27
36
|
end
|
28
37
|
|
29
|
-
def self.trip_fare(
|
38
|
+
def self.trip_fare(_input_options = {})
|
39
|
+
service_type = SERVICE_TYPES[_input_options[:service_type]] || _input_options[:service_type] || "1"
|
40
|
+
source = _input_options[:source]
|
41
|
+
destination = _input_options[:destination]
|
42
|
+
no_adults= (_input_options[:no_adults].to_s || 1).to_s
|
30
43
|
options = {
|
31
|
-
'adults' => no_adults
|
32
|
-
'destination' =>
|
44
|
+
'adults' => no_adults,
|
45
|
+
'destination' => destination,
|
33
46
|
'serviceType' => service_type,
|
34
47
|
'source' => source
|
35
48
|
}
|
36
|
-
Bmtc.post_request('/tripfare/details', options)
|
49
|
+
JSON.parse Bmtc.post_request('/tripfare/details', options)
|
37
50
|
end
|
38
51
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bmtc
|
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
|
- Aboobacker MK
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|