roadtrip 0.0.1 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/PostInstall.txt +1 -5
  2. data/README.rdoc +24 -15
  3. data/lib/roadtrip.rb +2 -55
  4. metadata +5 -5
data/PostInstall.txt CHANGED
@@ -1,7 +1,3 @@
1
-
2
- For more information on roadtrip, see http://roadtrip.rubyforge.org
3
-
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
1
+ For more information on roadtrip, see http://github.com/kenton/roadtrip
6
2
 
7
3
 
data/README.rdoc CHANGED
@@ -1,41 +1,50 @@
1
1
  = roadtrip
2
2
 
3
- * http://github.com/#{github_username}/#{project_name}
3
+ * http://github.com/kenton/roadtrip
4
4
 
5
5
  == DESCRIPTION:
6
6
 
7
7
  This is a quick little gem that uses Google Maps to determine the distance, duration and fuel costs for driving between two user defined points. Just like Google Maps, the starting and destination points can be full addresses, city/state combinations, or just ZIP codes.
8
8
 
9
- == FEATURES/PROBLEMS:
9
+ == EXAMPLE USE:
10
+ Assume a user is traveling from ZIP code 30032 to ZIP code 90210, that gas costs $2.75 per gallon and that the car being driven has a fuel economy of 30mpg. The following would be used to create an instance of a Roadtrip::Trip, labeled "t" in this case:
10
11
 
11
- * Pending
12
+ t = Roadtrip::Trip.new(30032, 90210, 2.75, 30)
12
13
 
13
- == SYNOPSIS:
14
+ So in general, the user supplies the following parameters:
14
15
 
15
- t = Trip.new(30032, 90210, 2.75, 30)
16
+ * Starting Location
17
+ * Destination
18
+ * Cost Per Gallon - the cost for a gallon of gas, on average
19
+ * Miles Per Gallon - the MPG for your vehicle
16
20
 
17
- The user supplies the following parameters:
21
+ == FEATURES:
18
22
 
19
- Starting Location
20
- Destination
21
- Cost Per Gallon - the cost for a gallon of gas, on average
22
- Miles Per Gallon - the MPG for your vehicle
23
-
24
- Each object has the following methods available:
23
+ Each "RoadTrip::Trip" object has the following methods available:
25
24
 
26
25
  t.distance
27
26
  t.duration
28
27
  t.cost
29
28
  t.round_trip_cost
30
-
31
29
 
30
+ == TESTS:
31
+ This is a brand new gem (and my first), so I'm still working through adding Cucumber/RSpec tests. For now, this was just a proof of concept so I knew how to create/deploy a gem. I plan on going back and continuing development of this gem using BDD/TDD. More to follow...
32
+
32
33
  == REQUIREMENTS:
34
+ This gem has the following dependencies:
33
35
 
