ts_json_api 0.2.2 → 0.2.3
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.
- data/README.md +3 -0
- data/lib/ts_json_api/exceptions.rb +10 -0
- data/lib/ts_json_api/requestor/private_methods.rb +6 -3
- data/lib/ts_json_api/version.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -108,6 +108,9 @@ rescue TsJsonApi::ResourceNotFound
|
|
108
108
|
rescue TsJsonApi::ServerBrokeConnection
|
109
109
|
puts "connection to server was broken"
|
110
110
|
|
111
|
+
rescue TsJsonApi::AccessTokenRefused
|
112
|
+
puts "access token was refused for this server: #{TsJsonApi::Configure.server_url}"
|
113
|
+
|
111
114
|
rescue TsJsonApi::Exception => e
|
112
115
|
puts "some exception bubbled up from RestClient: #{e}, or a catch-all for all TsJsonApi exceptions"
|
113
116
|
```
|
@@ -33,6 +33,16 @@ module TsJsonApi
|
|
33
33
|
|
34
34
|
end
|
35
35
|
|
36
|
+
# This exception is thrown when we aren't authorized to access the server
|
37
|
+
class AccessTokenRefused < Exception
|
38
|
+
def initialize(*args)
|
39
|
+
options = args.extract_options!
|
40
|
+
options.merge! http_code: 401
|
41
|
+
super options
|
42
|
+
self.message = 'Access token refused'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
36
46
|
# Server connection was severed
|
37
47
|
class ServerBrokeConnection < Exception
|
38
48
|
|
@@ -27,14 +27,17 @@ module TsJsonApi
|
|
27
27
|
api[partial_url].get
|
28
28
|
|
29
29
|
rescue RestClient::Exceptions::EXCEPTIONS_MAP[400] => e
|
30
|
-
|
30
|
+
raise ApiLimitExceededException.new exception: e
|
31
31
|
|
32
|
-
|
33
|
-
|
32
|
+
rescue RestClient::Exceptions::EXCEPTIONS_MAP[404] => e
|
33
|
+
raise ResourceNotFound.new exception: e
|
34
34
|
|
35
35
|
rescue RestClient::ServerBrokeConnection => e
|
36
36
|
raise ServerBrokeConnection.new exception: e
|
37
37
|
|
38
|
+
rescue RestClient::Exceptions::EXCEPTIONS_MAP[401] => e
|
39
|
+
raise AccessTokenRefused.new exception: e
|
40
|
+
|
38
41
|
rescue RestClient::Exception => e
|
39
42
|
raise Exception.new exception: e
|
40
43
|
|
data/lib/ts_json_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ts_json_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -117,7 +117,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: '0'
|
118
118
|
segments:
|
119
119
|
- 0
|
120
|
-
hash:
|
120
|
+
hash: -4033355071123155694
|
121
121
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
122
|
none: false
|
123
123
|
requirements:
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
version: '0'
|
127
127
|
segments:
|
128
128
|
- 0
|
129
|
-
hash:
|
129
|
+
hash: -4033355071123155694
|
130
130
|
requirements: []
|
131
131
|
rubyforge_project:
|
132
132
|
rubygems_version: 1.8.24
|