tradenity 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +5 -0
- data/lib/tradenity/api.rb +5 -0
- data/lib/tradenity/error/exceptions.rb +5 -1
- data/lib/tradenity/http/client.rb +9 -1
- data/lib/tradenity/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b7ab13c558e7a4a92341acd33f05dcc81ce5b03
|
4
|
+
data.tar.gz: 8f320b23904cacc7084d404a5086b2fad3111d40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4880c390ce6092b2a7b735dd70c35cc05894ccda7f91663178efaf1788b4f58a78051215c0c855b904e9ca06a2f450efa78826f3d361761f517215e57d5d6a5f
|
7
|
+
data.tar.gz: 2a2c4fb63a1f3cca599ed9eae7fe2b430f039a261a409670793cda8ac829be86e37e8f459578546fdffa5051d5ac4e0403ce57315b1f91a7d913fb47356d4dc1
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/tradenity/api.rb
CHANGED
@@ -10,7 +10,7 @@ module Tradenity
|
|
10
10
|
|
11
11
|
class RequestErrorException < RuntimeError
|
12
12
|
def initialize(error)
|
13
|
-
super(error.message)
|
13
|
+
super(error.message) if error != nil
|
14
14
|
@error = error
|
15
15
|
end
|
16
16
|
end
|
@@ -19,6 +19,10 @@ module Tradenity
|
|
19
19
|
end
|
20
20
|
|
21
21
|
|
22
|
+
class SessionExpiredException < RequestErrorException
|
23
|
+
end
|
24
|
+
|
25
|
+
|
22
26
|
class AuthorizationException < RequestErrorException
|
23
27
|
end
|
24
28
|
|
@@ -27,6 +27,10 @@ module Tradenity
|
|
27
27
|
@current_session = session
|
28
28
|
end
|
29
29
|
|
30
|
+
def reset_current_session
|
31
|
+
@current_session[:auth_token] = nil
|
32
|
+
end
|
33
|
+
|
30
34
|
def auth_token
|
31
35
|
if @current_session.has_key? :auth_token
|
32
36
|
@current_session[:auth_token]
|
@@ -95,7 +99,11 @@ module Tradenity
|
|
95
99
|
when 500
|
96
100
|
raise ServerErrorException.new('API server error.')
|
97
101
|
when 401
|
98
|
-
|
102
|
+
if auth_token == nil
|
103
|
+
raise AuthenticationException.new(error)
|
104
|
+
else
|
105
|
+
raise SessionExpiredException.new(error)
|
106
|
+
end
|
99
107
|
when 403
|
100
108
|
raise AuthorizationException.new(error)
|
101
109
|
when 404
|
data/lib/tradenity/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tradenity
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joseph Fouad
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-10-
|
11
|
+
date: 2016-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: virtus
|