active_zuora 2.0.2 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Gemfile.lock +5 -5
- data/MIT-LICENSE +20 -0
- data/README.md +8 -8
- data/active_zuora.gemspec +13 -12
- data/lib/active_zuora/connection.rb +3 -0
- data/lib/active_zuora/version.rb +1 -1
- data/spec/connection_spec.rb +37 -0
- metadata +9 -5
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
active_zuora (2.0.
|
4
|
+
active_zuora (2.0.3)
|
5
5
|
activemodel (>= 3.0.0, < 4.0.0)
|
6
6
|
activesupport (>= 3.0.0, < 4.0.0)
|
7
7
|
savon (~> 0.9.9)
|
@@ -20,14 +20,14 @@ GEM
|
|
20
20
|
nokogiri (>= 1.4.0)
|
21
21
|
builder (3.0.4)
|
22
22
|
diff-lcs (1.1.3)
|
23
|
-
gyoku (1.
|
23
|
+
gyoku (1.1.1)
|
24
24
|
builder (>= 2.1.2)
|
25
25
|
httpi (1.1.1)
|
26
26
|
rack
|
27
27
|
i18n (0.6.1)
|
28
|
-
mini_portile (0.5.
|
29
|
-
multi_json (1.
|
30
|
-
nokogiri (1.6.
|
28
|
+
mini_portile (0.5.2)
|
29
|
+
multi_json (1.8.4)
|
30
|
+
nokogiri (1.6.1)
|
31
31
|
mini_portile (~> 0.5.0)
|
32
32
|
nori (1.1.5)
|
33
33
|
rack (1.5.2)
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 Sport Ngin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
# active_zuora - Auto-Generated ActiveModel Interface for Zuora
|
2
2
|
|
3
|
-
[![TravisCI](https://secure.travis-ci.org/
|
3
|
+
[![TravisCI](https://secure.travis-ci.org/sportngin/active_zuora.png "TravisCI")](http://travis-ci.org/sportngin/active_zuora "Travis-CI ActiveZuora") [![Code Climate](https://codeclimate.com/github/sportngin/active_zuora.png)](https://codeclimate.com/github/sportngin/active_zuora)
|
4
4
|
|
5
5
|
Use Zuora's API like ActiveRecord. Auto-generate all the classes from the wsdl file, or easily declare your own.
|
6
6
|
|
7
7
|
## Active Zuora Version 1
|
8
8
|
This repostiory contains >= Version 2 of Active Zuora
|
9
9
|
|
10
|
-
Version 1 can be found at
|
10
|
+
Version 1 can be found at https://github.com/sportngin/active_zuora_v1
|
11
11
|
|
12
12
|
## Configuration
|
13
13
|
|
@@ -48,7 +48,7 @@ Or, if you prefer, you can define your ZObjects or Complex Types manually.
|
|
48
48
|
|
49
49
|
has_many :subscriptions, :order => :name
|
50
50
|
has_many :active_subscriptions, :class_name => 'Subscription',
|
51
|
-
:conditions => { :status => 'Active' },
|
51
|
+
:conditions => { :status => 'Active' },
|
52
52
|
:order => [ :name, :desc ]
|
53
53
|
belongs_to :parent, :class_name => 'Account'
|
54
54
|
has_many :children, :class_name => 'Account', :foreign_key => :parent_id, :inverse_of => :parent
|
@@ -85,7 +85,7 @@ Changes are also tracked.
|
|
85
85
|
account.changes # []
|
86
86
|
|
87
87
|
Errors are captured using ActiveModel::Validations, or from error messages received from the server.
|
88
|
-
|
88
|
+
|
89
89
|
account = ActiveZuora::Account.new
|
90
90
|
account.save # false
|
91
91
|
account.errors # { :base => ["Missing attribute: Name"] } # Returned from server.
|
@@ -126,7 +126,7 @@ By default, every Query object caches the results once you call an array-like me
|
|
126
126
|
scope :since, lambda { |datetime| where(:created_date => { ">=" => datetime }) }
|
127
127
|
end
|
128
128
|
|
129
|
-
ActiveZuora::Account.select(:id).draft.since(Date.new 2012).to_zql
|
129
|
+
ActiveZuora::Account.select(:id).draft.since(Date.new 2012).to_zql
|
130
130
|
# => "select Id from Account where Status = 'Draft' and CreatedDate >= '2012-01-01T00:00:00+08:00'"
|
131
131
|
|
132
132
|
Like ActiveRecord, you can also chain any class method on the ZObject, since named scopes are nothing more than class methods that return a Relation object.
|
@@ -149,12 +149,12 @@ You can also delete all records matching a query as well. The method returns th
|
|
149
149
|
|
150
150
|
## License
|
151
151
|
|
152
|
-
Active Zuora is released under the MIT license:
|
152
|
+
Active Zuora is released under the MIT license:
|
153
153
|
|
154
154
|
http://www.opensource.org/licenses/MIT
|
155
155
|
|
156
156
|
## Support
|
157
157
|
|
158
|
-
Bug reports and feature requests can be filed as github issues here:
|
158
|
+
Bug reports and feature requests can be filed as github issues here:
|
159
159
|
|
160
|
-
https://github.com/
|
160
|
+
https://github.com/sportngin/active_zuora/issues
|
data/active_zuora.gemspec
CHANGED
@@ -6,18 +6,19 @@ authors = {
|
|
6
6
|
"Andy Fleener" => "andy.fleener@sportngin.com",
|
7
7
|
}
|
8
8
|
Gem::Specification.new do |s|
|
9
|
-
s.name
|
10
|
-
s.version
|
11
|
-
s.platform
|
12
|
-
s.authors
|
13
|
-
s.email
|
14
|
-
s.homepage
|
15
|
-
s.summary
|
16
|
-
s.description
|
17
|
-
s.files
|
18
|
-
s.test_files
|
19
|
-
s.executables
|
20
|
-
s.require_paths
|
9
|
+
s.name = "active_zuora"
|
10
|
+
s.version = ActiveZuora::VERSION.to_s
|
11
|
+
s.platform = Gem::Platform::RUBY
|
12
|
+
s.authors = authors.keys
|
13
|
+
s.email = authors.values
|
14
|
+
s.homepage = "https://github.com/sportngin/active_zuora"
|
15
|
+
s.summary = %q{ActiveZuora - Zuora API that looks and feels like ActiveRecord.}
|
16
|
+
s.description = %q{ActiveZuora - Zuora API based on ActiveModel and auto-generated from your zuora.wsdl.}
|
17
|
+
s.files = `git ls-files`.split("\n")
|
18
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
19
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
20
|
+
s.require_paths = ["lib"]
|
21
|
+
s.license = "MIT"
|
21
22
|
s.extra_rdoc_files = [ "README.md" ]
|
22
23
|
|
23
24
|
s.add_runtime_dependency('savon', ["~> 0.9.9"])
|
@@ -2,6 +2,7 @@ module ActiveZuora
|
|
2
2
|
class Connection
|
3
3
|
|
4
4
|
attr_reader :soap_client
|
5
|
+
attr_accessor :custom_header
|
5
6
|
|
6
7
|
WSDL = File.expand_path('../../../wsdl/zuora.wsdl', __FILE__)
|
7
8
|
|
@@ -26,6 +27,8 @@ module ActiveZuora
|
|
26
27
|
def request(*args, &block)
|
27
28
|
# instance variables aren't available within the soap request block for some reason.
|
28
29
|
header = { 'SessionHeader' => { 'session' => @session_id } }
|
30
|
+
header.merge!(@custom_header) if @custom_header
|
31
|
+
|
29
32
|
@soap_client.request(*args) do
|
30
33
|
soap.header = header
|
31
34
|
yield(soap)
|
data/lib/active_zuora/version.rb
CHANGED
@@ -0,0 +1,37 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe ActiveZuora::Connection do
|
4
|
+
context "custom header" do
|
5
|
+
before do
|
6
|
+
@connection = ActiveZuora::Connection.new
|
7
|
+
@stub_was_called = false
|
8
|
+
end
|
9
|
+
|
10
|
+
it "passes the regular header if not set" do
|
11
|
+
Savon::SOAP::Request.stub(:new) do |config, http, soap|
|
12
|
+
@stub_was_called = true
|
13
|
+
soap.header.should == {"SessionHeader" => {"session" => nil}}
|
14
|
+
|
15
|
+
double('response').as_null_object
|
16
|
+
end
|
17
|
+
|
18
|
+
@connection.request(:amend) {}
|
19
|
+
|
20
|
+
@stub_was_called.should eq true
|
21
|
+
end
|
22
|
+
|
23
|
+
it "merges in a custom header if set" do
|
24
|
+
@connection.custom_header = {'CallOptions' => {'useSingleTransaction' => true}}
|
25
|
+
Savon::SOAP::Request.stub(:new) do |config, http, soap|
|
26
|
+
@stub_was_called = true
|
27
|
+
soap.header.should == {"SessionHeader" => {"session" => nil}, 'CallOptions' => {'useSingleTransaction' => true}}
|
28
|
+
|
29
|
+
double('response').as_null_object
|
30
|
+
end
|
31
|
+
|
32
|
+
@connection.request(:amend) {}
|
33
|
+
|
34
|
+
@stub_was_called.should eq true
|
35
|
+
end
|
36
|
+
end
|
37
|
+
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.0.
|
4
|
+
version: 2.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2014-02-07 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: savon
|
@@ -117,6 +117,7 @@ files:
|
|
117
117
|
- .gitignore
|
118
118
|
- Gemfile
|
119
119
|
- Gemfile.lock
|
120
|
+
- MIT-LICENSE
|
120
121
|
- README.md
|
121
122
|
- Rakefile
|
122
123
|
- TODO.md
|
@@ -146,13 +147,15 @@ files:
|
|
146
147
|
- lib/active_zuora/version.rb
|
147
148
|
- lib/active_zuora/z_object.rb
|
148
149
|
- spec/belongs_to_associations_spec.rb
|
150
|
+
- spec/connection_spec.rb
|
149
151
|
- spec/has_many_integration_spec.rb
|
150
152
|
- spec/spec_helper.rb
|
151
153
|
- spec/subscribe_integration_spec.rb
|
152
154
|
- spec/zobject_integration_spec.rb
|
153
155
|
- wsdl/zuora.wsdl
|
154
156
|
homepage: https://github.com/sportngin/active_zuora
|
155
|
-
licenses:
|
157
|
+
licenses:
|
158
|
+
- MIT
|
156
159
|
post_install_message:
|
157
160
|
rdoc_options: []
|
158
161
|
require_paths:
|
@@ -165,7 +168,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
168
|
version: '0'
|
166
169
|
segments:
|
167
170
|
- 0
|
168
|
-
hash:
|
171
|
+
hash: 3328302040527430085
|
169
172
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
173
|
none: false
|
171
174
|
requirements:
|
@@ -174,7 +177,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
177
|
version: '0'
|
175
178
|
segments:
|
176
179
|
- 0
|
177
|
-
hash:
|
180
|
+
hash: 3328302040527430085
|
178
181
|
requirements: []
|
179
182
|
rubyforge_project:
|
180
183
|
rubygems_version: 1.8.25
|
@@ -183,6 +186,7 @@ specification_version: 3
|
|
183
186
|
summary: ActiveZuora - Zuora API that looks and feels like ActiveRecord.
|
184
187
|
test_files:
|
185
188
|
- spec/belongs_to_associations_spec.rb
|
189
|
+
- spec/connection_spec.rb
|
186
190
|
- spec/has_many_integration_spec.rb
|
187
191
|
- spec/spec_helper.rb
|
188
192
|
- spec/subscribe_integration_spec.rb
|