34
- * FIX (list of requirements)
36
+ * rubygems (of course)
37
+ * httparty (http://github.com/jnunemaker/httparty)
35
38
 
36
39
  == INSTALL:
37
40
 
38
- sudo gem install roadtrip
41
+ (sudo) gem install roadtrip
42
+
43
+ Then in your ruby code, add:
44
+ require 'rubygems'
45
+ require 'roadtrip'
46
+
47
+ Note: This gem is hosted at http://www.rubygems.org. Be sure you have rubygems.org (or gemcutter.org) listed as a gem source on your system...or see the documentation on their site for how to add this as a source.
39
48
 
40
49
  == LICENSE:
41
50
 
data/lib/roadtrip.rb CHANGED
@@ -7,7 +7,7 @@ require 'pp'
7
7
  require 'ap'
8
8
 
9
9
  module Roadtrip
10
- VERSION = '0.0.1'
10
+ VERSION = '0.0.3'
11
11
 
12
12
  dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
13
13
 
@@ -67,57 +67,4 @@ module Roadtrip
67
67
 
68
68
  end
69
69
 
70
- end
71
-
72
-
73
- # puts "Enter Starting Address or Location"
74
- # start_location = gets
75
- # puts "Enter Destination"
76
- # end_location = gets
77
- # puts "Enter MPG for your vehicle"
78
- # mpg = gets.to_f
79
- # puts "Enter gas cost per gallon"
80
- # gas_price_per_gallon = gets.to_f
81
-
82
- # trip = Trip.get('http://maps.google.com/maps/api/directions/json?',
83
- # :query => {
84
- # :origin => start_location,
85
- # :destination => end_location,
86
- # :sensor => "false"
87
- # })
88
-
89
- # ap trip["routes"][0]["legs"][0]
90
-
91
- # distance = trip["routes"][0]["legs"][0]["distance"]["value"]
92
- # miles = distance * 0.000621371192
93
- # cost = (gas_price_per_gallon / mpg) * miles
94
-
95
- # puts "\n"
96
- # puts "----------------------------------------------------------------------"
97
- # puts "Start Address: #{trip["routes"][0]["legs"][0]["start_address"]}"
98
- # puts "End Address: #{trip["routes"][0]["legs"][0]["end_address"]}"
99
- # puts "Distance: #{trip["routes"][0]["legs"][0]["distance"]["text"]}"
100
- # puts "Duration: #{trip["routes"][0]["legs"][0]["duration"]["text"]}"
101
- # puts "Cost (one-way): $#{cost.to_f.round}"
102
- # puts "Cost (round trip): $#{cost.to_f.round * 2}"
103
- # puts "----------------------------------------------------------------------"
104
- # puts "\n"
105
-
106
-
107
-
108
- # ap distance["routes"][0]["legs"][0]
109
- # puts "#{distance["routes"][0]["legs"]["starting_address"]}"
110
- # puts "#{distance["routes"][0]["start_address"]}"
111
-
112
-
113
- # * origin (required) — The address or textual latitude/longitude value from which you wish to calculate directions. *
114
- # * destination (required) — The address or textual latitude/longitude value from which you wish to calculate directions.*
115
- # * mode (optional, defaults to driving) — specifies what mode of transport to use when calculating directions. Valid values are specified in Travel Modes.
116
- # * waypoints (optional) specifies an array of waypoints. Waypoints alter a route by routing it through the specified location(s). A waypoint is specified as either a latitude/longitude coordinate or as an address which will be geocoded. (For more information on waypoints, see Using Waypoints in Routes below.)
117
- # * alternatives (optional), if set to true, specifies that the Directions service may provide more than one route alternative in the response. Note that providing route alternatives may increase the response time from the server.
118
- # * avoid (optional) indicates that the calculated route(s) should avoid the indicated features. Currently, this parameter supports the following two arguments:
119
- # o tolls indicates that the calculated route should avoid toll roads/bridges.
120
- # o highways indicates that the calculated route should avoid highways.
121
- # (For more information see Route Restrictions below.)
122
- # * language (optional) — The language in which to return results. See the supported list of domain languages. Note that we often update supported languages so this list may not be exhaustive. If language is not supplied, the Directions service will attempt to use the native language of the browser wherever possible. You may also explicitly bias the results by using localized domains of http://map.google.com. See Region Biasing for more information.
123
- # * sensor (required) — Indicates whether or not the directions request comes from a device with a location sensor. This value must be either true or false.
70
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: roadtrip
3
3
  version: !ruby/object:Gem::Version
4
- hash: 29
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 1
10
- version: 0.0.1
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Kenton Newby
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-07-06 00:00:00 -04:00
18
+ date: 2010-07-12 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -92,7 +92,7 @@ files:
92
92
  - spec/spec_helper.rb
93
93
  - tasks/rspec.rake
94
94
  has_rdoc: true
95
- homepage: http://github.com/#{github_username}/#{project_name}
95
+ homepage: http://github.com/kenton/roadtrip
96
96
  licenses: []
97
97
 
98
98
  post_install_message: PostInstall.txt