zuora4r 1.0.9 → 1.1.0

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.
data/Rakefile CHANGED
@@ -5,13 +5,13 @@ begin
5
5
  require 'jeweler'
6
6
  Jeweler::Tasks.new do |gem|
7
7
  gem.name = "zuora4r"
8
- gem.version = "1.0.9"
8
+ gem.version = "1.1.0"
9
9
  gem.summary = "Zuora4r"
10
10
  gem.description = "A client for Zuora API"
11
11
  gem.email = "gene@ning.com"
12
12
  gem.homepage = "http://github.com/cloocher/zuora4r"
13
13
  gem.authors = ["Cloocher"]
14
- gem.files = FileList["CHANGES", "zuora4r.gemspec", "Rakefile", "README", "VERSION",
14
+ gem.files = FileList["CHANGES", "zuora4r.gemspec", "Rakefile", "README", "VERSION", "custom_fields.yml",
15
15
  "lib/**/*", "bin/**/*"]
16
16
  gem.add_dependency "soap4r", ">= 1.5.8"
17
17
  gem.add_dependency "json_pure", ">= 1.4.6"
data/custom_fields.yml ADDED
@@ -0,0 +1,5 @@
1
+ # custom fields go here
2
+ # ex:
3
+ #Account:
4
+ # FullName
5
+ # Locale
data/lib/zuora/ZUORA.rb CHANGED
@@ -558,8 +558,17 @@ class ProductRatePlanCharge < ZObject
558
558
  attr_accessor :productRatePlanId
559
559
  attr_accessor :type
560
560
  attr_accessor :uOM
561
+ attr_accessor :chargeModel
562
+ attr_accessor :revRecCode
563
+ attr_accessor :triggerEvent
564
+ attr_accessor :chargeType
565
+ attr_accessor :billingPeriod
566
+ attr_accessor :billCycleType
567
+ attr_accessor :billingPeriodAlignement
568
+ attr_accessor :revRecTriggerCondition
569
+ attr_accessor :productRatePlanChargeTierData
561
570
 
562
- def initialize(fieldsToNull = [], id = nil, accountingCode = nil, defaultQuantity = nil, description = nil, maxQuantity = nil, minQuantity = nil, model = nil, name = nil, productRatePlanId = nil, type = nil, uOM = nil)
571
+ def initialize(fieldsToNull = [], id = nil, accountingCode = nil, defaultQuantity = nil, description = nil, maxQuantity = nil, minQuantity = nil, model = nil, name = nil, productRatePlanId = nil, type = nil, uOM = nil, chargeModel = nil, revRecCode=nil, triggerEvent=nil, chargeType=nil, billingPeriod=nil, billCycleType=nil, billingPeriodAlignement=nil, revRecTriggerCondition=nil, productRatePlanChargeTierData=nil)
563
572
  @fieldsToNull = fieldsToNull
564
573
  @id = id
565
574
  @accountingCode = accountingCode
@@ -572,9 +581,27 @@ class ProductRatePlanCharge < ZObject
572
581
  @productRatePlanId = productRatePlanId
573
582
  @type = type
574
583
  @uOM = uOM
584
+ @chargeModel = chargeModel
585
+ @revRecCode=revRecCode,
586
+ @triggerEvent=triggerEvent,
587
+ @chargeType=chargeType,
588
+ @billingPeriod=billingPeriod,
589
+ @billCycleType=billCycleType,
590
+ @billingPeriodAlignement=billingPeriodAlignement
591
+ @revRecTriggerCondition=revRecTriggerCondition
592
+ @productRatePlanChargeTierData=productRatePlanChargeTierData
575
593
  end
576
594
  end
577
595
 
596
+ class ProductRatePlanChargeTierData < ZObject
597
+ attr_accessor :productRatePlanChargeTier
598
+
599
+ def initialize(productRatePlanChargeTier = nil)
600
+ @productRatePlanChargeTier = productRatePlanChargeTier
601
+ end
602
+ end
603
+
604
+
578
605
  # {http://object.api.zuora.com/}ProductRatePlanChargeTier
579
606
  # fieldsToNull - SOAP::SOAPString
580
607
  # id - (any)
@@ -591,8 +618,10 @@ class ProductRatePlanChargeTier < ZObject
591
618
  attr_accessor :productRatePlanChargeId
592
619
  attr_accessor :startingUnit
593
620
  attr_accessor :tier
621
+ attr_accessor :active
622
+ attr_accessor :currency
594
623
 
595
- def initialize(fieldsToNull = [], id = nil, endingUnit = nil, price = nil, productRatePlanChargeId = nil, startingUnit = nil, tier = nil)
624
+ def initialize(fieldsToNull = [], id = nil, endingUnit = nil, price = nil, productRatePlanChargeId = nil, startingUnit = nil, tier = nil, active=nil, currency=nil)
596
625
  @fieldsToNull = fieldsToNull
597
626
  @id = id
598
627
  @endingUnit = endingUnit
@@ -600,6 +629,8 @@ class ProductRatePlanChargeTier < ZObject
600
629
  @productRatePlanChargeId = productRatePlanChargeId
601
630
  @startingUnit = startingUnit
602
631
  @tier = tier
632
+ @active = active
633
+ @currency = currency
603
634
  end
604
635
  end
605
636
 
@@ -265,7 +265,25 @@ module DefaultMappingRegistry
265
265
  ["model", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "Model")], [0, 1]],
