uber-ruby 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -2
- data/lib/uber/api/activities.rb +1 -1
- data/lib/uber/base.rb +4 -5
- data/lib/uber/models/activity.rb +10 -1
- data/lib/uber/rate_limit.rb +10 -3
- data/lib/uber/version.rb +1 -1
- metadata +17 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d701a94c056f2a62beda2a8fad9fbab3196b5e8e
|
4
|
+
data.tar.gz: fd42a9fc46cb484ef60378052c0613b7f46f8e64
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68b64d7807b28b55e6437c51322b7a8163028cab4af9e1d09a77fba8e6cb58c277a8057a802d6355b42cd80b72e66495bb89c7aed62d5a0f54cd87ed9ffbb44e
|
7
|
+
data.tar.gz: d69e71aadc6d29c1ce8572b8598e3fe4e77cdcec3b902d0bead3db8443b758f14bbf0abbb8234b53f754c6a4de86fb56cba0fb2ce81f87ded4075c7c1ee23101
|
data/README.md
CHANGED
@@ -63,7 +63,7 @@ client = Uber::Client.new do |config|
|
|
63
63
|
config.server_token = "YOUR_SERVER_TOKEN"
|
64
64
|
config.client_id = "YOUR_CLIENT_ID"
|
65
65
|
config.client_secret = "YOUR_CLIENT_SECRET"
|
66
|
-
config.
|
66
|
+
config.bearer_token = "USER_ACCESS_TOKEN"
|
67
67
|
end
|
68
68
|
client.me
|
69
69
|
```
|
@@ -75,11 +75,14 @@ client = Uber::Client.new do |config|
|
|
75
75
|
config.server_token = "YOUR_SERVER_TOKEN"
|
76
76
|
config.client_id = "YOUR_CLIENT_ID"
|
77
77
|
config.client_secret = "YOUR_CLIENT_SECRET"
|
78
|
-
config.
|
78
|
+
config.bearer_token = "USER_ACCESS_TOKEN"
|
79
79
|
end
|
80
80
|
client.history
|
81
81
|
```
|
82
82
|
|
83
|
+
## Contributors
|
84
|
+
|
85
|
+
* [Arun Thampi](https://github.com/arunthampi)
|
83
86
|
|
84
87
|
## Contributing
|
85
88
|
|
data/lib/uber/api/activities.rb
CHANGED
data/lib/uber/base.rb
CHANGED
@@ -8,11 +8,10 @@ module Uber
|
|
8
8
|
# @param attrs [Hash]
|
9
9
|
# @return [Uber::Base]
|
10
10
|
def initialize(attrs = {})
|
11
|
-
if
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
end
|
11
|
+
return if attrs.nil? || attrs.empty?
|
12
|
+
attrs.each do |key, value|
|
13
|
+
if respond_to?(:"#{key}=")
|
14
|
+
send(:"#{key}=", value)
|
16
15
|
end
|
17
16
|
end
|
18
17
|
end
|
data/lib/uber/models/activity.rb
CHANGED
@@ -8,7 +8,8 @@ module Uber
|
|
8
8
|
end
|
9
9
|
|
10
10
|
class History < Base
|
11
|
-
attr_accessor :
|
11
|
+
attr_accessor :request_time, :product_id, :status, :distance, :start_time, :end_time, :start_city, :request_id
|
12
|
+
alias_method :uuid, :request_id
|
12
13
|
|
13
14
|
def request_time=(value)
|
14
15
|
@request_time = ::Time.at(value)
|
@@ -21,9 +22,17 @@ module Uber
|
|
21
22
|
def end_time=(value)
|
22
23
|
@end_time = ::Time.at(value)
|
23
24
|
end
|
25
|
+
|
26
|
+
def start_city=(value)
|
27
|
+
@start_city = City.new(value)
|
28
|
+
end
|
24
29
|
end
|
25
30
|
|
26
31
|
class Location < Base
|
27
32
|
attr_accessor :address, :latitude, :longitude
|
28
33
|
end
|
34
|
+
|
35
|
+
class City < Base
|
36
|
+
attr_accessor :display_name, :latitude, :longitude
|
37
|
+
end
|
29
38
|
end
|
data/lib/uber/rate_limit.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
module Uber
|
2
|
-
class RateLimit
|
2
|
+
class RateLimit
|
3
|
+
attr_reader :attrs
|
4
|
+
|
5
|
+
def initialize(attrs = {})
|
6
|
+
return if attrs.nil? || attrs.empty?
|
7
|
+
@attrs = attrs
|
8
|
+
end
|
9
|
+
|
3
10
|
# @return [Integer]
|
4
11
|
def limit
|
5
12
|
limit = @attrs['x-rate-limit-limit']
|
@@ -15,12 +22,12 @@ module Uber
|
|
15
22
|
# @return [Time]
|
16
23
|
def reset_at
|
17
24
|
reset = @attrs['x-rate-limit-reset']
|
18
|
-
Time.at(reset.to_i) if reset
|
25
|
+
::Time.at(reset.to_i) if reset
|
19
26
|
end
|
20
27
|
|
21
28
|
# @return [Integer]
|
22
29
|
def reset_in
|
23
|
-
[(reset_at - Time.now).ceil, 0].max if reset_at
|
30
|
+
[(reset_at - ::Time.now).ceil, 0].max if reset_at
|
24
31
|
end
|
25
32
|
end
|
26
33
|
end
|
data/lib/uber/version.rb
CHANGED
metadata
CHANGED
@@ -1,97 +1,97 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uber-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dingding Ye
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-01-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.5'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1.5'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: 1.21.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 1.21.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 3.3.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 3.3.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faraday
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: 0.9.0
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: 0.9.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: json
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '1.8'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '1.8'
|
97
97
|
description: A Ruby interface to the Uber API.
|
@@ -142,17 +142,17 @@ require_paths:
|
|
142
142
|
- lib
|
143
143
|
required_ruby_version: !ruby/object:Gem::Requirement
|
144
144
|
requirements:
|
145
|
-
- -
|
145
|
+
- - '>='
|
146
146
|
- !ruby/object:Gem::Version
|
147
147
|
version: '0'
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '>='
|
151
151
|
- !ruby/object:Gem::Version
|
152
152
|
version: 1.3.5
|
153
153
|
requirements: []
|
154
154
|
rubyforge_project:
|
155
|
-
rubygems_version: 2.4.
|
155
|
+
rubygems_version: 2.4.2
|
156
156
|
signing_key:
|
157
157
|
specification_version: 4
|
158
158
|
summary: The Uber Ruby Gem.
|