active_zuora 2.1.0 → 2.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 5ff1cc26c4a195b5c6938e8c4f8d31c47e725729
4
- data.tar.gz: 26d461961a52d3507aae19d1fce9370a35d7c9df
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NTkwNDBiNjM1ODBhZjMyNzA3MjI2YzE4MDQ0MTA3YTQwMjhkYzcwNw==
5
+ data.tar.gz: !binary |-
6
+ ZDA0MDIwMjE0NTQwZmE1MTQzZDk5ZjA3YzQ3Mzk2NTBkYTc0ZDBkNg==
5
7
  SHA512:
6
- metadata.gz: 19e0a15c649f728ef73e226a5328a2b96cff15f8cd1149cd47d2db40855e7bf2e7027d0d025b8340071719686f550db0df0079a5dff326639f778d5e244c4849
7
- data.tar.gz: a52a64fed7da41be69ae64f508f8ac451f896be4691fcea8e4f1c02e7a7efd94a48341cd52639adcc38597e5e0d3f6f8883be0a1f3169f10f98036a18ae5bb70
8
+ metadata.gz: !binary |-
9
+ MTk0ODE2YzI3ZjI1MGRmOGM4MDVmYTQ0YjNkOWQzOWZmMWFkNmMxNTBlMzYx
10
+ YWJlNDk3Y2ZkNDU5MjNiZDU4ZmYyODlkNDhmOGNkZTQ4ZjdmNzExNTFmZjA4
11
+ YzViNTI1MWZmYjg3NjY2Njk4ZmJmNDMwYTljOTcwZWFlMTcyN2M=
12
+ data.tar.gz: !binary |-
13
+ NDkwODA5ZDc3NDA4MTA4YjU5MGU5NjRhZmMwZjFkODc0NjI2ZDE2YmRjNGFh
14
+ NzNlMjFmYjk4ZDgzYzZlZDY5NTRmYTI3ZDg2YzcyMjllMjBjYzQxNWE5MDAw
15
+ ZGY1MzM0OGFjNjU3NWIxOGY3MGM3ZTkxZGYyOTNiMTU3NmVhZGM=
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ #### v2.1.1
1
2
  #### v2.1.0
3
+ * Upgrade Savon to 1.2 https://github.com/sportngin/active_zuora/pull/22
4
+ - By @nvd
5
+ - Makes AZ 2 Thread Safe
2
6
  #### v2.0.6
3
7
  #### v2.0.5
data/README.md CHANGED
@@ -9,6 +9,9 @@ This repostiory contains >= Version 2 of Active Zuora
9
9
 
10
10
  Version 1 can be found at https://github.com/sportngin/active_zuora_v1
11
11
 
