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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 38cb8d12db135dd31536cc93d8158b2ba23dc5bc456d5fb6de42ca2a2f38cf81
4
- data.tar.gz: 0d157839522268b64e4889b160b510ccf21fd17db2fa1fc6366dda1d13af874b
3
+ metadata.gz: 489dcad693c3d72196d2e29ace9b913d4e374b395c2abe808091b89f63ffe1b5
4
+ data.tar.gz: 25835f8a6e49fb88e854375a0ccb47b933d74e8fddc81805bb409eb95c0047fc
5
5
  SHA512:
6
- metadata.gz: 4a906308b603fa51def2b7f086d251acd9ed9c025a1b44ca8afa6b150c73bf8a5264e9249dcb84dc3f9cab0dde47bab28d5c5eafc9f8189c04741ff913a5174d
7
- data.tar.gz: b7abe26ab5262049773bf9e0a935631ce0b82b6626f5b61854c7b5097acaae4eadcf2f5f4aa07cae783e145b92a5c19bd70089c42097b3629aa67d10716dfa3b
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
- !!self[:success] && self[:errors].empty?
52
+ !!success
46
53
  end
47
54
 
48
55
  end
@@ -1,3 +1,3 @@
1
1
  module SilencerShop
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.1.5'.freeze
3
3
  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.0
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-06-03 00:00:00.000000000 Z
11
+ date: 2021-07-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport