wework 0.1.9 → 0.2.0

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: 80b30548f4c9c7c1192ee26ecdbce4ff7b1aedbb
4
- data.tar.gz: 90a472517c64284b135d8c201600f616c56932c1
3
+ metadata.gz: 7dffeebfa4fffccab3b0a28b5cc581a801ebf63e
4
+ data.tar.gz: d1d77e3344ceea9b83f98066931ff7ba649dae6d
5
5
  SHA512:
6
- metadata.gz: 6fd3ba398473aaf178792f43d323d7d892df76cacbfc1481bf98d199b3379ab3537b9cf52e76475eb6b1d48ea16ebc03021471dc35f8be21fdcc8a81f115376b
7
- data.tar.gz: 972639358ace14e78e8b6dbac54a51e74a13ca1ec99e364d8ac0b6ccb1edd843b15faac5dcee5c1b22d5fe3f121b9b0116a1ff7bcc70d1fd92f607843bc945a3
6
+ metadata.gz: 49b226e216980d916b24ff5905455d1cbdd18d1b55e9252620db7b49afa18fd90c4f3cb19a50c71edb739cc0e821cd75f6d600fecec2f7a100cce2541c87360f
7
+ data.tar.gz: 25ca0092cceaac5a379d2eac7a3681bfbf50a7fb19f9572abb8512b817b58ffc5553d9e24888ad6416f807bd831e57fc20a9a3a8b95280162debbac03731830e
@@ -22,6 +22,7 @@ module Wework
22
22
  # Exceptions
23
23
  class RedisNotConfigException < RuntimeError; end
24
24
  class AccessTokenExpiredError < RuntimeError; end
25
+ class ResultErrorException < RuntimeError; end
25
26
  class ResponseError < StandardError
26
27
  attr_reader :error_code
27
28
  def initialize(errcode, errmsg='')
@@ -94,6 +94,10 @@ module Wework
94
94
  [42001, 40014, 40001].include?(errcode)
95
95
  end
96
96
 
97
+ def throw_error
98
+ raise ResultErrorException.new(full_message) unless success?
99
+ end
100
+
97
101
  def success?
98
102
  errcode == SUCCESS_CODE
99
103
  end
@@ -1,3 +1,3 @@
1
1
  module Wework
2
- VERSION = '0.1.9'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - seandong