killbill-client 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,7 +48,7 @@ module KillBillClient
48
48
  request = METHODS[method].new uri.request_uri, head
49
49
 
50
50
  # Configure multi-tenancy headers, if enabled
51
- if KillBillClient.api_key and KillBillClient.api_secret
51
+ if (options[:api_key] || KillBillClient.api_key) && (options[:api_secret] || KillBillClient.api_secret)
52
52
  request['X-Killbill-ApiKey'] = options[:api_key] || KillBillClient.api_key
53
53
  request['X-Killbill-ApiSecret'] = options[:api_secret] || KillBillClient.api_secret
54
54
  end
@@ -41,7 +41,7 @@ module KillBillClient
41
41
  params = {}
42
42
  params[:callCompletion] = call_completion
43
43
  params[:requestedDate] = requested_date unless requested_date.nil?
44
- params[:policy] = billing_policy unless billing_policy.nil?
44
+ params[:billingPolicy] = billing_policy unless billing_policy.nil?
45
45
 
46
46
  return self.class.put "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{@subscription_id}",
47
47
  input.to_json,
@@ -59,11 +59,12 @@ module KillBillClient
59
59
  # @requested_date : the date when that change should occur
60
60
  # @billing_policy : the override for the billing policy {END_OF_TERM, IMMEDIATE}
61
61
  #
62
- def cancel(user = nil, reason = nil, comment = nil, requested_date = nil, billing_policy = nil, options = {})
62
+ def cancel(user = nil, reason = nil, comment = nil, requested_date = nil, entitlementPolicy = nil, billing_policy = nil, options = {})
63
63
 
64
64
  params = {}
65
65
  params[:requestedDate] = requested_date unless requested_date.nil?
66
- params[:policy] = billing_policy unless billing_policy.nil?
66
+ params[:billingPolicy] = billing_policy unless billing_policy.nil?
67
+ params[:entitlementPolicy] = entitlementPolicy unless entitlementPolicy.nil?
67
68
 
68
69
  return self.class.delete "#{KILLBILL_API_ENTITLEMENT_PREFIX}/#{@subscription_id}",
69
70
  params,
@@ -10,10 +10,11 @@ module KillBillClient
10
10
  create_alias :bundle_keys, :external_bundle_keys
11
11
 
12
12
  class << self
13
- def find_by_id_or_number(id_or_number, with_items = true, options = {})
13
+ def find_by_id_or_number(id_or_number, with_items = true, audit = "NONE", options = {})
14
14
  get "#{KILLBILL_API_INVOICES_PREFIX}/#{id_or_number}",
15
15
  {
16
- :withItems => with_items
16
+ :withItems => with_items,
17
+ :audit => audit
17
18
  },
18
19
  options
19
20
  end
@@ -1,6 +1,9 @@
1
1
  module KillBillClient
2
2
  module Model
3
3
  class InvoiceItem < InvoiceItemAttributesSimple
4
+
5
+ has_many :audit_logs, KillBillClient::Model::AuditLog
6
+
4
7
  def create(user = nil, reason = nil, comment = nil, options = {})
5
8
  created_invoice_item = self.class.post "#{Invoice::KILLBILL_API_INVOICES_PREFIX}/charges",
6
9
  to_json,
@@ -12,6 +12,7 @@ require 'killbill_client/models/subscription_new_event'
12
12
  require 'killbill_client/models/chargeback'
13
13
  require 'killbill_client/models/subscription_event'
14
14
  require 'killbill_client/models/entitlement_no_events'
15
+ require 'killbill_client/models/subscription_no_events'
15
16
  require 'killbill_client/models/bundle'
16
17
  require 'killbill_client/models/refund'
17
18
  require 'killbill_client/models/account'
@@ -0,0 +1,26 @@
1
+ module KillBillClient
2
+ module Model
3
+ class SubscriptionNoEvents < SubscriptionAttributesNoEvents
4
+
5
+ KILLBILL_API_SUBSCRIPTIONS_PREFIX = "#{KILLBILL_API_PREFIX}/subscriptions"
6
+
7
+ KILLBILL_API_BUNDLE_PREFIX = "#{KILLBILL_API_PREFIX}/bundles"
8
+
9
+ class << self
10
+ def find_by_id(subscription_id, options = {})
11
+ get "#{KILLBILL_API_SUBSCRIPTIONS_PREFIX}/#{subscription_id}",
12
+ {},
13
+ options
14
+ end
15
+
16
+
17
+ def find_by_bundle_id(bundle_id, options = {})
18
+ get "#{KILLBILL_API_BUNDLE_PREFIX}/#{bundle_id}/subscriptions",
19
+ {},
20
+ options
21
+ end
22
+ end
23
+
24
+ end
25
+ end
26
+ end
@@ -26,6 +26,12 @@ module KillBillClient
26
26
  :reason => reason,
27
27
  :comment => comment,
28
28
  }.merge(options)
29
+ #
30
+ # Specify api_key and api_secret before making the call to retrieve the tenant object
31
+ # otherwise that would fail with a 401
32
+ #
33
+ options[:api_key] = @api_key
34
+ options[:api_secret] = @api_secret
29
35
  created_tenant.refresh(options)
30
36
  end
31
37
  end
@@ -2,7 +2,7 @@ module KillBillClient
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 2
5
+ PATCH = 3
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
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: 2013-08-27 00:00:00.000000000 Z
12
+ date: 2013-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -129,6 +129,7 @@ files:
129
129
  - lib/killbill_client/models/subscription_deleted_event.rb
130
130
  - lib/killbill_client/models/subscription_event.rb
131
131
  - lib/killbill_client/models/subscription_new_event.rb
132
+ - lib/killbill_client/models/subscription_no_events.rb
132
133
  - lib/killbill_client/models/tag.rb
133
134
  - lib/killbill_client/models/tag_definition.rb
134
135
  - lib/killbill_client/models/tenant.rb
@@ -163,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
164
  version: '0'
164
165
  segments:
165
166
  - 0
166
- hash: 2953616694403421406
167
+ hash: -3818846432645189032
167
168
  requirements: []
168
169
  rubyforge_project:
169
170
  rubygems_version: 1.8.25