angus-remote 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,6 @@
1
1
  require 'angus/remote/client'
2
2
  require 'angus/remote/builder'
3
- require 'angus/remote/service_directory'
3
+ require 'angus/remote/proxy_client'
4
4
  require 'angus/remote/response/serializer'
5
+ require 'angus/remote/service_directory'
5
6
  require 'angus/remote/settings'
@@ -37,11 +37,9 @@ module Angus
37
37
  end
38
38
  end
39
39
 
40
- service_definition.proxy_operations.each do |namespace, operations|
41
- operations.each do |operation|
42
- self.define_proxy_operation(remote_service_class, namespace, operation, code_name,
43
- service_definition)
44
- end
40
+ service_definition.proxy_operations.each do |operation|
41
+ self.define_proxy_operation(remote_service_class, operation.service_name, operation,
42
+ code_name, service_definition)
45
43
  end
46
44
 
47
45
  remote_service_class.new(api_url, self.default_timeout, options)
@@ -81,7 +79,9 @@ module Angus
81
79
  path_params = nil,
82
80
  request_params = nil|
83
81
 
84
- service_definition = Angus::Remote::ServiceDirectory.join_proxy(
82
+ require 'picasso-remote'
83
+
84
+ service_definition = Picasso::Remote::ServiceDirectory.join_proxy(
85
85
  service_code_name,
86
86
  service_definition.version,
87
87
  operation.service_name
@@ -89,22 +89,21 @@ module Angus
89
89
 
90
90
  args = [encode_as_json, path_params, request_params]
91
91
 
92
- request_params = Angus::Remote::Builder.extract_var_arg!(args, Hash) || {}
93
- path_params = Angus::Remote::Builder.extract_var_arg!(args, Array) || []
94
- encode_as_json = Angus::Remote::Builder.extract_var_arg!(args, TrueClass) || false
92
+ request_params = Picasso::Remote::Builder.extract_var_arg!(args, Hash) || {}
93
+ path_params = Picasso::Remote::Builder.extract_var_arg!(args, Array) || []
94
+ encode_as_json = Picasso::Remote::Builder.extract_var_arg!(args, TrueClass) || false
95
95
 
96
- request_params = Angus::Remote::Builder.apply_glossary(service_definition.glossary,
96
+ request_params = Picasso::Remote::Builder.apply_glossary(service_definition.glossary,
97
97
  request_params)
98
98
 
99
- request_params = Angus::Remote::Builder.escape_request_params(request_params)
99
+ request_params = Picasso::Remote::Builder.escape_request_params(request_params)
100
100
 
101
101
  response = make_request(operation.path, operation.http_method, encode_as_json,
102
102
  path_params, request_params)
103
103
 
104
- Angus::Remote::Response::Builder.build_from_remote_response(response,
104
+ Picasso::Remote::Response::Builder.build_from_remote_response(response,
105
105
  service_code_name,
106
106
  service_definition.version,
107
- namespace,
108
107
  operation.code_name)
109
108
  end
110
109
  end
@@ -1,7 +1,7 @@
1
1
  module Angus
2
2
  module Remote
3
3
 
4
- VERSION = '0.0.7'
4
+ VERSION = '0.0.8'
5
5
 
6
6
  end
7
7
  end
@@ -3,6 +3,8 @@ require 'spec_helper'
3
3
  require 'angus/remote/client'
4
4
  require 'angus/remote/builder'
5
5
 
6
+ require 'picasso-remote'
7
+
6
8
  describe Angus::Remote::Builder do
7
9
 
8
10
  subject(:builder) { Angus::Remote::Builder }
@@ -14,7 +16,7 @@ describe Angus::Remote::Builder do
14
16
  let(:proxy_operation) { double(:proxy_operation, :code_name=> 'get_users_proxy', :service_name => 'vpos', :path => '/users', :http_method => :get) }
15
17
  let(:glossary) { double(:glossary, :terms_hash_with_long_names => {}) }
16
18
  let(:service_definition) { double(:vpos, :name => 'Vpos', :operations => { 'users' => [operation] },
17
- :proxy_operations => { 'users' => [proxy_operation] }, :version => '0.1', :glossary => glossary) }
19
+ :proxy_operations => [proxy_operation], :version => '0.1', :glossary => glossary) }
18
20
 
19
21
  let(:api_url) { 'http://localhost:8085/vpos/api/0.1/' }
20
22
 
@@ -62,8 +64,9 @@ describe Angus::Remote::Builder do
62
64
  describe 'the generated proxy operation' do
63
65
 
64
66
  before do
65
- Angus::Remote::ServiceDirectory.stub(:service_configuration => { 'v0.1' => { 'doc_url' => 'some_url/doc', 'api_url' => 'some_url/api' } })
66
- Angus::Remote::ServiceDirectory.stub(:fetch_remote_service_definition => { 'service' => { 'service' => 'vpos' }, 'code_name' => 'vpos', 'version' => '0.1', 'operations' => { 'users' => { 'get_users_proxy' => { 'name' => 'Obtener usuarios' } } } })
67
+ Picasso::Remote::ServiceDirectory.stub(:service_configuration => { 'v0.1' => { 'doc_url' => 'some_url/doc', 'api_url' => 'some_url/api' } })
68
+ Picasso::Remote::ServiceDirectory.stub(:fetch_remote_service_definition => { 'service' => { 'service' => 'vpos' }, 'code_name' => 'vpos', 'version' => '0.1', 'operations' => { 'users' => { 'get_users_proxy' => { 'name' => 'Obtener usuarios' } } } })
69
+ Picasso::Remote::Response::Builder.stub(:build_from_remote_response)
67
70
  end
68
71
 
69
72
  it 'makes a request to the remote service' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: angus-remote
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-11-27 00:00:00.000000000 Z
13
+ date: 2013-12-30 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: angus-sdoc