zuora4r 1.1.2 → 1.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/custom_fields.yml +2 -0
- data/lib/zuora/ZUORADriver.rb +23 -1
- data/lib/zuora_client.rb +18 -13
- data/lib/zuora_interface.rb +2 -1
- data/zuora4r.gemspec +3 -8
- metadata +8 -11
- data/test/helper.rb +0 -6
- data/test/test_zuora_client.rb +0 -11
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1
|
1
|
+
1.2.1
|
data/custom_fields.yml
CHANGED
data/lib/zuora/ZUORADriver.rb
CHANGED
@@ -76,9 +76,31 @@ class Soap < ::SOAP::RPC::Driver
|
|
76
76
|
super(endpoint_url, nil)
|
77
77
|
self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
|
78
78
|
self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
|
79
|
-
init_methods
|
80
79
|
end
|
81
80
|
|
81
|
+
|
82
|
+
|
83
|
+
def do_init(custom_fields)
|
84
|
+
|
85
|
+
if custom_fields
|
86
|
+
custom_fields.each do |key, value|
|
87
|
+
fields = value.strip.split(/\s+/).map { |e| "#{e}__c" }
|
88
|
+
type_class = Object.const_get('ZUORA').const_get(key)
|
89
|
+
|
90
|
+
product_definition = self.literal_mapping_registry.schema_definition_from_class(type_class)
|
91
|
+
|
92
|
+
fields.each do |field|
|
93
|
+
field_uncapitalize = field.gsub(/^\w/) { |i| i.downcase }
|
94
|
+
element_definition_input = [field_uncapitalize, ["SOAP::SOAPString", XSD::QName.new(ZUORA::DefaultMappingRegistry::NsObjectApiZuoraCom, field)], [0, 1]]
|
95
|
+
element_schema_definition = ::SOAP::Mapping::parse_schema_element_definition(element_definition_input, nil)
|
96
|
+
product_definition.elements << element_schema_definition
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
init_methods
|
102
|
+
end
|
103
|
+
|
82
104
|
private
|
83
105
|
|
84
106
|
def init_methods
|
data/lib/zuora_client.rb
CHANGED
@@ -43,9 +43,25 @@ class SOAP::Header::HandlerSet
|
|
43
43
|
end
|
44
44
|
|
45
45
|
class ZuoraClient
|
46
|
+
|
46
47
|
PROD_URL = 'https://www.zuora.com/apps/services/a/27.0'
|
47
48
|
SANDBOX_URL = 'https://apisandbox.zuora.com/apps/services/a/27.0'
|
48
49
|
|
50
|
+
def self.parse_custom_fields
|
51
|
+
custom_fields = YAML.load_file(File.dirname(__FILE__) + '/../custom_fields.yml')
|
52
|
+
if custom_fields
|
53
|
+
custom_fields.each do |key, value|
|
54
|
+
fields = value.strip.split(/\s+/).map { |e| "#{e}__c" }
|
55
|
+
type_class = Object.const_get('ZUORA').const_get(key)
|
56
|
+
fields.each do |field|
|
57
|
+
custom_field = field.gsub(/^\w/) { |i| i.downcase }
|
58
|
+
type_class.send :attr_accessor, custom_field
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
custom_fields
|
63
|
+
end
|
64
|
+
|
49
65
|
def initialize(username, password, url=PROD_URL)
|
50
66
|
$ZUORA_USER = username
|
51
67
|
$ZUORA_PASSWORD = password
|
@@ -54,19 +70,8 @@ class ZuoraClient
|
|
54
70
|
@client = ZuoraInterface.new
|
55
71
|
|
56
72
|
# add custom fields, if any
|
57
|
-
custom_fields =
|
58
|
-
|
59
|
-
custom_fields.each do |key, value|
|
60
|
-
fields = value.strip.split(/\s+/).map { |e| "#{e}__c" }
|
61
|
-
type_class = Object.const_get('ZUORA').const_get(key)
|
62
|
-
fields.each do |field|
|
63
|
-
custom_field = field.gsub(/^\w/) { |i| i.downcase }
|
64
|
-
type_class.send :attr_accessor, custom_field
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
@client.session_start
|
73
|
+
custom_fields = ZuoraClient.parse_custom_fields
|
74
|
+
@client.session_start(custom_fields)
|
70
75
|
end
|
71
76
|
|
72
77
|
def query(query_string)
|
data/lib/zuora_interface.rb
CHANGED
@@ -157,8 +157,9 @@ class ZuoraInterface
|
|
157
157
|
@session.session = @z.login(loginargs).result.session
|
158
158
|
end
|
159
159
|
|
160
|
-
def session_start
|
160
|
+
def session_start(custom_fields)
|
161
161
|
get_driver
|
162
|
+
@z.do_init(custom_fields)
|
162
163
|
session_cleanup
|
163
164
|
login
|
164
165
|
@z.headerhandler.set @session
|
data/zuora4r.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{zuora4r}
|
8
|
-
s.version = "1.
|
8
|
+
s.version = "1.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Cloocher"]
|
12
|
-
s.date = %q{2011-
|
12
|
+
s.date = %q{2011-06-01}
|
13
13
|
s.description = %q{A client for Zuora API}
|
14
14
|
s.email = %q{gene@ning.com}
|
15
15
|
s.executables = ["zuora-query", "zuora-create", "zuora-update", "zuora-bill-run", "zuora-payment-run", "zuora-delete", "zq"]
|
@@ -40,15 +40,10 @@ Gem::Specification.new do |s|
|
|
40
40
|
s.homepage = %q{http://github.com/cloocher/zuora4r}
|
41
41
|
s.require_paths = ["lib"]
|
42
42
|
s.requirements = ["none"]
|
43
|
-
s.rubygems_version = %q{1.
|
43
|
+
s.rubygems_version = %q{1.6.2}
|
44
44
|
s.summary = %q{Zuora4r}
|
45
|
-
s.test_files = [
|
46
|
-
"test/helper.rb",
|
47
|
-
"test/test_zuora_client.rb"
|
48
|
-
]
|
49
45
|
|
50
46
|
if s.respond_to? :specification_version then
|
51
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
47
|
s.specification_version = 3
|
53
48
|
|
54
49
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 29
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
|
-
- 1
|
9
8
|
- 2
|
10
|
-
|
9
|
+
- 1
|
10
|
+
version: 1.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Cloocher
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-01 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -86,8 +86,6 @@ files:
|
|
86
86
|
- zuora4r.gemspec
|
87
87
|
- LICENSE
|
88
88
|
- README.rdoc
|
89
|
-
- test/helper.rb
|
90
|
-
- test/test_zuora_client.rb
|
91
89
|
has_rdoc: true
|
92
90
|
homepage: http://github.com/cloocher/zuora4r
|
93
91
|
licenses: []
|
@@ -118,10 +116,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
116
|
requirements:
|
119
117
|
- none
|
120
118
|
rubyforge_project:
|
121
|
-
rubygems_version: 1.
|
119
|
+
rubygems_version: 1.6.2
|
122
120
|
signing_key:
|
123
121
|
specification_version: 3
|
124
122
|
summary: Zuora4r
|
125
|
-
test_files:
|
126
|
-
|
127
|
-
- test/test_zuora_client.rb
|
123
|
+
test_files: []
|
124
|
+
|
data/test/helper.rb
DELETED
data/test/test_zuora_client.rb
DELETED