FlipkartSeller 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/FlipkartSeller/exception.rb +43 -7
- data/lib/FlipkartSeller/product.rb +7 -7
- data/lib/FlipkartSeller/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7716d42278546c5a9f8e1c00feab935e6bf3d19f
|
4
|
+
data.tar.gz: e05026b70d6319558e9280f1b54578fb77b143ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04b05e08c25fbc24a3088ba0829ac3121bbf58792cdfbdfe0040ec299d0ec2a397810bf2766c5e731d19a8cd99e427a572d2130008343763865f1c3423e8791b
|
7
|
+
data.tar.gz: f17484b4f96ee50878a2c32965c7d138b1b52984768c163424b3d3186cb1d970da1c11ee8b3df08e2bbc3bcf09b83a260c7448d87c97dba794b9f91ebf49ac0e
|
@@ -1,17 +1,53 @@
|
|
1
1
|
module FlipkartSeller
|
2
2
|
|
3
|
-
class Exception < StandardError
|
3
|
+
class Exception < StandardError
|
4
|
+
attr_reader :response
|
4
5
|
|
5
|
-
|
6
|
+
def initialize(response)
|
7
|
+
@response = response
|
8
|
+
end
|
9
|
+
end
|
6
10
|
|
7
|
-
|
11
|
+
#for 400 response
|
12
|
+
class BadRequest < Exception
|
13
|
+
def initialize(response)
|
14
|
+
super(response)
|
15
|
+
end
|
16
|
+
end
|
8
17
|
|
9
|
-
|
18
|
+
#for 403 response
|
19
|
+
class Forbidden < Exception
|
20
|
+
def initialize(response)
|
21
|
+
super(response)
|
22
|
+
end
|
23
|
+
end
|
10
24
|
|
11
|
-
|
25
|
+
#for 404 response
|
26
|
+
class NotFound < Exception
|
27
|
+
def initialize(response)
|
28
|
+
super(response)
|
29
|
+
end
|
30
|
+
end
|
12
31
|
|
13
|
-
|
32
|
+
# for 500 response
|
33
|
+
class InternalServerError < Exception
|
34
|
+
def initialize(response)
|
35
|
+
super(response)
|
36
|
+
end
|
37
|
+
end
|
14
38
|
|
15
|
-
|
39
|
+
# for 503 response
|
40
|
+
class ServiceUnavailable < Exception
|
41
|
+
def initialize(response)
|
42
|
+
super(response)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
# for 599 response
|
47
|
+
class ConnectionTimedOut < Exception
|
48
|
+
def initialize(response)
|
49
|
+
super(response)
|
50
|
+
end
|
51
|
+
end
|
16
52
|
|
17
53
|
end
|
@@ -18,22 +18,22 @@ module FlipkartSeller
|
|
18
18
|
|
19
19
|
rescue RestClient::Unauthorized, RestClient::Forbidden => e
|
20
20
|
|
21
|
-
raise Forbidden.new(e.response)
|
21
|
+
raise Forbidden.new(e.response), e.message
|
22
22
|
|
23
23
|
rescue RestClient::ExceptionWithResponse => e
|
24
24
|
case e.response.code
|
25
25
|
when 400
|
26
|
-
raise BadRequest.new(e.response)
|
26
|
+
raise BadRequest.new(e.response), e.message
|
27
27
|
when 403
|
28
|
-
raise Forbidden.new(e.response)
|
28
|
+
raise Forbidden.new(e.response), e.message
|
29
29
|
when 404
|
30
|
-
raise NotFound.new(e.response)
|
30
|
+
raise NotFound.new(e.response), e.message
|
31
31
|
when 500
|
32
|
-
raise InternalServerError.new(e.response)
|
32
|
+
raise InternalServerError.new(e.response), e.message
|
33
33
|
when 503
|
34
|
-
raise ServiceUnavailable.new(e.response)
|
34
|
+
raise ServiceUnavailable.new(e.response), e.message
|
35
35
|
when 599
|
36
|
-
raise ConnectionTimedOut.new(e.response)
|
36
|
+
raise ConnectionTimedOut.new(e.response), e.message
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|