octobat 2.0.18 → 2.0.23
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 +5 -5
- data/Gemfile.lock +8 -6
- data/History.txt +23 -0
- data/VERSION +1 -1
- data/lib/octobat.rb +5 -0
- data/lib/octobat/beanie/session.rb +13 -0
- data/lib/octobat/coupon.rb +7 -6
- data/lib/octobat/credit_note.rb +20 -9
- data/lib/octobat/credit_note_numbering_sequence.rb +2 -2
- data/lib/octobat/customer.rb +11 -6
- data/lib/octobat/customer_balance_transaction.rb +50 -0
- data/lib/octobat/document.rb +1 -2
- data/lib/octobat/document_email_template.rb +1 -1
- data/lib/octobat/document_language.rb +1 -1
- data/lib/octobat/document_template.rb +8 -8
- data/lib/octobat/emails_setting.rb +1 -1
- data/lib/octobat/exports_setting.rb +1 -1
- data/lib/octobat/invoice.rb +26 -16
- data/lib/octobat/invoice_numbering_sequence.rb +2 -2
- data/lib/octobat/order.rb +2 -2
- data/lib/octobat/payout.rb +2 -2
- data/lib/octobat/purchase_item.rb +52 -0
- data/lib/octobat/self_billing_invoice.rb +77 -0
- data/lib/octobat/supplier.rb +8 -0
- data/lib/octobat/tax_evidence_request.rb +1 -1
- data/lib/octobat/tax_id.rb +2 -2
- data/lib/octobat/tax_region_setting.rb +4 -4
- data/lib/octobat/transaction.rb +2 -2
- data/lib/octobat/util.rb +5 -0
- data/lib/octobat/version.rb +1 -1
- metadata +8 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 815744f0c2438e26e9b7a02925d19d8a84abdbfca27b14f3916b480275b298c0
|
4
|
+
data.tar.gz: 35d7fb3ecfab0651db58ca2d6d56714edb7bd9bc9f3eaef29cb7bc953f8e5714
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c73e7e3bb62aa742648968e0f8cdf5b694f8da8a7aba4ecd44f45d07f84893921aa4854a5217a763a200f6d87dd3d1b2563d32ec97a946df6ebf7d405254dfbf
|
7
|
+
data.tar.gz: 5a99d50d763f162b436a4a6ffd7239a095abaaf36416909d8df1ead630bf11c1e12c5fe3556b6dac0573f6189d75f710be833792fbd704b65d95b457d5504031
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
octobat (2.0.
|
4
|
+
octobat (2.0.23)
|
5
5
|
rest-client (>= 1.4, < 4.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -9,19 +9,21 @@ GEM
|
|
9
9
|
specs:
|
10
10
|
domain_name (0.5.20190701)
|
11
11
|
unf (>= 0.0.5, < 1.0.0)
|
12
|
+
http-accept (1.7.0)
|
12
13
|
http-cookie (1.0.3)
|
13
14
|
domain_name (~> 0.5)
|
14
|
-
mime-types (3.
|
15
|
+
mime-types (3.3.1)
|
15
16
|
mime-types-data (~> 3.2015)
|
16
|
-
mime-types-data (3.
|
17
|
+
mime-types-data (3.2020.1104)
|
17
18
|
netrc (0.11.0)
|
18
|
-
rest-client (2.0
|
19
|
+
rest-client (2.1.0)
|
20
|
+
http-accept (>= 1.7.0, < 2.0)
|
19
21
|
http-cookie (>= 1.0.2, < 2.0)
|
20
22
|
mime-types (>= 1.16, < 4.0)
|
21
23
|
netrc (~> 0.8)
|
22
24
|
unf (0.1.4)
|
23
25
|
unf_ext
|
24
|
-
unf_ext (0.0.7.
|
26
|
+
unf_ext (0.0.7.7)
|
25
27
|
|
26
28
|
PLATFORMS
|
27
29
|
ruby
|
@@ -30,4 +32,4 @@ DEPENDENCIES
|
|
30
32
|
octobat!
|
31
33
|
|
32
34
|
BUNDLED WITH
|
33
|
-
1.
|
35
|
+
1.17.3
|
data/History.txt
CHANGED
@@ -1,3 +1,26 @@
|
|
1
|
+
=== 2.0.23 2020-12-03
|
2
|
+
* 1 minor enhancements:
|
3
|
+
* Add support for Invoice#set_payment_terms endpoint
|
4
|
+
|
5
|
+
=== 2.0.22 2020-11-23
|
6
|
+
* 1 minor enhancements:
|
7
|
+
* Add support for CustomerBalanceTransaction object
|
8
|
+
|
9
|
+
=== 2.0.21 2020-11-12
|
10
|
+
* 3 major enhancements:
|
11
|
+
* Add support for Supplier object
|
12
|
+
* Add support for SelfBillingInvoice object
|
13
|
+
* Add support for PurchaseItem object
|
14
|
+
|
15
|
+
=== 2.0.20 2020-10-05
|
16
|
+
* 1 major enhancements:
|
17
|
+
* Add support for Beanie::Session object
|
18
|
+
|
19
|
+
=== 2.0.19 2020-05-28
|
20
|
+
* 2 major enhancements:
|
21
|
+
* Add { opts } param for all nested methods, so you can include headers such as the Connected Octobat Account ID in subrequests
|
22
|
+
* Add support for CreditNote#cancel endpoint
|
23
|
+
|
1
24
|
=== 2.0.18 2020-05-25
|
2
25
|
* 3 major enhancements:
|
3
26
|
* Add support for multipart encoder (file upload)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.23
|
data/lib/octobat.rb
CHANGED
@@ -25,11 +25,15 @@ require 'octobat/singleton_api_resource'
|
|
25
25
|
require 'octobat/list_object'
|
26
26
|
|
27
27
|
require 'octobat/customer'
|
28
|
+
require 'octobat/supplier'
|
28
29
|
require 'octobat/transaction'
|
30
|
+
require 'octobat/customer_balance_transaction'
|
29
31
|
require 'octobat/item'
|
32
|
+
require 'octobat/purchase_item'
|
30
33
|
require 'octobat/document'
|
31
34
|
require 'octobat/invoice'
|
32
35
|
require 'octobat/credit_note'
|
36
|
+
require 'octobat/self_billing_invoice'
|
33
37
|
require 'octobat/proforma_invoice'
|
34
38
|
require 'octobat/payment_recipient'
|
35
39
|
require 'octobat/payment_recipient_reference'
|
@@ -54,6 +58,7 @@ require 'octobat/tax_id'
|
|
54
58
|
|
55
59
|
require 'octobat/file_upload'
|
56
60
|
require 'octobat/file_link'
|
61
|
+
require 'octobat/beanie/session'
|
57
62
|
require 'octobat/reporting/report_type'
|
58
63
|
require 'octobat/reporting/report_run'
|
59
64
|
|
data/lib/octobat/coupon.rb
CHANGED
@@ -4,20 +4,21 @@ module Octobat
|
|
4
4
|
include Octobat::APIOperations::Create
|
5
5
|
include Octobat::APIOperations::Update
|
6
6
|
|
7
|
-
def activate
|
8
|
-
response, api_key = Octobat.request(:patch, activate_url, @api_key)
|
7
|
+
def activate(params = {}, opts = {})
|
8
|
+
response, api_key = Octobat.request(:patch, activate_url, @api_key, params, opts)
|
9
9
|
refresh_from(response, api_key)
|
10
10
|
end
|
11
11
|
|
12
|
-
def unactivate
|
13
|
-
response, api_key = Octobat.request(:patch, unactivate_url, @api_key)
|
12
|
+
def unactivate(params = {}, opts = {})
|
13
|
+
response, api_key = Octobat.request(:patch, unactivate_url, @api_key, params, opts)
|
14
14
|
refresh_from(response, api_key)
|
15
15
|
end
|
16
16
|
|
17
|
-
def delete
|
18
|
-
response, api_key = Octobat.request(:delete, url, @api_key)
|
17
|
+
def delete(params = {}, opts = {})
|
18
|
+
response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
|
19
19
|
refresh_from(response, api_key)
|
20
20
|
end
|
21
|
+
|
21
22
|
|
22
23
|
private
|
23
24
|
|
data/lib/octobat/credit_note.rb
CHANGED
@@ -12,30 +12,41 @@ module Octobat
|
|
12
12
|
|
13
13
|
instance = self.new(nil, opts)
|
14
14
|
|
15
|
-
response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params)
|
15
|
+
response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params, headers)
|
16
16
|
return true
|
17
17
|
end
|
18
18
|
|
19
19
|
|
20
|
-
def send_by_email(
|
21
|
-
response, api_key = Octobat.request(:post, send_url, @api_key,
|
20
|
+
def send_by_email(params = {}, opts = {})
|
21
|
+
response, api_key = Octobat.request(:post, send_url, @api_key, params, opts)
|
22
22
|
refresh_from(response, api_key)
|
23
23
|
end
|
24
24
|
|
25
|
-
def confirm(
|
26
|
-
response, api_key = Octobat.request(:patch, confirm_url, @api_key,
|
25
|
+
def confirm(params = {}, opts = {})
|
26
|
+
response, api_key = Octobat.request(:patch, confirm_url, @api_key, params, opts)
|
27
27
|
refresh_from(response, api_key)
|
28
28
|
end
|
29
|
+
|
30
|
+
|
31
|
+
def cancel(params = {}, opts = {})
|
32
|
+
response, api_key = Octobat.request(:patch, cancel_url, @api_key, params, opts)
|
33
|
+
refresh_from(response, api_key)
|
34
|
+
end
|
35
|
+
|
36
|
+
|
29
37
|
|
30
|
-
def items(params = {})
|
31
|
-
Item.list(params.merge({credit_note: id }), @api_key)
|
38
|
+
def items(params = {}, opts = {})
|
39
|
+
Item.list(params.merge({ credit_note: id }), {api_key: @api_key}.merge(opts))
|
32
40
|
end
|
33
41
|
|
34
|
-
def transactions(params = {})
|
35
|
-
Transaction.list(params.merge(credit_note: id), @api_key)
|
42
|
+
def transactions(params = {}, opts = {})
|
43
|
+
Transaction.list(params.merge(credit_note: id), {api_key: @api_key}.merge(opts))
|
36
44
|
end
|
37
45
|
|
38
46
|
private
|
47
|
+
def cancel_url
|
48
|
+
url + '/cancel'
|
49
|
+
end
|
39
50
|
|
40
51
|
def send_url
|
41
52
|
url + '/send'
|
@@ -4,8 +4,8 @@ module Octobat
|
|
4
4
|
include Octobat::APIOperations::Create
|
5
5
|
include Octobat::APIOperations::Update
|
6
6
|
|
7
|
-
def set_to_default
|
8
|
-
response, api_key = Octobat.request(:patch, set_to_default_url, @api_key)
|
7
|
+
def set_to_default(params = {}, opts = {})
|
8
|
+
response, api_key = Octobat.request(:patch, set_to_default_url, @api_key, params, opts)
|
9
9
|
refresh_from(response, api_key)
|
10
10
|
end
|
11
11
|
|
data/lib/octobat/customer.rb
CHANGED
@@ -5,16 +5,21 @@ module Octobat
|
|
5
5
|
include Octobat::APIOperations::Update
|
6
6
|
include Octobat::APIOperations::Delete
|
7
7
|
|
8
|
-
def invoices(params = {})
|
9
|
-
Invoice.
|
8
|
+
def invoices(params = {}, opts = {})
|
9
|
+
Invoice.list(params.merge({ :customer => id }), {api_key: @api_key}.merge(opts))
|
10
10
|
end
|
11
11
|
|
12
|
-
def credit_notes(params = {})
|
13
|
-
CreditNote.
|
12
|
+
def credit_notes(params = {}, opts = {})
|
13
|
+
CreditNote.list(params.merge({ :customer => id }), {api_key: @api_key}.merge(opts))
|
14
14
|
end
|
15
15
|
|
16
|
-
def payment_sources(params = {})
|
17
|
-
PaymentSource.
|
16
|
+
def payment_sources(params = {}, opts = {})
|
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
|
data/lib/octobat/document.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
module Octobat
|
2
2
|
class Document < APIResource
|
3
3
|
|
4
|
-
|
5
4
|
def self.csv_export(params = {}, opts={})
|
6
5
|
api_key, headers = Util.parse_opts(opts)
|
7
6
|
api_key ||= @api_key
|
@@ -9,7 +8,7 @@ module Octobat
|
|
9
8
|
|
10
9
|
instance = self.new(nil, opts)
|
11
10
|
|
12
|
-
response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params)
|
11
|
+
response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params, opts)
|
13
12
|
return true
|
14
13
|
end
|
15
14
|
|
@@ -10,7 +10,7 @@ module Octobat
|
|
10
10
|
|
11
11
|
instance = self.new(nil, opts)
|
12
12
|
|
13
|
-
response, api_key = Octobat.request(:get, url + '/default', api_key, params)
|
13
|
+
response, api_key = Octobat.request(:get, url + '/default', api_key, params, opts)
|
14
14
|
instance.refresh_from(response, api_key)
|
15
15
|
instance
|
16
16
|
end
|
@@ -10,7 +10,7 @@ module Octobat
|
|
10
10
|
|
11
11
|
instance = self.new(nil, opts)
|
12
12
|
|
13
|
-
response, api_key = Octobat.request(:get, url + '/default', api_key, params)
|
13
|
+
response, api_key = Octobat.request(:get, url + '/default', api_key, params, opts)
|
14
14
|
instance.refresh_from(response, api_key)
|
15
15
|
instance
|
16
16
|
end
|
@@ -4,23 +4,23 @@ module Octobat
|
|
4
4
|
include Octobat::APIOperations::Create
|
5
5
|
include Octobat::APIOperations::Update
|
6
6
|
|
7
|
-
def duplicate(params = {})
|
8
|
-
response, api_key = Octobat.request(:post, duplicate_url, @api_key, params)
|
7
|
+
def duplicate(params = {}, opts = {})
|
8
|
+
response, api_key = Octobat.request(:post, duplicate_url, @api_key, params, opts)
|
9
9
|
refresh_from(response, api_key)
|
10
10
|
end
|
11
11
|
|
12
|
-
def activate
|
13
|
-
response, api_key = Octobat.request(:patch, activate_url, @api_key)
|
12
|
+
def activate(params = {}, opts = {})
|
13
|
+
response, api_key = Octobat.request(:patch, activate_url, @api_key, params, opts)
|
14
14
|
refresh_from(response, api_key)
|
15
15
|
end
|
16
16
|
|
17
|
-
def delete
|
18
|
-
response, api_key = Octobat.request(:delete, url, @api_key)
|
17
|
+
def delete(params = {}, opts = {})
|
18
|
+
response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
|
19
19
|
refresh_from(response, api_key)
|
20
20
|
end
|
21
21
|
|
22
|
-
def preview(params = {})
|
23
|
-
response, api_key = Octobat.request(:get, preview_url, @api_key, params)
|
22
|
+
def preview(params = {}, opts = {})
|
23
|
+
response, api_key = Octobat.request(:get, preview_url, @api_key, params, opts)
|
24
24
|
refresh_from(response, api_key)
|
25
25
|
end
|
26
26
|
|
@@ -10,7 +10,7 @@ module Octobat
|
|
10
10
|
|
11
11
|
instance = self.new(nil, opts)
|
12
12
|
|
13
|
-
response, api_key = Octobat.request(:get, url + '/default', api_key, params)
|
13
|
+
response, api_key = Octobat.request(:get, url + '/default', api_key, params, opts)
|
14
14
|
instance.refresh_from(response, api_key)
|
15
15
|
instance
|
16
16
|
end
|
@@ -10,7 +10,7 @@ module Octobat
|
|
10
10
|
|
11
11
|
instance = self.new(nil, opts)
|
12
12
|
|
13
|
-
response, api_key = Octobat.request(:get, url + '/default', api_key, params)
|
13
|
+
response, api_key = Octobat.request(:get, url + '/default', api_key, params, opts)
|
14
14
|
instance.refresh_from(response, api_key)
|
15
15
|
instance
|
16
16
|
end
|
data/lib/octobat/invoice.rb
CHANGED
@@ -12,7 +12,7 @@ module Octobat
|
|
12
12
|
|
13
13
|
instance = self.new(nil, opts)
|
14
14
|
|
15
|
-
response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params)
|
15
|
+
response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params, opts)
|
16
16
|
return true
|
17
17
|
end
|
18
18
|
|
@@ -23,42 +23,48 @@ module Octobat
|
|
23
23
|
|
24
24
|
instance = self.new(nil, opts)
|
25
25
|
|
26
|
-
response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params)
|
26
|
+
response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params, opts)
|
27
27
|
return true
|
28
28
|
end
|
29
29
|
|
30
30
|
|
31
|
-
def send_by_email(
|
32
|
-
response, api_key = Octobat.request(:post, send_url, @api_key,
|
31
|
+
def send_by_email(params = {}, opts = {})
|
32
|
+
response, api_key = Octobat.request(:post, send_url, @api_key, params, opts)
|
33
33
|
refresh_from(response, api_key)
|
34
34
|
end
|
35
35
|
|
36
|
-
def confirm(
|
37
|
-
response, api_key = Octobat.request(:patch, confirm_url, @api_key,
|
36
|
+
def confirm(params = {}, opts = {})
|
37
|
+
response, api_key = Octobat.request(:patch, confirm_url, @api_key, params, opts)
|
38
38
|
refresh_from(response, api_key)
|
39
39
|
end
|
40
|
+
|
41
|
+
def set_payment_terms(params = {}, opts = {})
|
42
|
+
response, api_key = Octobat.request(:patch, set_payment_terms_url, @api_key, params, opts)
|
43
|
+
refresh_from(response, api_key)
|
44
|
+
end
|
45
|
+
|
40
46
|
|
41
|
-
def cancel
|
42
|
-
response, api_key = Octobat.request(:patch, cancel_url, @api_key)
|
47
|
+
def cancel(params = {}, opts = {})
|
48
|
+
response, api_key = Octobat.request(:patch, cancel_url, @api_key, params, opts)
|
43
49
|
refresh_from(response, api_key)
|
44
50
|
end
|
45
51
|
|
46
|
-
def cancel_and_replace
|
47
|
-
response, api_key = Octobat.request(:patch, cancel_and_replace_url, @api_key)
|
52
|
+
def cancel_and_replace(params = {}, opts = {})
|
53
|
+
response, api_key = Octobat.request(:patch, cancel_and_replace_url, @api_key, params, opts)
|
48
54
|
refresh_from(response, api_key)
|
49
55
|
end
|
50
56
|
|
51
|
-
def delete
|
52
|
-
response, api_key = Octobat.request(:delete, url, @api_key)
|
57
|
+
def delete(params = {}, opts = {})
|
58
|
+
response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
|
53
59
|
refresh_from(response, api_key)
|
54
60
|
end
|
55
61
|
|
56
|
-
def items(params = {})
|
57
|
-
Item.list(params.merge({ :invoice => id }), @api_key)
|
62
|
+
def items(params = {}, opts = {})
|
63
|
+
Item.list(params.merge({ :invoice => id }), {api_key: @api_key}.merge(opts))
|
58
64
|
end
|
59
65
|
|
60
|
-
def transactions(params = {})
|
61
|
-
Transaction.list(params.merge(invoice: id), @api_key)
|
66
|
+
def transactions(params = {}, opts = {})
|
67
|
+
Transaction.list(params.merge(invoice: id), {api_key: @api_key}.merge(opts))
|
62
68
|
end
|
63
69
|
|
64
70
|
|
@@ -71,6 +77,10 @@ module Octobat
|
|
71
77
|
def confirm_url
|
72
78
|
url + '/confirm'
|
73
79
|
end
|
80
|
+
|
81
|
+
def set_payment_terms_url
|
82
|
+
url + '/set_payment_terms'
|
83
|
+
end
|
74
84
|
|
75
85
|
def cancel_url
|
76
86
|
url + '/cancel'
|
@@ -4,8 +4,8 @@ module Octobat
|
|
4
4
|
include Octobat::APIOperations::Create
|
5
5
|
include Octobat::APIOperations::Update
|
6
6
|
|
7
|
-
def set_to_default
|
8
|
-
response, api_key = Octobat.request(:patch, set_to_default_url, @api_key)
|
7
|
+
def set_to_default(params = {}, opts = {})
|
8
|
+
response, api_key = Octobat.request(:patch, set_to_default_url, @api_key, params, opts)
|
9
9
|
refresh_from(response, api_key)
|
10
10
|
end
|
11
11
|
|
data/lib/octobat/order.rb
CHANGED
@@ -3,8 +3,8 @@ module Octobat
|
|
3
3
|
extend Octobat::APIOperations::List
|
4
4
|
include Octobat::APIOperations::Update
|
5
5
|
|
6
|
-
def expire
|
7
|
-
response, api_key = Octobat.request(:patch, expire_url, @api_key)
|
6
|
+
def expire(params = {}, opts = {})
|
7
|
+
response, api_key = Octobat.request(:patch, expire_url, @api_key, params, opts)
|
8
8
|
refresh_from(response, api_key)
|
9
9
|
end
|
10
10
|
|
data/lib/octobat/payout.rb
CHANGED
@@ -2,8 +2,8 @@ module Octobat
|
|
2
2
|
class Payout < APIResource
|
3
3
|
extend Octobat::APIOperations::List
|
4
4
|
|
5
|
-
def balance_transactions(params = {})
|
6
|
-
BalanceTransaction.list(params.merge({ payout: id }), @api_key)
|
5
|
+
def balance_transactions(params = {}, opts = {})
|
6
|
+
BalanceTransaction.list(params.merge({ payout: id }), {api_key: @api_key}.merge(opts))
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.csv_export(params = {}, opts={})
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Octobat
|
2
|
+
class PurchaseItem < APIResource
|
3
|
+
extend Octobat::APIOperations::List
|
4
|
+
include Octobat::APIOperations::Create
|
5
|
+
include Octobat::APIOperations::Update
|
6
|
+
include Octobat::APIOperations::Delete
|
7
|
+
|
8
|
+
|
9
|
+
def url
|
10
|
+
!parent_obj.nil? ? parentize_url : super
|
11
|
+
end
|
12
|
+
|
13
|
+
|
14
|
+
def save_url
|
15
|
+
if self[:id] == nil && self.class.respond_to?(:create)
|
16
|
+
self.relative_save_url
|
17
|
+
else
|
18
|
+
url
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def parentize_url
|
24
|
+
if parent_obj.include?(:self_billing_invoice)
|
25
|
+
"#{SelfBillingInvoice.url}/#{CGI.escape(parent_obj[:self_billing_invoice])}/purchase_items/#{CGI.escape(id)}"
|
26
|
+
else
|
27
|
+
url
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
def relative_save_url
|
34
|
+
if self[:self_billing_invoice]
|
35
|
+
"#{SelfBillingInvoice.url}/#{CGI.escape(self[:self_billing_invoice])}/purchase_items"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
def self.url
|
41
|
+
if @parent_resource.include?(:self_billing_invoice)
|
42
|
+
"#{SelfBillingInvoice.url}/#{CGI.escape(@parent_resource[:self_billing_invoice])}/purchase_items"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.set_parent_resource(filters)
|
47
|
+
@parent_resource = filters.select{|k, v| [:self_billing_invoice].include?(k)}
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module Octobat
|
2
|
+
class SelfBillingInvoice < APIResource
|
3
|
+
extend Octobat::APIOperations::List
|
4
|
+
include Octobat::APIOperations::Create
|
5
|
+
include Octobat::APIOperations::Update
|
6
|
+
|
7
|
+
|
8
|
+
# def self.pdf_export(params = {}, opts={})
|
9
|
+
# api_key, headers = Util.parse_opts(opts)
|
10
|
+
# api_key ||= @api_key
|
11
|
+
# opts[:api_key] = api_key
|
12
|
+
#
|
13
|
+
# instance = self.new(nil, opts)
|
14
|
+
#
|
15
|
+
# response, api_key = Octobat.request(:post, url + '/pdf_export', api_key, params, opts)
|
16
|
+
# return true
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# def self.csv_export(params = {}, opts={})
|
20
|
+
# api_key, headers = Util.parse_opts(opts)
|
21
|
+
# api_key ||= @api_key
|
22
|
+
# opts[:api_key] = api_key
|
23
|
+
#
|
24
|
+
# instance = self.new(nil, opts)
|
25
|
+
#
|
26
|
+
# response, api_key = Octobat.request(:post, url + '/csv_export', api_key, params, opts)
|
27
|
+
# return true
|
28
|
+
# end
|
29
|
+
|
30
|
+
|
31
|
+
def send_by_email(params = {}, opts = {})
|
32
|
+
response, api_key = Octobat.request(:post, send_url, @api_key, params, opts)
|
33
|
+
refresh_from(response, api_key)
|
34
|
+
end
|
35
|
+
|
36
|
+
def confirm(params = {}, opts = {})
|
37
|
+
response, api_key = Octobat.request(:patch, confirm_url, @api_key, params, opts)
|
38
|
+
refresh_from(response, api_key)
|
39
|
+
end
|
40
|
+
|
41
|
+
def cancel(params = {}, opts = {})
|
42
|
+
response, api_key = Octobat.request(:patch, cancel_url, @api_key, params, opts)
|
43
|
+
refresh_from(response, api_key)
|
44
|
+
end
|
45
|
+
|
46
|
+
def delete(params = {}, opts = {})
|
47
|
+
response, api_key = Octobat.request(:delete, url, @api_key, params, opts)
|
48
|
+
refresh_from(response, api_key)
|
49
|
+
end
|
50
|
+
|
51
|
+
def purchase_items(params = {}, opts = {})
|
52
|
+
PurchaseItem.list(params.merge({ :self_billing_invoice => id }), {api_key: @api_key}.merge(opts))
|
53
|
+
end
|
54
|
+
|
55
|
+
# def transactions(params = {}, opts = {})
|
56
|
+
# Transaction.list(params.merge(invoice: id), {api_key: @api_key}.merge(opts))
|
57
|
+
# end
|
58
|
+
|
59
|
+
|
60
|
+
private
|
61
|
+
|
62
|
+
def send_url
|
63
|
+
url + '/send'
|
64
|
+
end
|
65
|
+
|
66
|
+
def confirm_url
|
67
|
+
url + '/confirm'
|
68
|
+
end
|
69
|
+
|
70
|
+
def cancel_url
|
71
|
+
url + '/cancel'
|
72
|
+
end
|
73
|
+
|
74
|
+
end
|
75
|
+
|
76
|
+
|
77
|
+
end
|
@@ -9,7 +9,7 @@ module Octobat
|
|
9
9
|
|
10
10
|
instance = self.new(nil, opts)
|
11
11
|
|
12
|
-
response, api_key = Octobat.request(:post, url + '/for_supplier', api_key, params)
|
12
|
+
response, api_key = Octobat.request(:post, url + '/for_supplier', api_key, params, opts)
|
13
13
|
instance.refresh_from(response, api_key)
|
14
14
|
instance
|
15
15
|
end
|
data/lib/octobat/tax_id.rb
CHANGED
@@ -4,8 +4,8 @@ module Octobat
|
|
4
4
|
include Octobat::APIOperations::Create
|
5
5
|
include Octobat::APIOperations::Update
|
6
6
|
|
7
|
-
def archive
|
8
|
-
response, api_key = Octobat.request(:patch, archive_url, @api_key)
|
7
|
+
def archive(params = {}, opts = {})
|
8
|
+
response, api_key = Octobat.request(:patch, archive_url, @api_key, params, opts)
|
9
9
|
refresh_from(response, api_key)
|
10
10
|
end
|
11
11
|
|
@@ -4,13 +4,13 @@ module Octobat
|
|
4
4
|
include Octobat::APIOperations::Update
|
5
5
|
include Octobat::APIOperations::Create
|
6
6
|
|
7
|
-
def activate
|
8
|
-
response, api_key = Octobat.request(:patch, activate_url, @api_key)
|
7
|
+
def activate(params = {}, opts = {})
|
8
|
+
response, api_key = Octobat.request(:patch, activate_url, @api_key, params, opts)
|
9
9
|
refresh_from(response, api_key)
|
10
10
|
end
|
11
11
|
|
12
|
-
def unactivate
|
13
|
-
response, api_key = Octobat.request(:patch, unactivate_url, @api_key)
|
12
|
+
def unactivate(params = {}, opts = {})
|
13
|
+
response, api_key = Octobat.request(:patch, unactivate_url, @api_key, params, opts)
|
14
14
|
refresh_from(response, api_key)
|
15
15
|
end
|
16
16
|
|
data/lib/octobat/transaction.rb
CHANGED
@@ -4,8 +4,8 @@ module Octobat
|
|
4
4
|
include Octobat::APIOperations::Create
|
5
5
|
include Octobat::APIOperations::Update
|
6
6
|
|
7
|
-
def items(params = {})
|
8
|
-
Item.list(params.merge({ :transaction => id }), @api_key)
|
7
|
+
def items(params = {}, opts = {})
|
8
|
+
Item.list(params.merge({ :transaction => id }), {api_key: @api_key}.merge(opts))
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.csv_export(params = {}, opts={})
|
data/lib/octobat/util.rb
CHANGED
@@ -47,7 +47,11 @@ module Octobat
|
|
47
47
|
'invoice' => Invoice,
|
48
48
|
'credit_note' => CreditNote,
|
49
49
|
'item' => Item,
|
50
|
+
'purchase_item' => PurchaseItem,
|
50
51
|
'customer' => Customer,
|
52
|
+
'customer_balance_transaction' => CustomerBalanceTransaction,
|
53
|
+
'supplier' => Supplier,
|
54
|
+
'self_billing_invoice' => SelfBillingInvoice,
|
51
55
|
'payout' => Payout,
|
52
56
|
'balance_transaction' => BalanceTransaction,
|
53
57
|
'document_template' => DocumentTemplate,
|
@@ -68,6 +72,7 @@ module Octobat
|
|
68
72
|
'emails_setting' => EmailsSetting,
|
69
73
|
'file' => FileUpload,
|
70
74
|
'file_link' => FileLink,
|
75
|
+
'beanie.session' => Beanie::Session,
|
71
76
|
'reporting.report_type' => Reporting::ReportType,
|
72
77
|
'reporting.report_run' => Reporting::ReportRun
|
73
78
|
}
|
data/lib/octobat/version.rb
CHANGED
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.
|
4
|
+
version: 2.0.23
|
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
|
+
date: 2020-12-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -61,12 +61,14 @@ files:
|
|
61
61
|
- lib/octobat/api_operations/update.rb
|
62
62
|
- lib/octobat/api_resource.rb
|
63
63
|
- lib/octobat/balance_transaction.rb
|
64
|
+
- lib/octobat/beanie/session.rb
|
64
65
|
- lib/octobat/certificate_blacklist.rb
|
65
66
|
- lib/octobat/checkout.rb
|
66
67
|
- lib/octobat/coupon.rb
|
67
68
|
- lib/octobat/credit_note.rb
|
68
69
|
- lib/octobat/credit_note_numbering_sequence.rb
|
69
70
|
- lib/octobat/customer.rb
|
71
|
+
- lib/octobat/customer_balance_transaction.rb
|
70
72
|
- lib/octobat/document.rb
|
71
73
|
- lib/octobat/document_email_template.rb
|
72
74
|
- lib/octobat/document_language.rb
|
@@ -94,9 +96,12 @@ files:
|
|
94
96
|
- lib/octobat/payout.rb
|
95
97
|
- lib/octobat/product.rb
|
96
98
|
- lib/octobat/proforma_invoice.rb
|
99
|
+
- lib/octobat/purchase_item.rb
|
97
100
|
- lib/octobat/reporting/report_run.rb
|
98
101
|
- lib/octobat/reporting/report_type.rb
|
102
|
+
- lib/octobat/self_billing_invoice.rb
|
99
103
|
- lib/octobat/singleton_api_resource.rb
|
104
|
+
- lib/octobat/supplier.rb
|
100
105
|
- lib/octobat/tax_evidence.rb
|
101
106
|
- lib/octobat/tax_evidence_request.rb
|
102
107
|
- lib/octobat/tax_id.rb
|
@@ -125,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
130
|
version: '0'
|
126
131
|
requirements: []
|
127
132
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.
|
133
|
+
rubygems_version: 2.7.6.2
|
129
134
|
signing_key:
|
130
135
|
specification_version: 4
|
131
136
|
summary: Ruby bindings for the Octobat API
|