frizzle 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -9
- data/lib/frizzle/routes.rb +0 -2
- data/lib/frizzle/segments.rb +0 -1
- data/lib/frizzle/vehicles.rb +0 -1
- data/lib/frizzle/version.rb +1 -1
- 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: 71bc610a691f498af1e64c506af3e9feb243a57a
|
4
|
+
data.tar.gz: b7288a68dac615ec55f7b00b5b156adc1cf649df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bb87668fbc62c30b59c3e5742276933dba444b790dcbb9abe487ed12aea3e3a96d102e3a6656b5bc786e745e0a9c61583061d5f8323aef7b01d2bf610f453d4
|
7
|
+
data.tar.gz: eb362163b28ec7ef909eaec05a5a480a363b3082fd5b5fa417fd503adc73f7d2c01fc158338b018236649a0ed42e5cfa5cf10ea69f24dcafebfb17b593f6fd79
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Frizzle: A Ruby wrapper for the TransLoc API
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/frizzle.png)](http://badge.fury.io/rb/frizzle)
|
4
|
+
|
3
5
|
Frizzle is a Ruby wrapper for the [TransLoc Public API](http://api.transloc.com/doc/).
|
4
6
|
|
5
7
|
Supports all the TransLoc v1.2 API methods. You can either use the whole API wrapper through `Frizzle` or use parts of it i.e. `Frizzle::Agencies.all` if you solely want to work with a particular resource.
|
@@ -11,13 +13,13 @@ For more information on the TransLoc API, visit [http://api.transloc.com/doc/](h
|
|
11
13
|
Add this line to your application's Gemfile:
|
12
14
|
|
13
15
|
```ruby
|
14
|
-
gem 'frizzle'
|
16
|
+
gem 'frizzle'
|
15
17
|
```
|
16
18
|
|
17
19
|
Or install it yourself as:
|
18
20
|
|
19
21
|
```ruby
|
20
|
-
gem install "frizzle"
|
22
|
+
gem install "frizzle"
|
21
23
|
```
|
22
24
|
|
23
25
|
## Usage
|
@@ -36,6 +38,8 @@ Frizzle::Agencies.all
|
|
36
38
|
|
37
39
|
The TransLoc API does not require an API key.
|
38
40
|
|
41
|
+
#### Geographical Filtering
|
42
|
+
|
39
43
|
For methods that allow limiting the results with a geographical area filter, there are two form options: *rectangle form* and *point and radius form*.
|
40
44
|
|
41
45
|
To limit with *rectangle form*, pass two arrays ([lat, lng]) for the two geo area arguments. It would look like:
|
@@ -54,7 +58,8 @@ Frizzle.agencies.find_by_geo_area([35.80176,-78.64347], 70)
|
|
54
58
|
|
55
59
|
Agencies can be accessed through `Frizzle.agencies` or `Frizzle::Agencies`. This API call can be requested every 10 seconds from the same IP address.
|
56
60
|
|
57
|
-
|
61
|
+
##### Examples:
|
62
|
+
|
58
63
|
```ruby
|
59
64
|
Frizzle::Agencies.all
|
60
65
|
Frizzle.agencies.all
|
@@ -67,11 +72,12 @@ Frizzle.agencies.find_by_id_and_geo_area("168", [35.80176,-78.64347], 120)
|
|
67
72
|
Frizzle.agencies.find({:agencies => "12", :geo_area => "35.80176,-78.64347|100"})
|
68
73
|
```
|
69
74
|
|
70
|
-
###
|
75
|
+
### Segments
|
71
76
|
|
72
77
|
Segments can be accessed through `Frizzle.segments` or `Frizzle::Segments`. This API call can be requested every 10 seconds from the same IP address.
|
73
78
|
|
74
|
-
|
79
|
+
##### Examples:
|
80
|
+
|
75
81
|
```ruby
|
76
82
|
Frizzle::Segments.find_by_agencies(24)
|
77
83
|
Frizzle.segments.find_by_agencies(24)
|
@@ -87,7 +93,8 @@ Frizzle.segments.find({:agencies => "24"}
|
|
87
93
|
|
88
94
|
Routes can be accessed through `Frizzle.routes` or `Frizzle::Routes`. This API call can be requested every 10 seconds from the same IP address.
|
89
95
|
|
90
|
-
|
96
|
+
###### Examples:
|
97
|
+
|
91
98
|
```ruby
|
92
99
|
Frizzle::Routes.find_by_agencies("24")
|
93
100
|
Frizzle.routes.find_by_agencies("24")
|
@@ -100,7 +107,7 @@ Frizzle::Routes.find({:agencies => "24"})
|
|
100
107
|
|
101
108
|
Stops can be accessed through `Frizzle.stops` or `Frizzle::Stops`. This API call can be requested every 10 seconds from the same IP address.
|
102
109
|
|
103
|
-
|
110
|
+
###### Examples:
|
104
111
|
|
105
112
|
```ruby
|
106
113
|
Frizzle::Stops.find_by_agencies(24)
|
@@ -113,7 +120,8 @@ Frizzle::Stops.find({:agencies => "24"})
|
|
113
120
|
|
114
121
|
Vehicles can be accessed through `Frizzle.vehicles` or `Frizzle::Vehicles`. This API call can be requested every 1 second from the same IP address.
|
115
122
|
|
116
|
-
|
123
|
+
###### Examples:
|
124
|
+
|
117
125
|
```ruby
|
118
126
|
Frizzle::Vehicles.find_by_agencies("24")
|
119
127
|
Frizzle.vehicles.find_by_agencies("24")
|
@@ -126,7 +134,8 @@ Frizzle::Vehicles.find({:agencies => "24"})
|
|
126
134
|
|
127
135
|
Arrival estimates can be accessed through `Frizzle.arrival_estimates` or `Frizzle::ArrivalEstimates`. This API call can be requested every 1 second from the same IP address.
|
128
136
|
|
129
|
-
|
137
|
+
###### Examples:
|
138
|
+
|
130
139
|
```ruby
|
131
140
|
Frizzle::ArrivalEstimates.find_by_agencies("24")
|
132
141
|
Frizzle.arrival_estimates.find_by_agencies("24")
|
data/lib/frizzle/routes.rb
CHANGED
@@ -6,13 +6,11 @@ module Frizzle
|
|
6
6
|
:query => options )
|
7
7
|
end
|
8
8
|
|
9
|
-
# 168,275
|
10
9
|
def self.find_by_agencies(agencies)
|
11
10
|
fetch("/routes.json",
|
12
11
|
:query => { :agencies => formatted_list(agencies) })
|
13
12
|
end
|
14
13
|
|
15
|
-
# 168 35.80176,-78.64347|75.5
|
16
14
|
def self.find_by_agencies_and_geo_area(agencies, geo_area_first, geo_area_second=Frizzle::Base::DEFAULT_GEO_RADIUS)
|
17
15
|
fetch("/routes.json",
|
18
16
|
:query => {
|
data/lib/frizzle/segments.rb
CHANGED
data/lib/frizzle/vehicles.rb
CHANGED
data/lib/frizzle/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frizzle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tyler Pearson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|