grpc_kit 0.1.10 → 0.1.11

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: 8758d861d7f15069510676fb10809b04e88dcce7ad1fba77bbad60aa1140d508
4
- data.tar.gz: 85c19955c66574e418d190915b9426aca629776a7ea7393ebabe44656c101ab4
3
+ metadata.gz: 6934bf16ccf69b6ba90fcbb6047a742a6f8650f983a6a63decc1a8d23663905b
4
+ data.tar.gz: 72afafb9a4ab33b2902e7cc224493317bd59590623a6c7de7db18adddf048505
5
5
  SHA512:
6
- metadata.gz: 9642ed431c3fbaa305c9b47f2ddc4ce189c0c2366dbfe80b5b7c913d0da80b5f8ec8240fc981c61646f9b140e72a9e4a7694378809bb2afcb85e69218cd0f612
7
- data.tar.gz: 6b231bb959a8b2758a9ff48f06749dd4d6ab37369ce9a82f5a5070ed67ea9eba358d1ed4b9f0e27499eb56059119e87eef03f050adf59d6e042d2cc0c506586b
6
+ metadata.gz: 8cf73c55066c743b74cff8fa179a8cc3546fefdbe18e86b965a2cdb5bcf3db14c8dd75eeb8f9f771bb001cc1d099b3c4b04118e9bbccbffc69d1ebe49cb5bce2
7
+ data.tar.gz: 5dd4e03dd79f6b226a55a8255e957788823310e1e7697735d450e9fda50e9aaaa4b34f347eba6df6ad2fcdc8392d83168e152c59c061001adaf4fb9905000926
data/lib/grpc.rb CHANGED
@@ -2,10 +2,5 @@
2
2
 
3
3
  # Compatible file for xx_services_pb.rb and xx_pb.rb which are created by grpc-tools gem
4
4
  require 'grpc_kit'
5
- require 'grpc_kit/grpc/core'
6
- require 'grpc_kit/grpc/errors'
7
- require 'grpc_kit/grpc/generic_service'
8
- require 'grpc_kit/grpc/interceptor'
9
- require 'grpc_kit/grpc/logger'
10
5
 
11
6
  GRPC = GrpcKit::GRPC
@@ -29,6 +29,20 @@ module GrpcKit
29
29
  end
30
30
  end
31
31
 
32
+ class Ok < BadStatus
33
+ # @param message [String]
34
+ def initialize(message)
35
+ super(GrpcKit::StatusCodes::OK, message)
36
+ end
37
+ end
38
+
39
+ class Cancelled < BadStatus
40
+ # @param message [String]
41
+ def initialize(message)
42
+ super(GrpcKit::StatusCodes::CANCELLED, message)
43
+ end
44
+ end
45
+
32
46
  class Unknown < BadStatus
33
47
  # @param message [String]
34
48
  def initialize(message)
@@ -36,6 +50,13 @@ module GrpcKit
36
50
  end
37
51
  end
38
52
 
53
+ class InvalidArgument < BadStatus
54
+ # @param message [String]
55
+ def initialize(message)
56
+ super(GrpcKit::StatusCodes::INVALID_ARGUMENT, message)
57
+ end
58
+ end
59
+
39
60
  class DeadlineExceeded < BadStatus
40
61
  # @param message [String]
41
62
  def initialize(message)
@@ -43,10 +64,24 @@ module GrpcKit
43
64
  end
44
65
  end
45
66
 
46
- class Unimplemented < BadStatus
67
+ class NotFound < BadStatus
47
68
  # @param message [String]
48
69
  def initialize(message)
49
- super(GrpcKit::StatusCodes::UNIMPLEMENTED, message)
70
+ super(GrpcKit::StatusCodes::NOT_FOUND, message)
71
+ end
72
+ end
73
+
74
+ class AlreadyExists < BadStatus
75
+ # @param message [String]
76
+ def initialize(message)
77
+ super(GrpcKit::StatusCodes::ALREADY_EXISTS, message)
78
+ end
79
+ end
80
+
81
+ class PermissionDenied < BadStatus
82
+ # @param message [String]
83
+ def initialize(message)
84
+ super(GrpcKit::StatusCodes::PERMISSION_DENIED, message)
50
85
  end
51
86
  end
52
87
 
@@ -57,6 +92,34 @@ module GrpcKit
57
92
  end
58
93
  end
59
94
 
95
+ class FailedPrecondition < BadStatus
96
+ # @param message [String]
97
+ def initialize(message)
98
+ super(GrpcKit::StatusCodes::FAILED_PRECONDITION, message)
99
+ end
100
+ end
101
+
102
+ class Aborted < BadStatus
103
+ # @param message [String]
104
+ def initialize(message)
105
+ super(GrpcKit::StatusCodes::ABORTED, message)
106
+ end
107
+ end
108
+
109
+ class OutOfRange < BadStatus
110
+ # @param message [String]
111
+ def initialize(message)
112
+ super(GrpcKit::StatusCodes::OUT_OF_RANGE, message)
113
+ end
114
+ end
115
+
116
+ class Unimplemented < BadStatus
117
+ # @param message [String]
118
+ def initialize(message)
119
+ super(GrpcKit::StatusCodes::UNIMPLEMENTED, message)
120
+ end
121
+ end
122
+
60
123
  class Internal < BadStatus
