killbill-client 0.4.5 → 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96687e10cab322b867c1387c71d4f30c81ec0328
|
4
|
+
data.tar.gz: 5cb7fa0eece1a870191f7bf21ae67e3ce7f8d486
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0db60114e796354ecc0eb01762e2285bb677706be18735e69a7f82f28d1dcd2206d9116b982719eeefc3810de5d114fd907ef3ca4d1117157c95f42b19c844a
|
7
|
+
data.tar.gz: a1c2bc7aa82982dc2b7076675f38e963fb0177f52bdc3e5486530cfdee37ac37d430eb2f56e2227eade58dc23b51186135c4306ea8376729d5ce2acbd09a32b1
|
@@ -1,10 +1,33 @@
|
|
1
1
|
module KillBillClient
|
2
2
|
module Model
|
3
3
|
class Bundle < BundleAttributes
|
4
|
+
|
5
|
+
KILLBILL_API_BUNDLES_PREFIX = "#{KILLBILL_API_PREFIX}/bundles"
|
6
|
+
|
4
7
|
has_many :subscriptions, KillBillClient::Model::Subscription
|
5
8
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def find_by_id(bundle_id, options = {})
|
12
|
+
get "#{KILLBILL_API_BUNDLES_PREFIX}/#{bundle_id}",
|
13
|
+
{},
|
14
|
+
options
|
15
|
+
end
|
16
|
+
|
17
|
+
# Return the active one
|
18
|
+
def find_by_external_key(external_key, options = {})
|
19
|
+
get "#{KILLBILL_API_BUNDLES_PREFIX}?externalKey=#{external_key}",
|
20
|
+
{},
|
21
|
+
options
|
22
|
+
end
|
23
|
+
|
24
|
+
# Return active and inactive ones
|
25
|
+
def find_all_by_account_id_and_external_key(account_id, external_key, options = {})
|
26
|
+
get "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/bundles?externalKey=#{external_key}",
|
27
|
+
{},
|
28
|
+
options
|
29
|
+
end
|
30
|
+
end
|
6
31
|
end
|
7
32
|
end
|
8
33
|
end
|
9
|
-
|
10
|
-
|
@@ -6,11 +6,7 @@ module KillBillClient
|
|
6
6
|
|
7
7
|
KILLBILL_API_ENTITLEMENT_PREFIX = "#{KILLBILL_API_PREFIX}/subscriptions"
|
8
8
|
|
9
|
-
KILLBILL_API_BUNDLE_PREFIX = "#{KILLBILL_API_PREFIX}/bundles"
|
10
|
-
|
11
9
|
class << self
|
12
|
-
|
13
|
-
|
14
10
|
def find_by_id(subscription_id, options = {})
|
15
11
|
get "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{subscription_id}",
|
16
12
|
{},
|
@@ -18,7 +14,7 @@ module KillBillClient
|
|
18
14
|
end
|
19
15
|
|
20
16
|
def find_by_bundle_id(bundle_id, options = {})
|
21
|
-
get "#{KILLBILL_API_BUNDLE_PREFIX}/#{bundle_id}/subscriptions",
|
17
|
+
get "#{Bundle::KILLBILL_API_BUNDLE_PREFIX}/#{bundle_id}/subscriptions",
|
22
18
|
{},
|
23
19
|
options
|
24
20
|
end
|
@@ -173,6 +173,18 @@ describe KillBillClient::Model do
|
|
173
173
|
account.bundles.size.should == 1
|
174
174
|
account.bundles[0].subscriptions.size.should == 1
|
175
175
|
account.bundles[0].subscriptions[0].subscription_id.should == sub.subscription_id
|
176
|
+
bundle = account.bundles[0]
|
177
|
+
|
178
|
+
# Verify we can retrieve it by id
|
179
|
+
KillBillClient::Model::Bundle.find_by_id(bundle.bundle_id).should == bundle
|
180
|
+
|
181
|
+
# Verify we can retrieve it by external key
|
182
|
+
KillBillClient::Model::Bundle.find_by_external_key(bundle.external_key).should == bundle
|
183
|
+
|
184
|
+
# Verify we can retrieve it by account id and external key
|
185
|
+
bundles = KillBillClient::Model::Bundle.find_all_by_account_id_and_external_key(account.account_id, bundle.external_key)
|
186
|
+
bundles.size.should == 1
|
187
|
+
bundles[0].should == bundle
|
176
188
|
end
|
177
189
|
|
178
190
|
it 'should manipulate tag definitions' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Killbill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|