266
266
  ["productRatePlanId", [nil, XSD::QName.new(NsObjectApiZuoraCom, "ProductRatePlanId")], [0, 1]],
267
267
  ["type", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "Type")], [0, 1]],
268
- ["uOM", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "UOM")], [0, 1]]
268
+ ["uOM", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "UOM")], [0, 1]],
269
+ ["name", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "Name")], [0, 1]],
270
+ ["chargeModel", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "ChargeModel")], [0, 1]],
271
+ ["revRecCode", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "RevRecCode")], [0, 1]],
272
+ ["triggerEvent", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "TriggerEvent")], [0, 1]],
273
+ ["chargeType", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "ChargeType")], [0, 1]],
274
+ ["billingPeriod", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "BillingPeriod")], [0, 1]],
275
+ ["billCycleType", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "BillCycleType")], [0, 1]],
276
+ ["billingPeriodAlignement", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "BillingPeriodAlignement")], [0, 1]],
277
+ ["revRecTriggerCondition", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "RevRecTriggerCondition")], [0, 1]],
278
+ ["productRatePlanChargeTierData", ["ZUORA::ProductRatePlanChargeTierData", XSD::QName.new(NsObjectApiZuoraCom, "ProductRatePlanChargeTierData")], [0, 1]]
279
+ ]
280
+ )
281
+
282
+ EncodedRegistry.register(
283
+ :class => ZUORA::ProductRatePlanChargeTierData,
284
+ :schema_type => XSD::QName.new(NsApiZuoraCom, "ProductRatePlanChargeTierData"),
285
+ :schema_element => [
286
+ ["productRatePlanChargeTier", ["ZUORA::ProductRatePlanChargeTier[]", XSD::QName.new(NsApiZuoraCom, "ProductRatePlanChargeTier")], [0, nil]]
269
287
  ]
270
288
  )
271
289
 
@@ -280,7 +298,9 @@ module DefaultMappingRegistry
280
298
  ["price", ["SOAP::SOAPDouble", XSD::QName.new(NsObjectApiZuoraCom, "Price")], [0, 1]],
281
299
  ["productRatePlanChargeId", [nil, XSD::QName.new(NsObjectApiZuoraCom, "ProductRatePlanChargeId")], [0, 1]],
282
300
  ["startingUnit", ["SOAP::SOAPDouble", XSD::QName.new(NsObjectApiZuoraCom, "StartingUnit")], [0, 1]],
283
- ["tier", ["SOAP::SOAPInt", XSD::QName.new(NsObjectApiZuoraCom, "Tier")], [0, 1]]
301
+ ["tier", ["SOAP::SOAPInt", XSD::QName.new(NsObjectApiZuoraCom, "Tier")], [0, 1]],
302
+ ["active", ["SOAP::SOAPBoolean", XSD::QName.new(NsObjectApiZuoraCom, "Active")], [0, 1]],
303
+ ["currency", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "Currency")], [0, 1]]
284
304
  ]
285
305
  )
286
306
 
@@ -852,7 +872,25 @@ module DefaultMappingRegistry
852
872
  ["model", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "Model")], [0, 1]],
853
873
  ["productRatePlanId", [nil, XSD::QName.new(NsObjectApiZuoraCom, "ProductRatePlanId")], [0, 1]],
854
874
  ["type", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "Type")], [0, 1]],
855
- ["uOM", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "UOM")], [0, 1]]
875
+ ["uOM", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "UOM")], [0, 1]],
876
+ ["name", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "Name")], [0, 1]],
877
+ ["chargeModel", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "ChargeModel")], [0, 1]],
878
+ ["revRecCode", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "RevRecCode")], [0, 1]],
879
+ ["triggerEvent", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "TriggerEvent")], [0, 1]],
880
+ ["chargeType", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "ChargeType")], [0, 1]],
881
+ ["billingPeriod", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "BillingPeriod")], [0, 1]],
882
+ ["billCycleType", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "BillCycleType")], [0, 1]],
883
+ ["billingPeriodAlignement", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "BillingPeriodAlignement")], [0, 1]],
884
+ ["revRecTriggerCondition", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "RevRecTriggerCondition")], [0, 1]],
885
+ ["productRatePlanChargeTierData", ["ZUORA::ProductRatePlanChargeTierData", XSD::QName.new(NsObjectApiZuoraCom, "ProductRatePlanChargeTierData")], [0, 1]]
886
+ ]
887
+ )
888
+
889
+ LiteralRegistry.register(
890
+ :class => ZUORA::ProductRatePlanChargeTierData,
891
+ :schema_type => XSD::QName.new(NsApiZuoraCom, "ProductRatePlanChargeTierData"),
892
+ :schema_element => [
893
+ ["productRatePlanChargeTier", ["ZUORA::ProductRatePlanChargeTier[]", XSD::QName.new(NsApiZuoraCom, "ProductRatePlanChargeTier")], [0, nil]]
856
894
  ]
857
895
  )