61
124
  # @param message [String]
62
125
  def initialize(message)
@@ -64,25 +127,53 @@ module GrpcKit
64
127
  end
65
128
  end
66
129
 
130
+ class Unavailable < BadStatus
131
+ # @param message [String]
132
+ def initialize(message)
133
+ super(GrpcKit::StatusCodes::UNAVAILABLE, message)
134
+ end
135
+ end
136
+
137
+ class DataLoss < BadStatus
138
+ # @param message [String]
139
+ def initialize(message)
140
+ super(GrpcKit::StatusCodes::DATA_LOSS, message)
141
+ end
142
+ end
143
+
144
+ class Unauthenticated < BadStatus
145
+ # @param message [String]
146
+ def initialize(message)
147
+ super(GrpcKit::StatusCodes::UNAUTHENTICATED, message)
148
+ end
149
+ end
150
+
151
+ class DoNotUse < BadStatus
152
+ # @param message [String]
153
+ def initialize(message)
154
+ super(GrpcKit::StatusCodes::DO_NOT_USE, message)
155
+ end
156
+ end
157
+
67
158
  CODES = {
68
- # GrpcKit::StatusCode::OK => 'OK',
69
- # GrpcKit::StatusCode::CANCELLED => 'CANCELLED',
159
+ GrpcKit::StatusCodes::OK => Ok,
160
+ GrpcKit::StatusCodes::CANCELLED => Cancelled,
70
161
  GrpcKit::StatusCodes::UNKNOWN => Unknown,
71
- # GrpcKit::StatusCode::INVALID_ARGUMENT => 'INVALID_ARGUMENT',
162
+ GrpcKit::StatusCodes::INVALID_ARGUMENT => InvalidArgument,
72
163
  GrpcKit::StatusCodes::DEADLINE_EXCEEDED => DeadlineExceeded,
73
- # GrpcKit::StatusCode::NOT_FOUND => 'NOT_FOUND',
74
- # GrpcKit::StatusCode::ALREADY_EXISTS => 'ALREADY_EXISTS',
75
- # GrpcKit::StatusCode::PERMISSION_DENIED => 'PERMISSION_DENIED',
164
+ GrpcKit::StatusCodes::NOT_FOUND => NotFound,
165
+ GrpcKit::StatusCodes::ALREADY_EXISTS => AlreadyExists,
166
+ GrpcKit::StatusCodes::PERMISSION_DENIED => PermissionDenied,
76
167
  GrpcKit::StatusCodes::RESOURCE_EXHAUSTED => ResourceExhausted,
77
- # GrpcKit::StatusCode::FAILED_PRECONDITION => 'FAILED_PRECONDITION',
78
- # GrpcKit::StatusCode::ABORTED => 'ABORTED',
79
- # GrpcKit::StatusCode::OUT_OF_RANGE => 'OUT_OF_RANGE',
168
+ GrpcKit::StatusCodes::FAILED_PRECONDITION => FailedPrecondition,
169
+ GrpcKit::StatusCodes::ABORTED => Aborted,
170
+ GrpcKit::StatusCodes::OUT_OF_RANGE => OutOfRange,
80
171
  GrpcKit::StatusCodes::UNIMPLEMENTED => Unimplemented,
81
172
  GrpcKit::StatusCodes::INTERNAL => Internal,
82
- # GrpcKit::StatusCode::UNAVAILABLE => 'UNAVAILABLE',
83
- # GrpcKit::StatusCode::DATA_LOSS => 'DATA_LOSS',
84
- # GrpcKit::StatusCode::UNAUTHENTICATED => 'UNAUTHENTICATED',
85
- # GrpcKit::StatusCode::DO_NOT_USE => 'DO_NOT_USE',
173
+ GrpcKit::StatusCodes::UNAVAILABLE => Unavailable,
174
+ GrpcKit::StatusCodes::DATA_LOSS => DataLoss,
175
+ GrpcKit::StatusCodes::UNAUTHENTICATED => Unauthenticated,
176
+ GrpcKit::StatusCodes::DO_NOT_USE => DoNotUse,
86
177
  }.freeze
87
178
  end
88
179
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'grpc_kit'
3
+ require 'grpc_kit/status_codes'
4
4
 
5
5
  module GrpcKit
6
6
  module GRPC
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GrpcKit
4
- VERSION = '0.1.10'
4
+ VERSION = '0.1.11'
5
5
  end
data/lib/grpc_kit.rb CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  require 'logger'
4
4
 
5
+ require 'grpc_kit/grpc/core'
6
+ require 'grpc_kit/grpc/errors'
7
+ require 'grpc_kit/grpc/generic_service'
8
+ require 'grpc_kit/grpc/interceptor'
9
+ require 'grpc_kit/grpc/logger'
5
10
  require 'grpc_kit/version'
6
11
  require 'grpc_kit/server'
7
12
  require 'grpc_kit/client'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - ganmacs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2018-11-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ds9