id_service 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ require 'id_service/helpers'
8
8
  module IdService
9
9
  class Client
10
10
  include ::Thrift::Client
11
+ include IdService::Helpers
11
12
 
12
13
  def initialize(options = {})
13
14
  options.symbolize_keys!
@@ -41,11 +42,11 @@ private
41
42
  end
42
43
 
43
44
  def send_get_id()
44
- send_message('get_id', Get_id_args)
45
+ send_message('get_id', GetIdArgs)
45
46
  end
46
47
 
47
48
  def recv_get_id()
48
- result = receive_message(Get_id_result)
49
+ result = receive_message(GetIdResult)
49
50
  return result.success unless result.success.nil?
50
51
  raise ::Thrift::ApplicationException.new(::Thrift::ApplicationException::MISSING_RESULT, 'get_id failed: unknown result')
51
52
  end
@@ -1,34 +1,35 @@
1
1
  require 'thrift'
2
2
 
3
3
  module IdService
4
- class Get_id_args
5
- include ::Thrift::Struct, ::Thrift::Struct_Union
4
+ module Helpers
5
+ class GetIdArgs
6
+ include ::Thrift::Struct
7
+ include ::Thrift::Struct_Union
6
8
 
7
- FIELDS = {
9
+ FIELDS = {}
8
10
 
9
- }
11
+ def struct_fields; FIELDS; end
10
12
 
11
- def struct_fields; FIELDS; end
13
+ def validate; end
12
14
 
13
- def validate
15
+ ::Thrift::Struct.generate_accessors self
14
16
  end
15
17
 
16
- ::Thrift::Struct.generate_accessors self
17
- end
18
+ class GetIdResult
19
+ include ::Thrift::Struct
20
+ include ::Thrift::Struct_Union
18
21
 
19
- class Get_id_result
20
- include ::Thrift::Struct, ::Thrift::Struct_Union
21
- SUCCESS = 0
22
+ SUCCESS = 0
22
23
 
23
- FIELDS = {
24
+ FIELDS = {
24
25
  SUCCESS => {:type => ::Thrift::Types::I64, :name => 'success'}
25
- }
26
+ }
26
27
 
27
- def struct_fields; FIELDS; end
28
+ def struct_fields; FIELDS; end
28
29
 
29
- def validate
30
- end
30
+ def validate; end
31
31
 
32
- ::Thrift::Struct.generate_accessors self
32
+ ::Thrift::Struct.generate_accessors self
33
+ end
33
34
  end
34
35
  end
@@ -1,10 +1,11 @@
1
1
  module IdService
2
2
  class Processor
3
3
  include ::Thrift::Processor
4
+ include IdService::Helpers
4
5
 
5
6
  def process_get_id(seqid, iprot, oprot)
6
- args = read_args(iprot, Get_id_args)
7
- result = Get_id_result.new()
7
+ args = read_args(iprot, GetIdArgs)
8
+ result = GetIdResult.new()
8
9
  result.success = @handler.get_id()
9
10
  write_result(result, oprot, 'get_id', seqid)
10
11
  end
@@ -9,10 +9,14 @@ require 'id_generator'
9
9
 
10
10
  module IdService
11
11
  class Server < Thrift::SimpleServer
12
+ attr_reader :hostname, :port, :host, :worker, :debug
13
+
12
14
  def initialize(options = {})
13
15
  options.symbolize_keys!
14
16
  options = default_options.merge(options)
15
17
 
18
+ options.each { |key, value| instance_variable_set('@' + key.to_s, value) }
19
+
16
20
  @handler = IdGenerator.new(options)
17
21
  @processor = IdService::Processor.new(@handler)
18
22
  @server_transport = Thrift::ServerSocket.new(options[:hostname], options[:port].to_s)
@@ -1,4 +1,4 @@
1
1
  module IdService
2
2
  # The version of IdService you are using
3
- VERSION = '0.1.1'
3
+ VERSION = '0.1.2'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: id_service
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-16 00:00:00.000000000 Z
12
+ date: 2013-02-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thrift
@@ -159,7 +159,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
159
159
  version: '0'
160
160
  segments:
161
161
  - 0
162
- hash: 2474586230224755016
162
+ hash: -1492159357958152786
163
163
  required_rubygems_version: !ruby/object:Gem::Requirement
164
164
  none: false
165
165
  requirements: