paypal-sdk-core 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -211,7 +211,9 @@ module PayPal::SDK::Core
211
211
  unless key == ContentKey
212
212
  member_option = members[key]
213
213
  key = member_option[:name] if member_option.include? :name
214
- key = "#{member_option[:namespace]}:#{key}" if member_option[:namespace] and options[:namespace]
214
+ if !member_option[:attribute] and member_option[:namespace] and options[:namespace]
215
+ key = "#{member_option[:namespace]}:#{key}"
216
+ end
215
217
  key = "@#{key}" if member_option[:attribute] and options[:attribute]
216
218
  end
217
219
  options[:symbol] ? key.to_sym : key.to_s
@@ -1,7 +1,7 @@
1
1
  module PayPal
2
2
  module SDK
3
3
  module Core
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
6
6
  end
7
7
  end
@@ -8,9 +8,9 @@ describe PayPal::SDK::Core::API::DataTypes::Base do
8
8
 
9
9
  # Members
10
10
  object_of :amount, String
11
- object_of :type, String, :namespace => "ns"
11
+ object_of :desciption, String, :namespace => "ns"
12
12
  # Attributes
13
- add_attribute :code
13
+ add_attribute :currencyID, :namespace => "cc"
14
14
  end
15
15
 
16
16
  class TestType < DataType
@@ -33,44 +33,45 @@ describe PayPal::SDK::Core::API::DataTypes::Base do
33
33
  test_type.toCurrency[1].should be_a TestCurrency
34
34
  test_type.toCurrency[0].amount.should eql nil
35
35
  test_type.fromCurrency.amount.should eql nil
36
- test_type.fromCurrency.type.should eql nil
36
+ test_type.fromCurrency.desciption.should eql nil
37
+ test_type.fromCurrency.currencyID.should eql nil
37
38
  end
38
39
 
39
40
  it "should convert the given data to configured type" do
40
- test_type = TestType.new( :fromCurrency => { :code => "USD", :amount => "50.0"})
41
+ test_type = TestType.new( :fromCurrency => { :currencyID => "USD", :amount => "50.0"})
41
42
  test_type.fromCurrency.should be_a TestCurrency
42
- test_type.fromCurrency.code.should eql "USD"
43
+ test_type.fromCurrency.currencyID.should eql "USD"
43
44
  test_type.fromCurrency.amount.should eql "50.0"
44
45
  end
45
46
 
46
47
  it "should allow block with initializer" do
47
48
  test_type = TestType.new do
48
49
  fromCurrency do
49
- self.code = "USD"
50
+ self.currencyID = "USD"
50
51
  self.amount = "50.0"
51
52
  end
52
53
  end
53
- test_type.fromCurrency.code.should eql "USD"
54
+ test_type.fromCurrency.currencyID.should eql "USD"
54
55
  test_type.fromCurrency.amount.should eql "50.0"
55
56
  end
56
57
 
57
58
  it "should allow block with member" do
58
59
  test_type = TestType.new
59
60
  test_type.fromCurrency do
60
- self.code = "USD"
61
+ self.currencyID = "USD"
61
62
  self.amount = "50.0"
62
63
  end
63
- test_type.fromCurrency.code.should eql "USD"
64
+ test_type.fromCurrency.currencyID.should eql "USD"
64
65
  test_type.fromCurrency.amount.should eql "50.0"
65
66
  end
66
67
 
67
68
  it "should assign value to attribute" do
68
- test_currency = TestCurrency.new( :@code => "USD", :amount => "50" )
69
- test_currency.code.should eql "USD"
69
+ test_currency = TestCurrency.new( :@currencyID => "USD", :amount => "50" )
70
+ test_currency.currencyID.should eql "USD"
70
71
  end
71
72
 
72
73
  it "should allow configured Class object" do
73
- test_currency = TestCurrency.new( :code => "USD", :amount => "50" )
74
+ test_currency = TestCurrency.new( :currencyID => "USD", :amount => "50" )
74
75
  test_type = TestType.new( :fromCurrency => test_currency )
75
76
  test_type.fromCurrency.should eql test_currency
