soybean 2.3.0 → 2.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/core_ext/module.rb +24 -0
- data/lib/soybean/complex_type.rb +30 -38
- data/lib/soybean/generators/class_generator.rb +5 -4
- data/lib/soybean.rb +2 -0
- data/soybean.gemspec +3 -2
- data/vendor/soap4r/soap/mapping/mapping.rb +1 -1
- data/vendor/soap4r/wsdl/soap/mapping_registry_creator_support.rb +1 -1
- metadata +20 -19
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.
|
1
|
+
2.4.0
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Soybean
|
2
|
+
module SoapAttribute
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
5
|
+
included do
|
6
|
+
class_attribute :attributes, :instance_reader => true, :instance_writer => true
|
7
|
+
self.attributes = []
|
8
|
+
end
|
9
|
+
|
10
|
+
module ClassMethods
|
11
|
+
def soap_attribute(*attrs)
|
12
|
+
self.attributes += attrs
|
13
|
+
attr_accessor *attrs
|
14
|
+
attrs.each do |meth|
|
15
|
+
self.class_eval <<-RUBY
|
16
|
+
def #{meth.to_s.underscore}
|
17
|
+
#{meth}
|
18
|
+
end
|
19
|
+
RUBY
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/lib/soybean/complex_type.rb
CHANGED
@@ -1,53 +1,45 @@
|
|
1
1
|
module Soybean
|
2
|
-
|
3
|
-
|
4
|
-
self.attributes = []
|
2
|
+
module ComplexType
|
3
|
+
extend ActiveSupport::Concern
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
self.attributes += attrs
|
9
|
-
super
|
10
|
-
attrs.each do |meth|
|
11
|
-
self.class_eval <<-RUBY
|
12
|
-
def #{meth}
|
13
|
-
@#{meth} || @#{meth.to_s.camelize(:lower)}
|
14
|
-
end
|
15
|
-
RUBY
|
16
|
-
end
|
17
|
-
end
|
5
|
+
included do
|
6
|
+
include Soybean::SoapAttribute
|
18
7
|
end
|
19
8
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
9
|
+
module InstanceMethods
|
10
|
+
def initialize(*args)
|
11
|
+
hash = args.extract_options!
|
12
|
+
if args.empty?
|
13
|
+
init_from_hash(hash)
|
14
|
+
else
|
15
|
+
init_from_array(args)
|
16
|
+
end
|
26
17
|
end
|
27
|
-
end
|
28
18
|
|
29
|
-
|
19
|
+
private
|
30
20
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
21
|
+
# @param hash [Hash]
|
22
|
+
def init_from_hash(hash)
|
23
|
+
check_arguments_number!(hash)
|
24
|
+
hash.each do |key, val|
|
25
|
+
self.send key.to_sym, val
|
26
|
+
end
|
36
27
|
end
|
37
|
-
end
|
38
28
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
29
|
+
# @param arry [Array]
|
30
|
+
def init_from_array(arry)
|
31
|
+
check_arguments_number! arry
|
32
|
+
attributes.each_with_index do |key, i|
|
33
|
+
self.send "#{key}=".to_sym, arry.at(i)
|
34
|
+
end
|
44
35
|
end
|
45
|
-
end
|
46
36
|
|
47
|
-
|
48
|
-
|
49
|
-
|
37
|
+
def check_arguments_number!(args)
|
38
|
+
if args.size != attributes.size
|
39
|
+
raise ArgumentError, "wrong number of arguments(#{args.size} for #{attributes.size})"
|
40
|
+
end
|
50
41
|
end
|
51
42
|
end
|
43
|
+
|
52
44
|
end
|
53
45
|
end
|
@@ -6,7 +6,7 @@ module Soybean
|
|
6
6
|
unless safevarname?(varname || attrname)
|
7
7
|
raise ArgumentError.new("#{varname || attrname} seems to be unsafe")
|
8
8
|
end
|
9
|
-
@attrdef << [attrname
|
9
|
+
@attrdef << [attrname, writable, varname]
|
10
10
|
end
|
11
11
|
|
12
12
|
def def_classvar(var, value)
|
@@ -19,7 +19,7 @@ module Soybean
|
|
19
19
|
|
20
20
|
def def_method(name, *params)
|
21
21
|
return if name == 'initialize'
|
22
|
-
super name
|
22
|
+
super name, *params
|
23
23
|
end
|
24
24
|
|
25
25
|
def dump
|
@@ -75,13 +75,14 @@ module Soybean
|
|
75
75
|
if @baseclass
|
76
76
|
"class #{name.last} < #{@baseclass}\n"
|
77
77
|
else
|
78
|
-
"class #{name.last}
|
78
|
+
"class #{name.last}\n" <<
|
79
|
+
" include Soybean::ComplexType\n\n"
|
79
80
|
end
|
80
81
|
end
|
81
82
|
|
82
83
|
def accessors
|
83
84
|
@attrdef.map do |attrname, *|
|
84
|
-
format("
|
85
|
+
format("soap_attribute #{attrname.to_sym.inspect}\n", 2)
|
85
86
|
end.join
|
86
87
|
end
|
87
88
|
|
data/lib/soybean.rb
CHANGED
@@ -6,6 +6,8 @@ require 'active_support/deprecation'
|
|
6
6
|
require 'active_support/dependencies'
|
7
7
|
require 'active_support/dependencies/autoload'
|
8
8
|
require 'active_support/core_ext/module/delegation'
|
9
|
+
require 'active_support/concern'
|
10
|
+
require 'core_ext/module'
|
9
11
|
|
10
12
|
$:.unshift File.absolute_path(File.join(File.dirname(__FILE__), '..', 'vendor/soap4r'))
|
11
13
|
|
data/soybean.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{soybean}
|
8
|
-
s.version = "2.
|
8
|
+
s.version = "2.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Anton Sozontov"]
|
12
|
-
s.date = %q{2011-10-
|
12
|
+
s.date = %q{2011-10-10}
|
13
13
|
s.default_executable = %q{soybean}
|
14
14
|
s.description = %q{Generate soap web-services from you wsdl. Generate: all classes from xsd, and other.}
|
15
15
|
s.email = %q{a.sozontov@gmail.com}
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"Rakefile",
|
29
29
|
"VERSION",
|
30
30
|
"bin/soybean",
|
31
|
+
"lib/core_ext/module.rb",
|
31
32
|
"lib/soybean.rb",
|
32
33
|
"lib/soybean/cli.rb",
|
33
34
|
"lib/soybean/complex_type.rb",
|
@@ -517,7 +517,7 @@ module Mapping
|
|
517
517
|
elename = XSD::QName.new(default_ns, varname)
|
518
518
|
end
|
519
519
|
SchemaElementDefinition.new(
|
520
|
-
varname
|
520
|
+
varname, mapped_class, elename, minoccurs, maxoccurs, as_any, as_array)
|
521
521
|
end
|
522
522
|
end
|
523
523
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soybean
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-10-
|
12
|
+
date: 2011-10-10 00:00:00.000000000 +04:00
|
13
13
|
default_executable: soybean
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: thor
|
17
|
-
requirement: &
|
17
|
+
requirement: &18254220 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *18254220
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activesupport
|
28
|
-
requirement: &
|
28
|
+
requirement: &18205360 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '3.1'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *18205360
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: i18n
|
39
|
-
requirement: &
|
39
|
+
requirement: &18202440 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *18202440
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: rspec
|
50
|
-
requirement: &
|
50
|
+
requirement: &18201240 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 2.3.0
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *18201240
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: yard
|
61
|
-
requirement: &
|
61
|
+
requirement: &18198720 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 0.6.0
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *18198720
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: bundler
|
72
|
-
requirement: &
|
72
|
+
requirement: &18170680 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,10 +77,10 @@ dependencies:
|
|
77
77
|
version: 1.0.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *18170680
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: jeweler
|
83
|
-
requirement: &
|
83
|
+
requirement: &18168680 !ruby/object:Gem::Requirement
|
84
84
|
none: false
|
85
85
|
requirements:
|
86
86
|
- - ~>
|
@@ -88,10 +88,10 @@ dependencies:
|
|
88
88
|
version: 1.6.4
|
89
89
|
type: :development
|
90
90
|
prerelease: false
|
91
|
-
version_requirements: *
|
91
|
+
version_requirements: *18168680
|
92
92
|
- !ruby/object:Gem::Dependency
|
93
93
|
name: rcov
|
94
|
-
requirement: &
|
94
|
+
requirement: &18165660 !ruby/object:Gem::Requirement
|
95
95
|
none: false
|
96
96
|
requirements:
|
97
97
|
- - ! '>='
|
@@ -99,7 +99,7 @@ dependencies:
|
|
99
99
|
version: '0'
|
100
100
|
type: :development
|
101
101
|
prerelease: false
|
102
|
-
version_requirements: *
|
102
|
+
version_requirements: *18165660
|
103
103
|
description: ! 'Generate soap web-services from you wsdl. Generate: all classes from
|
104
104
|
xsd, and other.'
|
105
105
|
email: a.sozontov@gmail.com
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- Rakefile
|
120
120
|
- VERSION
|
121
121
|
- bin/soybean
|
122
|
+
- lib/core_ext/module.rb
|
122
123
|
- lib/soybean.rb
|
123
124
|
- lib/soybean/cli.rb
|
124
125
|
- lib/soybean/complex_type.rb
|
@@ -316,7 +317,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
316
317
|
version: '0'
|
317
318
|
segments:
|
318
319
|
- 0
|
319
|
-
hash: -
|
320
|
+
hash: -2874083597917324875
|
320
321
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
321
322
|
none: false
|
322
323
|
requirements:
|