killbill-client 0.4.0 → 0.4.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.
@@ -29,6 +29,15 @@ module KillBillClient
29
29
  created_account.refresh(options)
30
30
  end
31
31
 
32
+ def invoices(with_items=false, options = {})
33
+ self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoices",
34
+ {
35
+ :withItems => with_items
36
+ },
37
+ options,
38
+ Invoice
39
+ end
40
+
32
41
  def payments(options = {})
33
42
  self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/payments",
34
43
  {},
@@ -34,6 +34,7 @@ module KillBillClient
34
34
  attribute :subscription_id
35
35
  attribute :plan_name
36
36
  attribute :phase_name
37
+ attribute :item_type
37
38
  attribute :description
38
39
  attribute :start_date
39
40
  attribute :end_date
@@ -1,6 +1,8 @@
1
1
  module KillBillClient
2
2
  module Model
3
3
  class Payment < PaymentAttributes
4
+ KILLBILL_API_PAYMENTS_PREFIX = "#{KILLBILL_API_PREFIX}/payments"
5
+
4
6
  has_many :refunds, KillBillClient::Model::Refund
5
7
  has_many :chargebacks, KillBillClient::Model::Chargeback
6
8
  has_many :audit_logs, KillBillClient::Model::AuditLog
@@ -1,8 +1,40 @@
1
1
  module KillBillClient
2
2
  module Model
3
3
  class Refund < RefundAttributes
4
+ KILLBILL_API_REFUNDS_PREFIX = "#{KILLBILL_API_PREFIX}/refunds"
5
+
4
6
  has_many :audit_logs, KillBillClient::Model::AuditLog
5
7
  has_many :adjustments, KillBillClient::Model::InvoiceItem
8
+
9
+ class << self
10
+
11
+ def find_by_id refund_id, options = {}
12
+ get "#{KILLBILL_API_REFUNDS_PREFIX}/#{refund_id}",
13
+ {},
14
+ options
15
+ end
16
+
17
+ def find_all_by_payment_id payment_id, options = {}
18
+ get "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/#{payment_id}/refunds",
19
+ {},
20
+ options
21
+ end
22
+
23
+ end #end class methods
24
+
25
+ def create(payment_id, refunds, user = nil, reason = nil, comment = nil, options = {})
26
+ created_refund = self.class.post "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/#{payment_id}/refunds",
27
+ to_json,
28
+ {},
29
+ {
30
+ :user => user,
31
+ :reason => reason,
32
+ :comment => comment,
33
+ }.merge(options)
34
+
35
+ created_refund.refresh(options)
36
+ end
37
+
6
38
  end
7
39
  end
8
40
  end
@@ -176,7 +176,7 @@ module KillBillClient
176
176
  json_hash = {}
177
177
  self.class.json_attributes.each do |name|
178
178
  value = self.send(name)
179
- if value
179
+ unless value.nil?
180
180
  json_hash[Utils.camelize name, :lower] = value.is_a?(Resource) ? value.to_hash : value
181
181
  end
182
182
  end
@@ -2,7 +2,7 @@ module KillBillClient
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 4
5
- PATCH = 0
5
+ PATCH = 1
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.4.0
4
+ version: 0.4.1
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-09-15 00:00:00.000000000 Z
12
+ date: 2013-09-19 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -146,7 +146,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
146
146
  version: '0'
147
147
  segments:
148
148
  - 0
149
- hash: 950878455458032705
149
+ hash: -4507065036335039450
150
150
  requirements: []
151
151
  rubyforge_project:
152
152
  rubygems_version: 1.8.25