76
77
  end
@@ -82,7 +83,7 @@ describe PayPal::SDK::Core::API::DataTypes::Base do
82
83
  end
83
84
 
84
85
  it "should allow array" do
85
- test_type = TestType.new( :toCurrency => [{ :code => "USD", :amount => "50.0" }] )
86
+ test_type = TestType.new( :toCurrency => [{ :currencyID => "USD", :amount => "50.0" }] )
86
87
  test_type.toCurrency.should be_a Array
87
88
  test_type.toCurrency.first.should be_a TestCurrency
88
89
  end
@@ -124,28 +125,30 @@ describe PayPal::SDK::Core::API::DataTypes::Base do
124
125
  end
125
126
 
126
127
  it "should convert attribute key with @" do
127
- test_currency = TestCurrency.new( :code => "USD", :amount => "50" )
128
- test_currency.to_hash[:@code].should eql "USD"
128
+ test_currency = TestCurrency.new( :currencyID => "USD", :amount => "50" )
129
+ test_currency.to_hash[:@currencyID].should eql "USD"
129
130
  end
130
131
 
131
132
  it "should convert attribute key without @" do
132
- test_currency = TestCurrency.new( :code => "USD", :amount => "50" )
133
- test_currency.to_hash(:attribute => false)[:code].should eql "USD"
133
+ test_currency = TestCurrency.new( :currencyID => "USD", :amount => "50" )
134
+ test_currency.to_hash(:attribute => false)[:currencyID].should eql "USD"
134
135
  end
135
136
 
136
137
  it "should convert to hash with namespace" do
137
- test_currency = TestCurrency.new(:amount => "500", :type => "USD" )
138
+ test_currency = TestCurrency.new(:currencyID => "USD", :amount => "500", :desciption => "Testing" )
138
139
  hash = test_currency.to_hash
139
140
  hash[:amount].should eql "500"
140
- hash[:"ns:type"].should eql "USD"
141
+ hash[:"ns:desciption"].should eql "Testing"
142
+ hash[:@currencyID].should eql "USD"
141
143
  hash = test_currency.to_hash(:namespace => false)
142
144
  hash[:amount].should eql "500"
143
- hash[:type].should eql "USD"
145
+ hash[:desciption].should eql "Testing"
146
+ hash[:@currencyID].should eql "USD"
144
147
  end
145
148
 
146
149
  it "should allow namespace" do
147
- test_currency = TestCurrency.new(:amount => "500", :"ns:type" => "USD" )
148
- test_currency.type.should eql "USD"
150
+ test_currency = TestCurrency.new(:amount => "500", :"ns:desciption" => "Testing" )
151
+ test_currency.desciption.should eql "Testing"
149
152
  end
150
153
 
151
154
  it "should use name option in members" do
@@ -85,18 +85,6 @@ describe PayPal::SDK::Core::API::Merchant do
85
85
  should_be_failure(response, "Authorization Failed")
86
86
  end
87
87
 
88
- it "invalid end point" do
89
- client = Merchant.new(:merchant_end_point => "https://invalid-api-3t.sandbox.paypal.com/2.0/")
90
- response = client.request("TransactionSearch", TransactionSearchParams )
91
- should_be_failure(response)
92
- end
93
-
94
- it "with nvp endpoint" do
95
- client = Merchant.new(:merchant_end_point => "https://svcs.sandbox.paypal.com/AdaptivePayments")
96
- response = client.request("TransactionSearch", TransactionSearchParams )
97
- should_be_failure(response, "Internal Server Error")
98
- end
99
-
100
88
  it "invalid action" do
101
89
  client = Merchant.new
102
90
  response = client.request("InvalidAction", TransactionSearchParams )
@@ -70,25 +70,6 @@ describe PayPal::SDK::Core::API::Platform do
70
70
  should_be_failure(response, "Authentication failed")
71
71
  end
72
72
 
