google_contacts_api 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/google_contacts_api.gemspec +1 -1
- data/lib/google_contacts_api/api.rb +4 -2
- data/lib/google_contacts_api.rb +1 -1
- data/spec/google_contacts_api_spec.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.7
|
data/google_contacts_api.gemspec
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
require 'active_support/core_ext'
|
2
2
|
|
3
3
|
module GoogleContactsApi
|
4
|
-
class
|
4
|
+
class ApiError < StandardError; end
|
5
|
+
class UnauthorizedError < ApiError; end
|
5
6
|
|
6
7
|
class Api
|
7
8
|
# keep separate in case of new auth method
|
@@ -23,7 +24,8 @@ module GoogleContactsApi
|
|
23
24
|
result = @oauth.get("#{BASE_URL}#{link}?#{params.to_query}", headers)
|
24
25
|
# For the full HTML we're matching against, see the spec
|
25
26
|
# TODO: This could be pretty fragile.
|
26
|
-
raise UnauthorizedError if result.
|
27
|
+
raise UnauthorizedError if result.is_a?(Net::HTTPUnauthorized)
|
28
|
+
# raise UnauthorizedError if result.include?("Token invalid - Invalid AuthSub token.") && result.include?("Error 401")
|
27
29
|
result
|
28
30
|
end
|
29
31
|
|
data/lib/google_contacts_api.rb
CHANGED
@@ -35,7 +35,7 @@ describe "GoogleContactsApi" do
|
|
35
35
|
</HTML>
|
36
36
|
ERROR_HTML
|
37
37
|
error_html.strip!
|
38
|
-
oauth.stub(:get).and_return(error_html)
|
38
|
+
oauth.stub(:get).and_return(Net::HTTPUnauthorized.new("1.1", 401, error_html))
|
39
39
|
api = GoogleContactsApi::Api.new(oauth)
|
40
40
|
lambda { api.get("any url",
|
41
41
|
{"param" => "param"},
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: google_contacts_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.2.
|
5
|
+
version: 0.2.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alvin Liang
|
@@ -157,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
157
|
requirements:
|
158
158
|
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
hash: -
|
160
|
+
hash: -3574435168097113310
|
161
161
|
segments:
|
162
162
|
- 0
|
163
163
|
version: "0"
|