yamlrpc 0.1.080704174553 → 0.1.080706215610
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/yamlrpc/client.rb +24 -8
- data/lib/yamlrpc.rb +23 -0
- metadata +3 -3
data/lib/yamlrpc/client.rb
CHANGED
@@ -1,14 +1,30 @@
|
|
1
|
-
|
2
1
|
# Simple RPC client on YAML
|
3
2
|
#
|
4
|
-
#
|
3
|
+
# Example usage:
|
4
|
+
#
|
5
|
+
# yaml_rpc = YamlRpc.new('http://rubyforge.org/projects/yamlrpc/')
|
6
|
+
# yaml_rpc.foo({
|
7
|
+
# :bar => 'foo-bar'
|
8
|
+
# )
|
9
|
+
#
|
10
|
+
# will HTTP POST
|
11
|
+
#
|
12
|
+
# {
|
13
|
+
# :bar => YAML::dump('foo-bar')
|
14
|
+
# }
|
15
|
+
#
|
16
|
+
# to http://rubyforge.org/projects/yamlrpc/<b>foo</b>
|
17
|
+
#
|
18
|
+
# On the server side you can use (Ruby on Rails):
|
19
|
+
#
|
20
|
+
# YAML::load(params[:yaml_rpc])[:foo]
|
5
21
|
#
|
6
|
-
#
|
7
|
-
# yaml_rpc.invoice( :invoice_id => '123' )
|
22
|
+
# or in PHP:
|
8
23
|
#
|
9
|
-
#
|
24
|
+
# $data = syck_load($_POST['yaml_rpc']);
|
25
|
+
# $data['foo']
|
10
26
|
#
|
11
|
-
#
|
27
|
+
# See examples in /examples directory
|
12
28
|
module YamlRpc
|
13
29
|
|
14
30
|
class Client
|
@@ -33,8 +49,8 @@ module YamlRpc
|
|
33
49
|
end
|
34
50
|
|
35
51
|
# * <tt>method</tt> Method name
|
36
|
-
# * <tt>args</tt> Arguments,
|
37
|
-
def method_missing(method, args)
|
52
|
+
# * <tt>args</tt> Arguments, nil or Hash of values
|
53
|
+
def method_missing(method, args = {})
|
38
54
|
post(method, args)
|
39
55
|
end
|
40
56
|
|
data/lib/yamlrpc.rb
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
#--
|
2
|
+
# Copyright (c) 2008 Mirek Rusin
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
5
|
+
# a copy of this software and associated documentation files (the
|
6
|
+
# "Software"), to deal in the Software without restriction, including
|
7
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
8
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
9
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
10
|
+
# the following conditions:
|
11
|
+
#
|
12
|
+
# The above copyright notice and this permission notice shall be
|
13
|
+
# included in all copies or substantial portions of the Software.
|
14
|
+
#
|
15
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
16
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
17
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
18
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
19
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
20
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
21
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
22
|
+
#++
|
23
|
+
|
1
24
|
require 'yaml'
|
2
25
|
require 'net/http'
|
3
26
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yamlrpc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.080706215610
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mirek Rusin
|
@@ -9,7 +9,7 @@ autorequire: yamlrpc
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-07-
|
12
|
+
date: 2008-07-06 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -27,7 +27,7 @@ files:
|
|
27
27
|
- lib/yamlrpc/helpers.rb
|
28
28
|
- lib/yamlrpc.rb
|
29
29
|
- README
|
30
|
-
has_rdoc:
|
30
|
+
has_rdoc: false
|
31
31
|
homepage: http://mirekrusin.com/ruby/yamlrpc
|
32
32
|
post_install_message:
|
33
33
|
rdoc_options: []
|