grizzly-weibo 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -95,6 +95,9 @@ while friends.next_page? #Loops untill end of collection
95
95
  end
96
96
  ```
97
97
 
98
+ ### Error Handling
99
+ Grizzly has its own set of errors that it can throw. ```Grizzly::Errors::NoAccessToken``` is thrown when the client is created with out an access token. ```Grizzly::Errors::WeiboAPI``` is thrown when ever there is an error returned by an end point of the API. This will return both a message and a weibo error code. ```Grizzly::Errors::Timeout``` will be thrown when the Weibo API is taking too long to respond to a response. There currently is a five second limit on the request time of each request made by Grizzly. Note that when your using a cursor class described above this time out applies to each request the cursor makes not the total time that the cursor takes to build the results of a given GET from the api.
100
+
98
101
  ### License
99
102
  Copyright (c) 2012 Stewart Matheson
100
103
 
@@ -0,0 +1,7 @@
1
+ module Errors
2
+ class Timeout < StandardError
3
+ def to_s
4
+ "The request to the Weibo API has timed out. This was most likely caused by the Weibo API not responding to given API call in a timley fashon."
5
+ end
6
+ end
7
+ end
@@ -34,6 +34,9 @@ module Grizzly
34
34
 
35
35
  request.body = to_uri_encoded(payload) if payload
36
36
  end
37
+
38
+ rescue Faraday::Error::TimeoutError
39
+ throw Grizzly::Errors::Timeout.new
37
40
  end
38
41
 
39
42
  def response
@@ -1,3 +1,3 @@
1
1
  module Grizzly
2
- VERSION = "0.3.5"
2
+ VERSION = "0.3.6"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grizzly-weibo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-11 00:00:00.000000000Z
12
+ date: 2012-04-13 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -103,6 +103,7 @@ files:
103
103
  - lib/grizzly/client.rb
104
104
  - lib/grizzly/cursor.rb
105
105
  - lib/grizzly/errors/no_access_token.rb
106
+ - lib/grizzly/errors/timeout.rb
106
107
  - lib/grizzly/errors/weibo_api.rb
107
108
  - lib/grizzly/request.rb
108
109
  - lib/grizzly/status.rb
@@ -125,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
125
126
  version: '0'
126
127
  segments:
127
128
  - 0
128
- hash: -650459938218178096
129
+ hash: 543149314686076623
129
130
  required_rubygems_version: !ruby/object:Gem::Requirement
130
131
  none: false
131
132
  requirements: