ruby_psigate 0.7.4 → 0.7.5

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/CHANGELOG CHANGED
@@ -1,3 +1,4 @@
1
+ v0.7.5. fixed bug: serializer works for ItemInfo
1
2
  v0.7.4. fixed bug: account charges can now be registered
2
3
  v0.7.3. fixed bugs related to account information (address, name) not being passed through to server
3
4
  v0.7.2. updated project's dependency file
@@ -35,18 +35,19 @@ module RubyPsigate
35
35
  for key, value in hash_level
36
36
 
37
37
  # If the element at this level is :Item, then we know that it will be an array
38
- unless key == :Item
38
+ unless key == :Item || key == :ItemInfo
39
39
  @builder.tag!(key) { |level| value.is_a?(Hash) ? build_level(value) : level.text!(value.to_s) }
40
40
  else
41
- build_level_from_array_element(value)
41
+ tag = key
42
+ build_level_from_array_element(tag, value)
42
43
  end
43
44
 
44
45
  end
45
46
  end
46
47
 
47
- def build_level_from_array_element(input_array)
48
+ def build_level_from_array_element(tag, input_array)
48
49
  input_array.each do |element|
49
- @builder.tag!(:Item) {
50
+ @builder.tag!(tag) {
50
51
  element.each_pair do |key, value|
51
52
  # @builder.tag!(key) { |level| level.text!(value) }
52
53
  @builder.tag!(key) { |level| value.is_a?(Hash) ? build_level(value) : level.text!(value) }
data/ruby_psigate.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ruby_psigate}
5
- s.version = "0.7.4"
5
+ s.version = "0.7.5"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Simon Chiu"]
9
- s.date = %q{2010-09-26}
9
+ s.date = %q{2010-09-27}
10
10
  s.description = %q{RubyPsigate parses and packages XML messages to/from Psigate's servers for transactions and recurring billing management.}
11
11
  s.email = %q{skhchiu@gmail.com}
12
12
  s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.markdown", "lib/certs/cacert.pem", "lib/ruby_psigate.rb", "lib/ruby_psigate/account.rb", "lib/ruby_psigate/account_manager_api.rb", "lib/ruby_psigate/account_methods.rb", "lib/ruby_psigate/address.rb", "lib/ruby_psigate/connection.rb", "lib/ruby_psigate/credit_card.rb", "lib/ruby_psigate/credit_card_methods.rb", "lib/ruby_psigate/error.rb", "lib/ruby_psigate/gateway.rb", "lib/ruby_psigate/hash_variables.rb", "lib/ruby_psigate/item.rb", "lib/ruby_psigate/item_option.rb", "lib/ruby_psigate/number_validation_methods.rb", "lib/ruby_psigate/order.rb", "lib/ruby_psigate/recurring_charge.rb", "lib/ruby_psigate/recurring_item.rb", "lib/ruby_psigate/response.rb", "lib/ruby_psigate/serializer.rb", "lib/ruby_psigate/transaction_methods.rb", "lib/ruby_psigate/utils.rb"]
@@ -83,6 +83,20 @@ module RubyPsigate
83
83
  @result = Serializer.new(@params).to_xml
84
84
  assert_equal @expectation, @result
85
85
  end
86
+
87
+ should "create a markup from an array of hash, with each array element having its own embedded options" do
88
+ @expectation = "<ItemInfo><Name>Mercedes Benz</Name><Price>30000.00</Price><Option><model>sports</model><color>black</color></Option></ItemInfo><ItemInfo><Name>BMW</Name><Price>25000.00</Price><Option><model>luxury</model><color>red</color></Option></ItemInfo>"
89
+ @params = {
90
+ :ItemInfo => [
91
+ { :Name => "Mercedes Benz", :Price => "30000.00", :Option => { :model => "sports", :color => "black" } },
92
+ { :Name => "BMW", :Price => "25000.00", :Option => { :model => "luxury", :color => "red" } }
93
+ ]
94
+ }
95
+
96
+ @result = Serializer.new(@params).to_xml
97
+ assert_equal @expectation, @result
98
+ end
99
+
86
100
  end
87
101
 
88
102
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 4
9
- version: 0.7.4
8
+ - 5
9
+ version: 0.7.5
10
10
  platform: ruby
11
11
  authors:
12
12
  - Simon Chiu
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-09-26 00:00:00 -04:00
17
+ date: 2010-09-27 00:00:00 -04:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency