zuora4r 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,104 @@
1
+ require 'soap/rpc/driver'
2
+
3
+ module ZUORA
4
+
5
+ class Soap < ::SOAP::RPC::Driver
6
+
7
+ Methods = [
8
+ [ "",
9
+ "login",
10
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "login"]],
11
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "loginResponse"]] ],
12
+ { :request_style => :document, :request_use => :literal,
13
+ :response_style => :document, :response_use => :literal,
14
+ :faults => {"ZUORA::UnexpectedErrorFault_"=>{:name=>"UnexpectedErrorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}, "ZUORA::LoginFault_"=>{:name=>"LoginFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}} }
15
+ ],
16
+ [ "",
17
+ "subscribe",
18
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "subscribe"]],
19
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "subscribeResponse"]] ],
20
+ { :request_style => :document, :request_use => :literal,
21
+ :response_style => :document, :response_use => :literal,
22
+ :faults => {"ZUORA::UnexpectedErrorFault_"=>{:name=>"UnexpectedErrorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}} }
23
+ ],
24
+ [ "",
25
+ "subscribeWithExistingAccount",
26
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "subscribeWithExistingAccount"]],
27
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "subscribeResponse"]] ],
28
+ { :request_style => :document, :request_use => :literal,
29
+ :response_style => :document, :response_use => :literal,
30
+ :faults => {"ZUORA::UnexpectedErrorFault_"=>{:name=>"UnexpectedErrorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}} }
31
+ ],
32
+ [ "",
33
+ "create",
34
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "create"]],
35
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "createResponse"]] ],
36
+ { :request_style => :document, :request_use => :literal,
37
+ :response_style => :document, :response_use => :literal,
38
+ :faults => {"ZUORA::InvalidTypeFault_"=>{:name=>"InvalidTypeFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}, "ZUORA::UnexpectedErrorFault_"=>{:name=>"UnexpectedErrorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}} }
39
+ ],
40
+ [ "",
41
+ "generate",
42
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "generate"]],
43
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "generateResponse"]] ],
44
+ { :request_style => :document, :request_use => :literal,
45
+ :response_style => :document, :response_use => :literal,
46
+ :faults => {"ZUORA::InvalidTypeFault_"=>{:name=>"InvalidTypeFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}, "ZUORA::UnexpectedErrorFault_"=>{:name=>"UnexpectedErrorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}} }
47
+ ],
48
+ [ "",
49
+ "update",
50
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "update"]],
51
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "updateResponse"]] ],
52
+ { :request_style => :document, :request_use => :literal,
53
+ :response_style => :document, :response_use => :literal,
54
+ :faults => {"ZUORA::InvalidTypeFault_"=>{:name=>"InvalidTypeFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}, "ZUORA::UnexpectedErrorFault_"=>{:name=>"UnexpectedErrorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}} }
55
+ ],
56
+ [ "",
57
+ "query",
58
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "query"]],
59
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "queryResponse"]] ],
60
+ { :request_style => :document, :request_use => :literal,
61
+ :response_style => :document, :response_use => :literal,
62
+ :faults => {"ZUORA::InvalidQueryLocatorFault_"=>{:name=>"InvalidQueryLocatorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}, "ZUORA::MalformedQueryFault_"=>{:name=>"MalformedQueryFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}, "ZUORA::UnexpectedErrorFault_"=>{:name=>"UnexpectedErrorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}} }
63
+ ],
64
+ [ "",
65
+ "delete",
66
+ [ ["in", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "delete"]],
67
+ ["out", "parameters", ["::SOAP::SOAPElement", "http://api.zuora.com/", "deleteResponse"]] ],
68
+ { :request_style => :document, :request_use => :literal,
69
+ :response_style => :document, :response_use => :literal,
70
+ :faults => {"ZUORA::InvalidValueFault_"=>{:name=>"InvalidValueFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}, "ZUORA::InvalidTypeFault_"=>{:name=>"InvalidTypeFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}, "ZUORA::UnexpectedErrorFault_"=>{:name=>"UnexpectedErrorFault", :encodingstyle=>"document", :ns=>"http://api.zuora.com/", :use=>"literal", :namespace=>nil}} }
71
+ ]
72
+ ]
73
+
74
+ def initialize(endpoint_url = nil)
75
+ endpoint_url ||= $ZUORA_ENDPOINT
76
+ super(endpoint_url, nil)
77
+ self.mapping_registry = DefaultMappingRegistry::EncodedRegistry
78
+ self.literal_mapping_registry = DefaultMappingRegistry::LiteralRegistry
79
+ init_methods
80
+ end
81
+
82
+ private
83
+
84
+ def init_methods
85
+ Methods.each do |definitions|
86
+ opt = definitions.last
87
+ if opt[:request_style] == :document
88
+ add_document_operation(*definitions)
89
+ else
90
+ add_rpc_operation(*definitions)
91
+ qname = definitions[0]
92
+ name = definitions[2]
93
+ if qname.name != name and qname.name.capitalize == name.capitalize
94
+ ::SOAP::Mapping.define_singleton_method(self, qname.name) do |*arg|
95
+ __send__(name, *arg)
96
+ end
97
+ end
98
+ end
99
+ end
100
+ end
101
+ end
102
+
103
+
104
+ end