FlipkartSeller 0.0.6 → 0.0.7
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.
- checksums.yaml +4 -4
- data/lib/FlipkartSeller/exception.rb +8 -1
- data/lib/FlipkartSeller/product.rb +54 -28
- data/lib/FlipkartSeller/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: 2a33812e9a69b71227cbafe2ffda7a30941d4080
|
4
|
+
data.tar.gz: e59dbd17a12431448bef6156a6ee15d75e3ce97b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a85dc412526b0247460e3524d244f4844346f07498f752f7f087ae327604eeed6ca7514528befe316c8cf23a21bb434bcddb4ac13883461e7d9ebab2213a0d
|
7
|
+
data.tar.gz: 517c947ca7a9a29842fe6c6aee7e0434744739ba6e8a7cb04f81c3025859c2b617f05012340466b350eca7578f74c1fa7014fa820eb265c8aea6fb7aa2a06b4b
|
@@ -1,5 +1,6 @@
|
|
1
1
|
module FlipkartSeller
|
2
|
-
|
2
|
+
|
3
|
+
class StandardException < StandardError; end
|
3
4
|
class Exception < StandardError
|
4
5
|
attr_reader :response
|
5
6
|
|
@@ -48,6 +49,12 @@ module FlipkartSeller
|
|
48
49
|
def initialize(response)
|
49
50
|
super(response)
|
50
51
|
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class OtherException < Exception
|
55
|
+
def initialize(response)
|
56
|
+
super(response)
|
57
|
+
end
|
51
58
|
end
|
52
59
|
|
53
60
|
end
|
@@ -11,31 +11,36 @@ module FlipkartSeller
|
|
11
11
|
:headers => {'Authorization' => 'Bearer ' + @access_token, :content_type => 'application/json'}
|
12
12
|
)
|
13
13
|
|
14
|
-
|
15
|
-
|
16
|
-
return response_data
|
17
|
-
end
|
14
|
+
response_data = JSON.parse(response.body)
|
15
|
+
return response_data
|
18
16
|
|
19
|
-
rescue RestClient::Unauthorized, RestClient::Forbidden => e
|
20
|
-
|
21
|
-
raise Forbidden.new(e.response), e.message
|
22
17
|
|
23
18
|
rescue RestClient::ExceptionWithResponse => e
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
19
|
+
raise StandardException.new if e.response.blank?
|
20
|
+
|
21
|
+
if e.response.code.present? && [400,403,404,500,503,599].include?(e.response.code)
|
22
|
+
case e.response.code
|
23
|
+
when 400
|
24
|
+
raise BadRequest.new(e.response), e.message
|
25
|
+
when 403
|
26
|
+
raise Forbidden.new(e.response), e.message
|
27
|
+
when 404
|
28
|
+
raise NotFound.new(e.response), e.message
|
29
|
+
when 500
|
30
|
+
raise InternalServerError.new(e.response), e.message
|
31
|
+
when 503
|
32
|
+
raise ServiceUnavailable.new(e.response), e.message
|
33
|
+
when 599
|
34
|
+
raise ConnectionTimedOut.new(e.response), e.message
|
35
|
+
else
|
36
|
+
raise OtherException.new(e.response), e.message
|
37
|
+
end
|
38
|
+
else
|
39
|
+
raise OtherException.new(e.response), e.message
|
40
|
+
end
|
41
|
+
rescue Exception => e
|
42
|
+
raise StandardException.new
|
43
|
+
end
|
39
44
|
|
40
45
|
end
|
41
46
|
|
@@ -73,15 +78,36 @@ module FlipkartSeller
|
|
73
78
|
:payload=> "#{data.to_json}"
|
74
79
|
)
|
75
80
|
|
76
|
-
|
77
|
-
response_data = JSON.parse(response.body)
|
81
|
+
response_data = JSON.parse(response.body)
|
78
82
|
|
79
|
-
|
80
|
-
end
|
83
|
+
return response_data
|
81
84
|
|
82
|
-
|
83
|
-
|
85
|
+
rescue RestClient::ExceptionWithResponse => e
|
86
|
+
raise StandardException.new if e.response.blank?
|
87
|
+
|
88
|
+
if e.response.code.present? && [400,403,404,500,503,599].include?(e.response.code)
|
89
|
+
case e.response.code
|
90
|
+
when 400
|
91
|
+
raise BadRequest.new(e.response), e.message
|
92
|
+
when 403
|
93
|
+
raise Forbidden.new(e.response), e.message
|
94
|
+
when 404
|
95
|
+
raise NotFound.new(e.response), e.message
|
96
|
+
when 500
|
97
|
+
raise InternalServerError.new(e.response), e.message
|
98
|
+
when 503
|
99
|
+
raise ServiceUnavailable.new(e.response), e.message
|
100
|
+
when 599
|
101
|
+
raise ConnectionTimedOut.new(e.response), e.message
|
102
|
+
else
|
103
|
+
raise OtherException.new(e.response), e.message
|
84
104
|
end
|
105
|
+
else
|
106
|
+
raise OtherException.new(e.response), e.message
|
107
|
+
end
|
108
|
+
rescue Exception => e
|
109
|
+
raise StandardException.new
|
110
|
+
end
|
85
111
|
|
86
112
|
end
|
87
113
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: FlipkartSeller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Atish Kumar Sahoo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|