octobat 2.0.21 → 2.0.22

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,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39cb7d7e756a8a19162b43f02eddf46ff9ea2b0d3cf6cc7fa63c35e130393c36
4
- data.tar.gz: a199b92d99133f31b953ff6da3793e15ae0f29c0efd870e309a27a3ebb57352a
3
+ metadata.gz: f103ca1de7b1fa391b9e7d17530d78ada6d6353bd63c5c8e7db09047ef9e3063
4
+ data.tar.gz: 9aa6e8e6c71f51f678e7087f4184154c419d70399254044059d30efdceee2d8e
5
5
  SHA512:
6
- metadata.gz: '069f1946a31e8e0cc703a297bfccc4388ad8f1fd7709405f40f1e87578f76cd41f249c3611142a49ea94ff8c21673b971bcf9700dfba28815ce7a12b51727f94'
7
- data.tar.gz: f8146563ae30ef4bd58d134ad563c3faf783fdc5c7fdf37962803100b40a2753af56825570943a53dc8d42c439d1717d897a09d2be50fead8b6567173b33c498
6
+ metadata.gz: 5eb46faf6dfcfcc621f2aa8207a42e9c214b8af361bbc657058213e447e9a4b0bab9bcc274ebb68b7a5dc29a1b478568db23eded829becdb7f01f762153b511d
7
+ data.tar.gz: 3fcd9c96dfd1d01d9ba83e6cdaa166ac9604eb67d48d364b3b9c3fe379528c4f02962f531f2d58d204ce8d97973171ddd554f2b61207d86c0031e51d539aa06e
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- octobat (2.0.21)
4
+ octobat (2.0.22)
5
5
  rest-client (>= 1.4, < 4.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,7 @@
1
+ === 2.0.22 2020-11-23
2
+ * 1 minor enhancements:
3
+ * Add support for CustomerBalanceTransaction object
4
+
1
5
  === 2.0.21 2020-11-12
2
6
  * 3 major enhancements:
3
7
  * Add support for Supplier object
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.21
1
+ 2.0.22
@@ -27,6 +27,7 @@ require 'octobat/list_object'
27
27
  require 'octobat/customer'
28
28
  require 'octobat/supplier'
29
29
  require 'octobat/transaction'
30
+ require 'octobat/customer_balance_transaction'
30
31
  require 'octobat/item'
31
32
  require 'octobat/purchase_item'
32
33
  require 'octobat/document'
@@ -16,5 +16,10 @@ module Octobat
16
16
  def payment_sources(params = {}, opts = {})
17
17
  PaymentSource.list(params.merge({ :customer => id }), {api_key: @api_key}.merge(opts))
18
18
  end
19
+
20
+ def customer_balance_transactions(params = {}, opts = {})
21
+ CustomerBalanceTransaction.list(params.merge({ :customer => id }), {api_key: @api_key}.merge(opts))
22
+ end
23
+
19
24
  end
20
25
  end
@@ -0,0 +1,50 @@
1
+ module Octobat
2
+ class CustomerBalanceTransaction < APIResource
3
+ extend Octobat::APIOperations::List
4
+ include Octobat::APIOperations::Create
5
+
6
+
7
+ def url
8
+ !parent_obj.nil? ? parentize_url : super
9
+ end
10
+
11
+
12
+ def save_url
13
+ if self[:id] == nil && self.class.respond_to?(:create)
14
+ self.relative_save_url
15
+ else
16
+ url
17
+ end
18
+ end
19
+
20
+
21
+ def parentize_url
22
+ if parent_obj.include?(:customer)
23
+ "#{Customer.url}/#{CGI.escape(parent_obj[:customer])}/customer_balance_transactions/#{CGI.escape(id)}"
24
+ else
25
+ url
26
+ end
27
+ end
28
+
29
+
30
+
31
+ def relative_save_url
32
+ if self[:customer]
33
+ "#{Customer.url}/#{CGI.escape(self[:customer])}/customer_balance_transactions"
34
+ end
35
+ end
36
+
37
+
38
+ def self.url
39
+ if @parent_resource.include?(:customer)
40
+ "#{Customer.url}/#{CGI.escape(@parent_resource[:customer])}/customer_balance_transactions"
41
+ end
42
+ end
43
+
44
+ def self.set_parent_resource(filters)
45
+ @parent_resource = filters.select{|k, v| [:customer].include?(k)}
46
+ end
47
+
48
+
49
+ end
50
+ end
@@ -49,6 +49,7 @@ module Octobat
49
49
  'item' => Item,
50
50
  'purchase_item' => PurchaseItem,
51
51
  'customer' => Customer,
52
+ 'customer_balance_transaction' => CustomerBalanceTransaction,
52
53
  'supplier' => Supplier,
53
54
  'self_billing_invoice' => SelfBillingInvoice,
54
55
  'payout' => Payout,
@@ -1,3 +1,3 @@
1
1
  module Octobat
2
- VERSION = '2.0.21'
2
+ VERSION = '2.0.22'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octobat
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.21
4
+ version: 2.0.22
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gaultier Laperche
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-12 00:00:00.000000000 Z
11
+ date: 2020-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -68,6 +68,7 @@ files:
68
68
  - lib/octobat/credit_note.rb
69
69
  - lib/octobat/credit_note_numbering_sequence.rb
70
70
  - lib/octobat/customer.rb
71
+ - lib/octobat/customer_balance_transaction.rb
71
72
  - lib/octobat/document.rb
72
73
  - lib/octobat/document_email_template.rb
73
74
  - lib/octobat/document_language.rb