rapuncel 0.0.2 → 0.0.3

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.
@@ -38,8 +38,8 @@ module Rapuncel
38
38
  def call_to_ruby name, *args
39
39
  response = call name, *args
40
40
 
41
- raise_on_fault && response.fault? && raise(Response::Fault, response.fault.inspect)
42
- raise_on_error && response.error? && raise(Response::Error, response.error.inspect)
41
+ raise_on_fault && response.fault? && raise_fault(response)
42
+ raise_on_error && response.error? && raise_error(response)
43
43
 
44
44
  response.to_ruby
45
45
  end
@@ -50,5 +50,14 @@ module Rapuncel
50
50
 
51
51
  Response.new send_method_call(xml)
52
52
  end
53
+
54
+ private
55
+ def raise_fault response
56
+ raise(Response::Fault, response.fault[:faultCode], response.fault[:faultString].split("\n"))
57
+ end
58
+
59
+ def raise_error response
60
+ raise(Response::Error, "HTTP Error: #{response.error.inspect}")
61
+ end
53
62
  end
54
63
  end
data/rapuncel.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "rapuncel"
3
- s.version = "0.0.2"
3
+ s.version = "0.0.3"
4
4
  s.date = Time.now.strftime("%Y-%m-%d")
5
5
  s.authors = ["Michael Eickenberg", "Marian Theisen"]
6
6
  s.email = 'marian@cice-online.net'
@@ -2,7 +2,7 @@ require 'functional_test_helper'
2
2
 
3
3
  class FunctionalClientTest < FunctionalTest
4
4
  test "Simple XMLRPC call" do
5
- client = Rapuncel::Client.new :port => 8080, :raise_on => :both
5
+ client = Rapuncel::Client.new :port => 9485, :raise_on => :both
6
6
  proxy = client.proxy_for 'num'
7
7
 
8
8
  result = proxy.add 40, 2
@@ -11,7 +11,7 @@ class FunctionalClientTest < FunctionalTest
11
11
  end
12
12
 
13
13
  test "Fault rpc call without raise" do
14
- client = Rapuncel::Client.new :port => 8080
14
+ client = Rapuncel::Client.new :port => 9485
15
15
  proxy = client.proxy_for 'num'
16
16
 
17
17
  assert_nothing_raised Rapuncel::Response::Exception do
@@ -22,7 +22,7 @@ class FunctionalClientTest < FunctionalTest
22
22
  end
23
23
 
24
24
  test "Fault rpc call" do
25
- client = Rapuncel::Client.new :port => 8080, :raise_on => :both
25
+ client = Rapuncel::Client.new :port => 9485, :raise_on => :both
26
26
  proxy = client.proxy_for 'num'
27
27
 
28
28
  assert_raise Rapuncel::Response::Fault do
data/test/test_server.rb CHANGED
@@ -6,40 +6,17 @@ class Num
6
6
  INTERFACE = XMLRPC::interface("num") {
7
7
  meth 'int add(int, int)', 'Add two numbers', 'add'
8
8
  meth 'int div(int, int)', 'Divide two numbers'
9
- meth 'int rows', "Return a bunch of hashes"
10
9
  }
11
10
 
12
11
  def add(a, b) a + b end
13
12
  def div(a, b) a / b end
14
-
15
- def initialize
16
- @rows = []
17
-
18
- 10000.times do |i|
19
- @rows << {
20
- :first_name => Faker::Name.first_name,
21
- :last_name => Faker::Name.last_name,
22
- :street => Faker::Address.street_name,
23
- :zip_code => Faker::Address.zip_code,
24
- :city => Faker::Address.city,
25
- :us_state => Faker::Address.us_state,
26
- :company => Faker::Company.name
27
- }
28
- end
29
- end
30
-
31
-
32
- def rows
33
- @rows
34
- end
35
13
  end
36
14
 
37
-
38
15
  class TestServer
39
16
  attr_accessor :server
40
17
 
41
18
  def initialize
42
- @server = XMLRPC::Server.new(8080, '127.0.0.1', 4, File.open('/dev/null','w')).tap do |s|
19
+ @server = XMLRPC::Server.new(9485, '127.0.0.1', 4, File.open('/dev/null','w')).tap do |s|
43
20
  s.add_handler(Num::INTERFACE, Num.new)
44
21
  end
45
22
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rapuncel
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 2
10
- version: 0.0.2
9
+ - 3
10
+ version: 0.0.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michael Eickenberg
@@ -16,7 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-02-05 00:00:00 +01:00
19
+ date: 2011-04-29 00:00:00 +02:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency