rlyft 0.1.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/.rspec +3 -0
- data/.rubocop.yml +22 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/README.md +91 -14
- data/Rakefile +9 -1
- data/lib/lyft/client/api/availability.rb +107 -0
- data/lib/lyft/client/api/base.rb +95 -0
- data/lib/lyft/client/api/oauth.rb +73 -0
- data/lib/lyft/client/api/rides.rb +234 -0
- data/lib/lyft/client/api/user.rb +48 -0
- data/lib/lyft/client/configuration.rb +23 -0
- data/lib/lyft/client/mashed_parser.rb +31 -0
- data/lib/lyft/client.rb +63 -11
- data/lib/lyft/ride/status.rb +13 -0
- data/lib/lyft/ride/type.rb +10 -0
- data/lib/lyft/ride.rb +18 -0
- data/lib/lyft/version.rb +1 -1
- data/lib/lyft.rb +17 -8
- data/lyft.gemspec +5 -0
- metadata +86 -15
- data/lib/lyft/api/availability/cost.rb +0 -36
- data/lib/lyft/api/availability/eta.rb +0 -30
- data/lib/lyft/api/availability/nearby_drivers.rb +0 -30
- data/lib/lyft/api/availability/ride_types.rb +0 -30
- data/lib/lyft/api/oauth/public_token.rb +0 -29
- data/lib/lyft/api/rides/ride.rb +0 -8
- data/lib/lyft/api/rides/ride_cancel.rb +0 -8
- data/lib/lyft/api/rides/ride_details.rb +0 -8
- data/lib/lyft/api/rides/ride_rating_and_tipping.rb +0 -8
- data/lib/lyft/api/rides/ride_receipt.rb +0 -8
- data/lib/lyft/api/users/profile.rb +0 -8
- data/lib/lyft/api/users/ride_history.rb +0 -8
@@ -1,36 +0,0 @@
|
|
1
|
-
module Lyft
|
2
|
-
module Api
|
3
|
-
module Availability
|
4
|
-
##
|
5
|
-
# Get Lyft costs
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# client.cost start_lat: 37.7772,
|
9
|
-
# start_lng: -122.4233,
|
10
|
-
# end_lat: 37.7972,
|
11
|
-
# end_lng: -122.4533
|
12
|
-
#
|
13
|
-
# @param [Hash] args
|
14
|
-
# @option args [Float] :start_lat The latitude of starting point. (*required*)
|
15
|
-
# @option args [Float] :start_lng The longitude of starting point. (*required*)
|
16
|
-
# @option args [Float] :end_lat The latitude of the end point. (*required*)
|
17
|
-
# @option args [Float] :end_lng The longitude of the end point. (*required*)
|
18
|
-
def cost(args = {})
|
19
|
-
uri = Lyft.endpoint('/v1/cost')
|
20
|
-
options = {
|
21
|
-
headers: {
|
22
|
-
Authorization: "Bearer #{public_token.access_token}"
|
23
|
-
}.as_json,
|
24
|
-
query: {
|
25
|
-
start_lat: args.fetch(:start_lat),
|
26
|
-
start_lng: args.fetch(:start_lng),
|
27
|
-
end_lat: args.fetch(:end_lat),
|
28
|
-
end_lng: args.fetch(:end_lng)
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
HTTParty.get(uri, options)
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Lyft
|
2
|
-
module Api
|
3
|
-
module Availability
|
4
|
-
##
|
5
|
-
# Get eta for lyft driver to reach location
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# client.eta lat: 37.7772,
|
9
|
-
# lng: -122.4233
|
10
|
-
#
|
11
|
-
# @param [Hash] args
|
12
|
-
# @option args [Float] :lat The latitude of pickup. (*required*)
|
13
|
-
# @option args [Float] :lng The longitude of pickup. (*required*)
|
14
|
-
def eta(args = {})
|
15
|
-
uri = Lyft.endpoint('/v1/eta')
|
16
|
-
options = {
|
17
|
-
headers: {
|
18
|
-
Authorization: "Bearer #{public_token.access_token}"
|
19
|
-
}.as_json,
|
20
|
-
query: {
|
21
|
-
lat: args.fetch(:lat),
|
22
|
-
lng: args.fetch(:lng)
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
HTTParty.get(uri, options)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Lyft
|
2
|
-
module Api
|
3
|
-
module Availability
|
4
|
-
##
|
5
|
-
# Get positions of nearby drivers
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# client.nearby_drivers lat: 37.7772,
|
9
|
-
# lng: -122.4233
|
10
|
-
#
|
11
|
-
# @param [Hash] args
|
12
|
-
# @option args [Float] :lat The latitude of pickup. (*required*)
|
13
|
-
# @option args [Float] :lng The longitude of pickup. (*required*)
|
14
|
-
def nearby_drivers(args = {})
|
15
|
-
uri = Lyft.endpoint('/v1/drivers')
|
16
|
-
options = {
|
17
|
-
headers: {
|
18
|
-
Authorization: "Bearer #{public_token.access_token}"
|
19
|
-
}.as_json,
|
20
|
-
query: {
|
21
|
-
lat: args.fetch(:lat),
|
22
|
-
lng: args.fetch(:lng)
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
HTTParty.get(uri, options)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
module Lyft
|
2
|
-
module Api
|
3
|
-
module Availability
|
4
|
-
##
|
5
|
-
# Get available lyft ride types
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# client.ride_types lat: 37.7772,
|
9
|
-
# lng: -122.4233
|
10
|
-
#
|
11
|
-
# @param [Hash] args
|
12
|
-
# @option args [Float] :lat The latitude of pickup. (*required*)
|
13
|
-
# @option args [Float] :lng The longitude of pickup. (*required*)
|
14
|
-
def ride_types(args = {})
|
15
|
-
uri = Lyft.endpoint('/v1/ridetypes')
|
16
|
-
options = {
|
17
|
-
headers: {
|
18
|
-
Authorization: "Bearer #{public_token.access_token}"
|
19
|
-
}.as_json,
|
20
|
-
query: {
|
21
|
-
lat: args.fetch(:lat),
|
22
|
-
lng: args.fetch(:lng)
|
23
|
-
}
|
24
|
-
}
|
25
|
-
|
26
|
-
HTTParty.get(uri, options)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Lyft
|
2
|
-
module Api
|
3
|
-
module Oauth
|
4
|
-
##
|
5
|
-
# Retrieve public oauth token.
|
6
|
-
#
|
7
|
-
# @todo Use same token until expires
|
8
|
-
#
|
9
|
-
def public_token(renew = false)
|
10
|
-
# return @public_token unless @public_token.nil? && !renew
|
11
|
-
|
12
|
-
uri = Lyft.endpoint('/oauth/token')
|
13
|
-
options = {
|
14
|
-
body: {
|
15
|
-
grant_type: 'client_credentials',
|
16
|
-
scope: 'public'
|
17
|
-
},
|
18
|
-
basic_auth: {
|
19
|
-
username: @client_id,
|
20
|
-
password: @client_secret
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
|
-
response = HTTParty.post(uri, options).deep_symbolize_keys!
|
25
|
-
@public_token = Struct.new(*response.keys).new(*response.values)
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
data/lib/lyft/api/rides/ride.rb
DELETED