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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5f045dc13c7fadc66ff394bde5206ad227e852ee
4
- data.tar.gz: b7362d7bdb9709b93766da4069f07a35e6ab71e2
3
+ metadata.gz: 7b7ab13c558e7a4a92341acd33f05dcc81ce5b03
4
+ data.tar.gz: 8f320b23904cacc7084d404a5086b2fad3111d40
5
5
  SHA512:
6
- metadata.gz: 8bca31717e36191165244edb70f5fafb1725fe4d0bdf987593567a9842cacaf296169c9a0be11f6c18e0f2bb8881f118af23d4a6fe940681cb697575626a19a7
7
- data.tar.gz: f223608b761b820461e01f4117607ffa9f1a5a72e474b9947b9386c678775055d45b79eb4ed4c98b91e8adba5f140ecf3031a77b8c8fea54335ff2a111b94e37
6
+ metadata.gz: 4880c390ce6092b2a7b735dd70c35cc05894ccda7f91663178efaf1788b4f58a78051215c0c855b904e9ca06a2f450efa78826f3d361761f517215e57d5d6a5f
7
+ data.tar.gz: 2a2c4fb63a1f3cca599ed9eae7fe2b430f039a261a409670793cda8ac829be86e37e8f459578546fdffa5051d5ac4e0403ce57315b1f91a7d913fb47356d4dc1
data/.gitignore CHANGED
@@ -8,4 +8,5 @@
8
8
  /pkg/
9
9
  /spec/reports/
10
10
  /tmp/
11
+ *.gem
11
12
  tradenity-ruby-sdk.iml
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  Changelog
2
2
  ======
3
3
 
4
+ ## Version 0.1.1
5
+
6
+ - Feature: Add SessionExpiredException
7
+ - Feature Add Tradenity.reset_current_session method
8
+
4
9
  ## Version 0.1.0
5
10
 
6
11
  - Initial release
data/lib/tradenity/api.rb CHANGED
@@ -7,6 +7,11 @@ module Tradenity
7
7
 
8
8
  class << self
9
9
  attr_accessor :api_key, :api_base
10
+
11
+ def reset_current_session
12
+ puts 'Resetting in Tradenity self...'
13
+ Tradenity::HttpClient.get_instance.reset_current_session
14
+ end
10
15
  end
11
16
 
12
17
  end
@@ -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
- raise AuthenticationException.new(error)
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
@@ -1,3 +1,3 @@
1
1
  module Tradenity
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
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.0
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-29 00:00:00.000000000 Z
11
+ date: 2016-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: virtus