service_caller 0.1.5 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/service_error.rb +5 -9
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 20ce7703f194079bb764badfa581cc5671af4faa10a70fe93c42f72bf11ceceb
4
- data.tar.gz: 75ffc9937b1c6d80f0ec904d45eaade08649f964e8571db43887ca689907d694
3
+ metadata.gz: c5284539790a1d66ff79136adf0cec9cda146845e1f90b95537b44a7923824bf
4
+ data.tar.gz: ad3aeac59b19ca57e4822a299eb3c0d3c06b7100ea1e69172d8ab695c0e2668d
5
5
  SHA512:
6
- metadata.gz: '08e6f4ee167e006b22b8a97fd5d815160e8cd8ec283aff4e0ef5dda31c6dd76b968edee6b66b525e1436f6e64c8c3a36a5f0b64588ecce8b6b37abdf34a38d5e'
7
- data.tar.gz: 23d19bb1d065f7e0691b5c514543ade7cf9a9d456c5c1c0d46886d7ceedc8d6a646f6a6aa8041b51266d14945075e729aff0cfebeed429b9c3ee04d9e5ba3242
6
+ metadata.gz: 8c84a748b42fa8d69ea32197ae170b5fc4f92f9f1c9ff8f08ef4597ab3f97213df2ea1917ff6b0ea596fe6c3e728aab346fee26379b59bbb53652029a994f40c
7
+ data.tar.gz: ad0a0fd20c82cde47ed87b95ee9b561ff0c13b06091f4ca3008d8304b9f370dfe48041f630f5faf26f033c44efc458cb9d1204ff852dd87c0c9cac318e92c18f
data/lib/service_error.rb CHANGED
@@ -1,20 +1,16 @@
1
1
  class ServiceError < StandardError
2
- attr_reader :code
2
+ attr_reader :key
3
3
 
4
4
  class << self
5
5
  def generate_from_exception(exception)
6
- service_err = new(500, "#{exception.class.name}: #{exception.message}")
6
+ service_err = new(:internal_error, "#{exception.class.name}: #{exception.message}")
7
7
  service_err.set_backtrace(exception.backtrace)
8
8
  service_err
9
9
  end
10
-
11
- def generate_from_hash(error_hash)
12
- new(error_hash[:error_code], error_hash[:error_message])
13
- end
14
10
  end
15
11
 
16
- def initialize(code, message)
17
- @code = code
18
- super(message)
12
+ def initialize(key, message=nil)
13
+ @key = key
14
+ super(message || key)
19
15
  end
20
16
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_caller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - JiaRou Lee
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-08 00:00:00.000000000 Z
11
+ date: 2019-08-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: basic implement of service object
14
14
  email: laura34963@kdanmobile.com