12
+ ## Thread Safety
13
+ 2.0.X versions of Active Zuora are not thread safe. They depend on a version of [Savon](https://github.com/savonrb/savon) that is [does not work with threads](https://github.com/savonrb/savon/issues/259).
14
+
12
15
  ## Configuration
13
16
 
14
17
  ActiveZuora.configure(
@@ -117,6 +117,7 @@ module ActiveZuora
117
117
  end
118
118
 
119
119
  return 0 if zobjects.empty?
120
+
120
121
  results = connection.request(action) do |soap|
121
122
  soap.body do |xml|
122
123
  zobjects.map do |zobject|
@@ -128,21 +129,16 @@ module ActiveZuora
128
129
  end.last
129
130
  end
130
131
  end["#{action.to_s}_response".to_sym][:result]
132
+
131
133
  results = [results] unless results.is_a?(Array)
132
- zobjects.each_with_index do |zobject, i|
133
- # If it's an update, grab by id, otherwise by index
134
- if action == :update
135
- result = results.find { |r| r[:id] == zobject.id } ||
136
- { :errors => { :message => "No result returned." } }
137
- else
138
- result = results[i] || { :errors => { :message => "No result returned." } }
139
- end
134
+ zobjects.zip(results).each do |zobject, result|
140
135
  if result[:success]
141
136
  zobject.clear_changed_attributes
142
137
  else
143
138
  zobject.add_zuora_errors result[:errors]
144
139
  end
145
140
  end
141
+
146
142
  # Return the count of updates that succeeded.
147
143
  results.select{ |result| result[:success] }.size
148
144
  end
@@ -1,3 +1,3 @@
1
1
  module ActiveZuora
2
- VERSION = "2.1.0"
2
+ VERSION = "2.1.1"
3
3
  end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'Create Account' do
4
+
5
+ integration_test do
6
+
7
+ let(:account) do
8
+ Z::Account.new name: 'Joe Customer',
9
+ currency: Tenant.currency,
10
+ bill_cycle_day: '1'
11
+ end
12
+
13
+ after(:each) do
14
+ account.delete unless account.new_record?
15
+ end
16
+
17
+ it 'can create an account' do
18
+ expect(account).to be_a_new_record
19
+ expect(account).to_not be_valid
20
+ expect(account.id).to_not be_present
21
+ expect(account.errors.full_messages).to eq ["Status can't be blank"]
22
+
23
+ now 'update account to be valid' do
24
+ account.status = 'Draft'
25
+ expect(account).to be_valid
26
+ expect(account.errors.full_messages).to be_empty
27
+ end
28
+
29
+ now 'save the account' do
30
+ expect(account.save).to be true
31
+ expect(account.id).to be_present
32
+ expect(account.errors.full_messages).to eq []
33
+ end
34
+
35
+ now 'ensure error messages are accessible' do
36
+ expect(account.update_attributes status: 'Active').to be false
37
+ expect(account.errors.full_messages).to eq ['Active account must have both sold to and bill to.']
38
+ end
39
+ end
40
+ end
41
+ end
data/spec/spec_helper.rb CHANGED
@@ -22,8 +22,12 @@ def integration_test
22
22
  end
23
23
  end
24
24
 
25
+ def now(_message)
26
+ yield
27
+ end
28
+
25
29
  module Tenant
26
30
  def self.currency
27
31
  ENV['ZUORA_CURRENCY'] || 'USD'
28
32
  end
29
- end
33
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_zuora
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ed Lebert
@@ -9,88 +9,88 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-01-06 00:00:00.000000000 Z
12
+ date: 2015-01-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: savon
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ~>
19
19
  - !ruby/object:Gem::Version
20
20
  version: 1.2.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ~>
26
26
  - !ruby/object:Gem::Version
27
27
  version: 1.2.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activesupport
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ">="
32
+ - - ! '>='
33
33
  - !ruby/object:Gem::Version
34
34
  version: 3.0.0
35
- - - "<"
35
+ - - <
36
36
  - !ruby/object:Gem::Version
37
37
  version: 5.0.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  requirements:
42
- - - ">="
42
+ - - ! '>='
43
43
  - !ruby/object:Gem::Version
44
44
  version: 3.0.0
45
- - - "<"
45
+ - - <
46
46
  - !ruby/object:Gem::Version
47
47
  version: 5.0.0
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: activemodel
50
50
  requirement: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - ! '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: 3.0.0
55
- - - "<"
55
+ - - <
56
56
  - !ruby/object:Gem::Version
57
57
  version: 5.0.0
58
58
  type: :runtime
59
59
  prerelease: false
60
60
  version_requirements: !ruby/object:Gem::Requirement
61
61
  requirements:
62
- - - ">="
62
+ - - ! '>='
63
63
  - !ruby/object:Gem::Version
64
64
  version: 3.0.0
65
- - - "<"
65
+ - - <
66
66
  - !ruby/object:Gem::Version
67
67
  version: 5.0.0
68
68
  - !ruby/object:Gem::Dependency
69
69
  name: rake
70
70
  requirement: !ruby/object:Gem::Requirement
71
71
  requirements:
72
- - - ">="
72
+ - - ! '>='
73
73
  - !ruby/object:Gem::Version
74
74
  version: 0.8.7
75
75
  type: :development
76
76
  prerelease: false
77
77
  version_requirements: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - ">="
79
+ - - ! '>='
80
80
  - !ruby/object:Gem::Version
81
81
  version: 0.8.7
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: rspec
84
84
  requirement: !ruby/object:Gem::Requirement
85
85
  requirements:
86
- - - ">="
86
+ - - ! '>='
87
87
  - !ruby/object:Gem::Version
88
88
  version: 3.0.0
89
89
  type: :development
90
90
  prerelease: false
91
91
  version_requirements: !ruby/object:Gem::Requirement
92
92
  requirements:
93
- - - ">="
93
+ - - ! '>='
94
94
  - !ruby/object:Gem::Version
95
95
  version: 3.0.0
96
96
  description: ActiveZuora - Zuora API based on ActiveModel and auto-generated from
@@ -103,10 +103,10 @@ extensions: []
103
103
  extra_rdoc_files:
104
104
  - README.md
105
105
  files:
106
- - ".gitignore"
107
- - ".octopolo.yml"
108
- - ".soyuz.yml"
109
- - ".travis.yml"
106
+ - .gitignore
107
+ - .octopolo.yml
108
+ - .soyuz.yml
109
+ - .travis.yml
110
110
  - CHANGELOG.markdown
111
111
  - Gemfile
112
112
  - MIT-LICENSE
@@ -138,6 +138,7 @@ files:
138
138
  - lib/active_zuora/subscribe.rb
139
139
  - lib/active_zuora/version.rb
140
140
  - lib/active_zuora/z_object.rb
141
+ - spec/account_integration_spec.rb
141
142
  - spec/belongs_to_associations_spec.rb
142
143
  - spec/connection_spec.rb
143
144
  - spec/has_many_integration_spec.rb
@@ -155,12 +156,12 @@ require_paths:
155
156
  - lib
156
157
  required_ruby_version: !ruby/object:Gem::Requirement
157
158
  requirements:
158
- - - ">="
159
+ - - ! '>='
159
160
  - !ruby/object:Gem::Version
160
161
  version: '0'
161
162
  required_rubygems_version: !ruby/object:Gem::Requirement
162
163
  requirements:
163
- - - ">="
164
+ - - ! '>='
164
165
  - !ruby/object:Gem::Version
165
166
  version: '0'
166
167
  requirements: []
@@ -170,6 +171,7 @@ signing_key:
170
171
  specification_version: 4
171
172
  summary: ActiveZuora - Zuora API that looks and feels like ActiveRecord.
172
173
  test_files:
174
+ - spec/account_integration_spec.rb
173
175
  - spec/belongs_to_associations_spec.rb
174
176
  - spec/connection_spec.rb
175
177
  - spec/has_many_integration_spec.rb