elementary-rpc 1.1.0 → 1.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69b9b5d2909967aae631ba36ee3209ada7a5f139
4
- data.tar.gz: ee1e219ebba8f88da2da2d9141cd26166c97e497
3
+ metadata.gz: 56fcda60e0f593913eeafcab46d20825dd8e8e20
4
+ data.tar.gz: a75f8e552bde90fc53250b704107da1ed4ae07e7
5
5
  SHA512:
6
- metadata.gz: 171be7ee2734311afa37c71fa8f71ed65908c8aafc859988c226789272485c6d86f74d08e5cdadb4fe061fff057fdaea01a3c2240cc370547e1f5e69e5da9a9c
7
- data.tar.gz: 6f25161ef2b97092eb75442d167b2a42289e55047d766b754b835714ef6b994a72db3dd78173daf321c8af192bbfc66337631fb80a8fd9b23d5a609fc0cb4241
6
+ metadata.gz: ec48386473339fefb812d282caef334ca3d139f172b2e38c3fe0427e3241fc3666920168334c31a8b3ece8fa7eacf34d627ab9e37a7fd4fb52be908fbb264635
7
+ data.tar.gz: 199316aa44f9d82c1845f8cfc7cfc28062073c74c6c604b4b45d2f1f037a6e1db7629f7926e1958543f9b5c0ca112369897932075ee90cf919a8d938b7036ae9
data/Gemfile CHANGED
@@ -4,8 +4,7 @@ source 'https://rubygems.org'
4
4
  gemspec
5
5
 
6
6
  gem 'rack'
7
- gem 'protobuf', :github => 'lookout/protobuf',
8
- :ref => 'wip/http'
7
+ gem 'protobuf', :github => 'lookout/protobuffy'
9
8
 
10
9
  group :test do
11
10
  gem 'rspec'
data/README.md CHANGED
@@ -88,3 +88,7 @@ TODO: Write usage instructions here
88
88
  3. Commit your changes (`git commit -am 'Add some feature'`)
89
89
  4. Push to the branch (`git push origin my-new-feature`)
90
90
  5. Create a new Pull Request
91
+
92
+ ### Testing
93
+
94
+ `bundle exec rpc_server start ./spec/support/simpleservice.rb -p 8000 --http`
@@ -21,8 +21,9 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.6"
22
22
  spec.add_development_dependency "rake"
23
23
 
24
- spec.add_dependency 'concurrent-ruby', '~> 0.6.0'
24
+ spec.add_dependency 'concurrent-ruby', '~> 0.7.0'
25
25
  spec.add_dependency 'faraday', '~> 0.9.0'
26
26
  spec.add_dependency 'net-http-persistent', '~> 2.9.4'
27
27
  spec.add_dependency 'lookout-statsd', '~> 0.9.0'
28
+ spec.add_dependency 'hashie'
28
29
  end
@@ -1,5 +1,6 @@
1
1
  require 'rubygems'
2
2
  require 'protobuf'
3
+ require 'hashie'
3
4
 
4
5
  require 'elementary/middleware'
5
6
  require 'elementary/transport'
@@ -22,6 +23,8 @@ module Elementary
22
23
  # will be passed down to the transport layer. This will depend on what
23
24
  # options are available by the underlying transport
24
25
  def initialize(service, opts={})
26
+ opts = Hashie::Mash.new(opts)
27
+
25
28
  if service.nil? || service.superclass != Protobuf::Rpc::Service
26
29
  raise ArgumentError,
27
30
  "Cannot construct an Elementary::Connection with `#{service}` (#{service.class})"
@@ -1,4 +1,4 @@
1
1
 
2
2
  module Elementary
3
- VERSION = "1.1.0"
3
+ VERSION = "1.2.0"
4
4
  end
@@ -21,6 +21,38 @@ describe Elementary::Connection do
21
21
  end
22
22
  end
23
23
 
24
+ context 'with an opts hash' do
25
+ subject(:connection) { described_class.new(Elementary::Rspec::Simple, opts) }
26
+
27
+ context 'with symbolic keys' do
28
+ let(:opts) { { :hosts => [{:host => 'foo', :prefix => '/bar'}] } }
29
+
30
+ it { should be_instance_of described_class }
31
+
32
+ it 'should have one host, with a host key and a prefix key' do
33
+ hosts = connection.instance_variable_get(:@hosts)
34
+
35
+ expect(hosts.size).to be 1
36
+ expect(hosts.first[:host]).to eql opts[:hosts].first[:host]
37
+ expect(hosts.first[:prefix]).to eql opts[:hosts].first[:prefix]
38
+ end
39
+ end
40
+
41
+ context 'with string keys' do
42
+ let(:opts) { { 'hosts' => [{'host' => 'foo', 'prefix' => '/bar'}] } }
43
+
44
+ it { should be_instance_of described_class }
45
+
46
+ it 'should have one host, with a host key and a prefix key' do
47
+ hosts = connection.instance_variable_get(:@hosts)
48
+
49
+ expect(hosts.size).to be 1
50
+ expect(hosts.first[:host]).to eql opts['hosts'].first['host']
51
+ expect(hosts.first[:prefix]).to eql opts['hosts'].first['prefix']
52
+ end
53
+ end
54
+ end
55
+
24
56
  context 'with a simple RPC service' do
25
57
  let(:opts) { {} }
26
58
  let(:connection) do
@@ -36,10 +68,10 @@ describe Elementary::Connection do
36
68
  context 'with transport_options' do
37
69
  let(:opts) { {:transport_options => transport_opts} }
38
70
  let(:transport_opts) do
39
- {
71
+ Hashie::Mash.new({
40
72
  :timeout => 3,
41
73
  :open_timeout => 1,
42
- }
74
+ })
43
75
  end
44
76
 
45
77
  it 'should pass request_options to the transport' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elementary-rpc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - R. Tyler Croy
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-15 00:00:00.000000000 Z
11
+ date: 2014-10-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -44,14 +44,14 @@ dependencies:
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 0.6.0
47
+ version: 0.7.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 0.6.0
54
+ version: 0.7.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: faraday
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -94,6 +94,20 @@ dependencies:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: 0.9.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: hashie
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :runtime
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
97
111
  description: BLANK
98
112
  email:
99
113
  - tyler@monkeypox.org