73
- it "invalid end point" do
74
- client = Platform.new(:platform_end_point => "https://svcs-invalid.sandbox.paypal.com/AdaptivePayments")
75
- response = client.request("ConvertCurrency", ConvertCurrencyParams )
76
- should_be_failure(response)
77
- end
78
-
79
- it "with soap endpoint" do
80
- client = Platform.new(:platform_end_point => "https://api-3t.sandbox.paypal.com/2.0/")
81
- response = client.request("ConvertCurrency", ConvertCurrencyParams )
82
- should_be_failure(response, "Not Found")
83
- end
84
-
85
- it "invalid service" do
86
- lambda{
87
- client = Platform.new("InvalidService")
88
- response = client.request("ConvertCurrency", ConvertCurrencyParams )
89
- }.should raise_error
90
- end
91
-
92
73
  it "invalid action" do
93
74
  client = Platform.new("AdaptivePayments")
94
75
  response = client.request("InvalidAction", ConvertCurrencyParams)
data/spec/log/test.log CHANGED
@@ -142,3 +142,53 @@ I, [2012-12-13T14:09:16.194203 #6666] INFO -- : [1.321] Request: ConvertCurrenc
142
142
  I, [2012-12-13T14:09:46.960190 #6666] INFO -- : [30.765] Request: ConvertCurrency
143
143
  I, [2012-12-13T14:09:48.288044 #6666] INFO -- : [1.326] Request: InvalidAction
144
144
  I, [2012-12-13T14:09:49.883667 #6666] INFO -- : [1.594] Request: ConvertCurrency
145
+ I, [2012-12-17T10:07:01.494326 #2366] INFO -- : [3.002] Request: TransactionSearch
146
+ I, [2012-12-17T10:07:04.482082 #2366] INFO -- : [2.964] Request: TransactionSearch
147
+ I, [2012-12-17T10:07:06.258446 #2366] INFO -- : [1.717] Request: TransactionSearch
148
+ I, [2012-12-17T10:07:07.971115 #2366] INFO -- : [1.693] Request: TransactionSearch
149
+ I, [2012-12-17T10:07:09.720031 #2366] INFO -- : [1.745] Request: TransactionSearch
150
+ I, [2012-12-17T10:07:09.964916 #2366] INFO -- : [0.241] Request: TransactionSearch
151
+ I, [2012-12-17T10:07:11.732780 #2366] INFO -- : [1.764] Request: TransactionSearch
152
+ I, [2012-12-17T10:07:13.329576 #2366] INFO -- : [1.593] Request: InvalidAction
153
+ I, [2012-12-17T10:07:15.239373 #2366] INFO -- : [1.906] Request: TransactionSearch
154
+ I, [2012-12-17T10:07:16.925527 #2366] INFO -- : [1.684] Request: ConvertCurrency
155
+ I, [2012-12-17T10:07:18.627331 #2366] INFO -- : [1.700] Request: ConvertCurrency
156
+ I, [2012-12-17T10:07:20.037691 #2366] INFO -- : [1.408] Request: CreateInvoice
157
+ I, [2012-12-17T10:07:21.677738 #2366] INFO -- : [1.637] Request: ConvertCurrency
158
+ I, [2012-12-17T10:07:23.068837 #2366] INFO -- : [1.389] Request: ConvertCurrency
159
+ I, [2012-12-17T10:07:24.426292 #2366] INFO -- : [1.355] Request: ConvertCurrency
160
+ I, [2012-12-17T10:07:24.656990 #2366] INFO -- : [0.229] Request: ConvertCurrency
161
+ I, [2012-12-17T10:07:25.972725 #2366] INFO -- : [1.314] Request: ConvertCurrency
162
+ I, [2012-12-17T10:07:56.738044 #2366] INFO -- : [30.764] Request: ConvertCurrency
163
+ I, [2012-12-17T10:07:58.060401 #2366] INFO -- : [1.320] Request: InvalidAction
164
+ I, [2012-12-17T10:07:59.615799 #2366] INFO -- : [1.554] Request: ConvertCurrency
165
+ I, [2012-12-17T10:25:00.420354 #2619] INFO -- : [2.802] Request: TransactionSearch
166
+ I, [2012-12-17T10:25:03.084104 #2619] INFO -- : [2.661] Request: TransactionSearch
167
+ I, [2012-12-17T10:25:04.825906 #2619] INFO -- : [1.719] Request: TransactionSearch
168
+ I, [2012-12-17T10:25:06.517412 #2619] INFO -- : [1.672] Request: TransactionSearch
169
+ I, [2012-12-17T10:25:08.265475 #2619] INFO -- : [1.744] Request: TransactionSearch
170
+ I, [2012-12-17T10:25:09.861595 #2619] INFO -- : [1.592] Request: InvalidAction
171
+ I, [2012-12-17T10:25:11.767418 #2619] INFO -- : [1.902] Request: TransactionSearch
172
+ I, [2012-12-17T10:25:14.088486 #2619] INFO -- : [2.319] Request: ConvertCurrency
173
+ I, [2012-12-17T10:25:16.416495 #2619] INFO -- : [2.326] Request: ConvertCurrency
174
+ I, [2012-12-17T10:25:18.500151 #2619] INFO -- : [2.082] Request: CreateInvoice
175
+ I, [2012-12-17T10:25:20.812754 #2619] INFO -- : [2.310] Request: ConvertCurrency
176
+ I, [2012-12-17T10:25:22.861493 #2619] INFO -- : [2.047] Request: ConvertCurrency
177
+ I, [2012-12-17T10:25:24.848915 #2619] INFO -- : [1.986] Request: ConvertCurrency
178
+ I, [2012-12-17T10:25:26.825089 #2619] INFO -- : [1.975] Request: InvalidAction
179
+ I, [2012-12-17T10:25:29.076747 #2619] INFO -- : [2.250] Request: ConvertCurrency
180
+ I, [2012-12-17T12:38:02.412011 #5871] INFO -- : [2.381] Request: TransactionSearch
181
+ I, [2012-12-17T12:38:04.940220 #5871] INFO -- : [2.525] Request: TransactionSearch
182
+ I, [2012-12-17T12:38:06.449428 #5871] INFO -- : [1.489] Request: TransactionSearch
183
+ I, [2012-12-17T12:38:07.897453 #5871] INFO -- : [1.429] Request: TransactionSearch
184
+ I, [2012-12-17T12:38:09.383781 #5871] INFO -- : [1.484] Request: TransactionSearch
185
+ I, [2012-12-17T12:38:10.735670 #5871] INFO -- : [1.349] Request: InvalidAction
186
+ I, [2012-12-17T12:38:12.368013 #5871] INFO -- : [1.629] Request: TransactionSearch
187
+ I, [2012-12-17T12:38:14.481785 #5871] INFO -- : [2.111] Request: ConvertCurrency
188
+ I, [2012-12-17T12:38:16.091652 #5871] INFO -- : [1.609] Request: ConvertCurrency
189
+ I, [2012-12-17T12:38:17.489956 #5871] INFO -- : [1.397] Request: CreateInvoice
190
+ I, [2012-12-17T12:38:19.096327 #5871] INFO -- : [1.605] Request: ConvertCurrency
191
+ I, [2012-12-17T12:38:20.493920 #5871] INFO -- : [1.396] Request: ConvertCurrency
192
+ I, [2012-12-17T12:38:21.825387 #5871] INFO -- : [1.330] Request: ConvertCurrency
193
+ I, [2012-12-17T12:38:23.143418 #5871] INFO -- : [1.317] Request: InvalidAction
194
+ I, [2012-12-17T12:38:24.732613 #5871] INFO -- : [1.588] Request: ConvertCurrency
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypal-sdk-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-14 00:00:00.000000000 Z
12
+ date: 2012-12-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: xml-simple
@@ -85,7 +85,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
85
85
  version: '0'
86
86
  segments:
87
87
  - 0
88
- hash: 1022374001
88
+ hash: 623555469
89
89
  required_rubygems_version: !ruby/object:Gem::Requirement
90
90
  none: false
91
91
  requirements:
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  segments:
96
96
  - 0
97
- hash: 1022374001
97
+ hash: 623555469
98
98
  requirements: []
99
99
  rubyforge_project:
100
100
  rubygems_version: 1.8.24