silencer_shop 1.1.0 → 1.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/silencer_shop/response.rb +9 -2
- data/lib/silencer_shop/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 489dcad693c3d72196d2e29ace9b913d4e374b395c2abe808091b89f63ffe1b5
|
4
|
+
data.tar.gz: 25835f8a6e49fb88e854375a0ccb47b933d74e8fddc81805bb409eb95c0047fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e69297ccef14f769fe0297886ee6650206bc77b2f8ce4be0f712f24649a554e1a23e0df3a5d7e365d4729ddae039a9cd0d7c541e9d6a719ee6a54fc164acd25d
|
7
|
+
data.tar.gz: 1eb6271f3268ffc68842a3fbc9767a63cbca11c1964f3307c3fdd293d7b79a22b727e9757bc178aed69a6ca286928f4e0c17cdacd84bbb363dcf28afd923b89f
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module SilencerShop
|
2
2
|
class Response
|
3
3
|
|
4
|
+
attr_accessor :success
|
5
|
+
|
4
6
|
def initialize(response)
|
5
7
|
@response = response
|
6
8
|
|
@@ -13,13 +15,18 @@ module SilencerShop
|
|
13
15
|
SilencerShop::Error::NoContent.new(@response.body)
|
14
16
|
when Net::HTTPOK, Net::HTTPSuccess
|
15
17
|
_data = (JSON.parse(@response.body) if @response.body.present?)
|
16
|
-
|
17
18
|
@data = case
|
18
19
|
when _data.is_a?(Hash)
|
19
20
|
_data.deep_symbolize_keys
|
20
21
|
when _data.is_a?(Array)
|
21
22
|
_data.map(&:deep_symbolize_keys)
|
22
23
|
end
|
24
|
+
|
25
|
+
if @data.is_a?(Hash) && @data.has_key?(:ErrorMessage)
|
26
|
+
raise SilencerShop::Error::RequestError.new(@data[:ErrorMessage])
|
27
|
+
end
|
28
|
+
|
29
|
+
self.success = true
|
23
30
|
else
|
24
31
|
if @response.body =~ /unable to verify credentials/i
|
25
32
|
SilencerShop::Error::NotAuthorized.new(@response.body)
|
@@ -42,7 +49,7 @@ module SilencerShop
|
|
42
49
|
end
|
43
50
|
|
44
51
|
def success?
|
45
|
-
!!
|
52
|
+
!!success
|
46
53
|
end
|
47
54
|
|
48
55
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: silencer_shop
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeffrey Dill
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|