858
896
 
@@ -867,7 +905,9 @@ module DefaultMappingRegistry
867
905
  ["price", ["SOAP::SOAPDouble", XSD::QName.new(NsObjectApiZuoraCom, "Price")], [0, 1]],
868
906
  ["productRatePlanChargeId", [nil, XSD::QName.new(NsObjectApiZuoraCom, "ProductRatePlanChargeId")], [0, 1]],
869
907
  ["startingUnit", ["SOAP::SOAPDouble", XSD::QName.new(NsObjectApiZuoraCom, "StartingUnit")], [0, 1]],
870
- ["tier", ["SOAP::SOAPInt", XSD::QName.new(NsObjectApiZuoraCom, "Tier")], [0, 1]]
908
+ ["tier", ["SOAP::SOAPInt", XSD::QName.new(NsObjectApiZuoraCom, "Tier")], [0, 1]],
909
+ ["active", ["SOAP::SOAPBoolean", XSD::QName.new(NsObjectApiZuoraCom, "Active")], [0, 1]],
910
+ ["currency", ["SOAP::SOAPString", XSD::QName.new(NsObjectApiZuoraCom, "Currency")], [0, 1]]
871
911
  ]
872
912
  )
873
913
 
data/lib/zuora_client.rb CHANGED
@@ -29,6 +29,7 @@
29
29
 
30
30
  require 'zuora_interface'
31
31
  require 'zuora/api'
32
+ require 'yaml'
32
33
 
33
34
  class SOAP::Header::HandlerSet
34
35
  def reset
@@ -41,10 +42,9 @@ class SOAP::Header::HandlerSet
41
42
  end
42
43
  end
43
44
 
44
-
45
45
  class ZuoraClient
46
- PROD_URL = 'https://www.zuora.com/apps/services/a/28.0'
47
- SANDBOX_URL = 'https://apisandbox.zuora.com/apps/services/a/28.0'
46
+ PROD_URL = 'https://www.zuora.com/apps/services/a/27.0'
47
+ SANDBOX_URL = 'https://apisandbox.zuora.com/apps/services/a/27.0'
48
48
 
49
49
  def initialize(username, password, url=PROD_URL)
50
50
  $ZUORA_USER = username
@@ -52,6 +52,20 @@ class ZuoraClient
52
52
  $ZUORA_ENDPOINT = url
53
53
 
54
54
  @client = ZuoraInterface.new
55
+
56
+ # add custom fields, if any
57
+ custom_fields = YAML.load_file(File.dirname(__FILE__) + '/../custom_fields.yml')
58
+ if custom_fields
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
+
55
69
  @client.session_start
56
70
  end
57
71
 
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.0.9"
8
+ s.version = "1.1.0"
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-02-16}
12
+ s.date = %q{2011-04-21}
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"]
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
26
26
  "bin/zuora-payment-run",
27
27
  "bin/zuora-query",
28
28
  "bin/zuora-update",
29
+ "custom_fields.yml",
29
30
  "lib/zuora/ZUORA.rb",
30
31
  "lib/zuora/ZUORADriver.rb",
31
32
  "lib/zuora/ZUORAMappingRegistry.rb",
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
5
- prerelease: false
4
+ hash: 19
5
+ prerelease:
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 9
10
- version: 1.0.9
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cloocher
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-16 00:00:00 -08:00
19
- default_executable:
18
+ date: 2011-04-21 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: soap4r
@@ -74,6 +73,7 @@ files:
74
73
  - bin/zuora-payment-run
75
74
  - bin/zuora-query
76
75
  - bin/zuora-update
76
+ - custom_fields.yml
77
77
  - lib/zuora/ZUORA.rb
78
78
  - lib/zuora/ZUORADriver.rb
79
79
  - lib/zuora/ZUORAMappingRegistry.rb
@@ -86,7 +86,6 @@ files:
86
86
  - README.rdoc
87
87
  - test/helper.rb
88
88
  - test/test_zuora_client.rb
89
- has_rdoc: true
90
89
  homepage: http://github.com/cloocher/zuora4r
91
90
  licenses: []
92
91
 
@@ -116,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
115
  requirements:
117
116
  - none
118
117
  rubyforge_project:
119
- rubygems_version: 1.3.7
118
+ rubygems_version: 1.7.2
120
119
  signing_key:
121
120
  specification_version: 3
122
121
  summary: Zuora4r