octobat 2.0.20 → 2.0.25
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/History.txt +23 -2
- data/VERSION +1 -1
- data/lib/octobat.rb +6 -0
- data/lib/octobat/customer.rb +5 -0
- data/lib/octobat/customer_balance_transaction.rb +50 -0
- data/lib/octobat/invoice.rb +19 -0
- data/lib/octobat/purchase_item.rb +52 -0
- data/lib/octobat/self_billing_invoice.rb +77 -0
- data/lib/octobat/subscription.rb +13 -0
- data/lib/octobat/supplier.rb +8 -0
- data/lib/octobat/usage_item.rb +51 -0
- data/lib/octobat/util.rb +6 -0
- data/lib/octobat/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c0554602d9f2b3795ebeb50fc235d1b3fdf1da9a01222153d15a3d2167a35b0
|
4
|
+
data.tar.gz: dcf455738a4a19b5ed27028854b1bc344c7ac37efe8ceb63b92239827e54bdcc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4f760778d1fa6800a687b9eb690688f19809d8fbfaf593648a832defa02e983a0d3da1e7e64b86f6d0e24d9767446cb8cb1cd3f5027215d498a15493cd1d434e
|
7
|
+
data.tar.gz: 43e40f5f2152c0d8da4d807cf29738fa296107f4b68eace16f713d94ec79ab67992b850b88d15bcbd42cad3d1962a808044e273d248a49de277a7f66f682ed3d
|
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.25)
|
5
5
|
rest-client (>= 1.4, < 4.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -14,7 +14,7 @@ GEM
|
|
14
14
|
domain_name (~> 0.5)
|
15
15
|
mime-types (3.3.1)
|
16
16
|
mime-types-data (~> 3.2015)
|
17
|
-
mime-types-data (3.2020.
|
17
|
+
mime-types-data (3.2020.1104)
|
18
18
|
netrc (0.11.0)
|
19
19
|
rest-client (2.1.0)
|
20
20
|
http-accept (>= 1.7.0, < 2.0)
|
data/History.txt
CHANGED
@@ -1,14 +1,35 @@
|
|
1
|
+
=== 2.0.25 2020-12-24
|
2
|
+
* 2 major enhancements:
|
3
|
+
* Add support for Subscription object
|
4
|
+
* Add support for UsageItem object
|
5
|
+
|
6
|
+
=== 2.0.24 2020-12-15
|
7
|
+
* 1 minor enhancements:
|
8
|
+
* Add support for Invoice#mark_uncollectible endpoint
|
9
|
+
|
10
|
+
=== 2.0.23 2020-12-03
|
11
|
+
* 1 minor enhancements:
|
12
|
+
* Add support for Invoice#set_payment_terms endpoint
|
13
|
+
|
14
|
+
=== 2.0.22 2020-11-23
|
15
|
+
* 1 minor enhancements:
|
16
|
+
* Add support for CustomerBalanceTransaction object
|
17
|
+
|
18
|
+
=== 2.0.21 2020-11-12
|
19
|
+
* 3 major enhancements:
|
20
|
+
* Add support for Supplier object
|
21
|
+
* Add support for SelfBillingInvoice object
|
22
|
+
* Add support for PurchaseItem object
|
23
|
+
|
1
24
|
=== 2.0.20 2020-10-05
|
2
25
|
* 1 major enhancements:
|
3
26
|
* Add support for Beanie::Session object
|
4
27
|
|
5
|
-
|
6
28
|
=== 2.0.19 2020-05-28
|
7
29
|
* 2 major enhancements:
|
8
30
|
* Add { opts } param for all nested methods, so you can include headers such as the Connected Octobat Account ID in subrequests
|
9
31
|
* Add support for CreditNote#cancel endpoint
|
10
32
|
|
11
|
-
|
12
33
|
=== 2.0.18 2020-05-25
|
13
34
|
* 3 major enhancements:
|
14
35
|
* Add support for multipart encoder (file upload)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.25
|
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'
|
@@ -51,6 +55,8 @@ require 'octobat/document_email_template'
|
|
51
55
|
require 'octobat/exports_setting'
|
52
56
|
require 'octobat/emails_setting'
|
53
57
|
require 'octobat/tax_id'
|
58
|
+
require 'octobat/subscription'
|
59
|
+
require 'octobat/usage_item'
|
54
60
|
|
55
61
|
require 'octobat/file_upload'
|
56
62
|
require 'octobat/file_link'
|
data/lib/octobat/customer.rb
CHANGED
@@ -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
|
data/lib/octobat/invoice.rb
CHANGED
@@ -37,6 +37,17 @@ module Octobat
|
|
37
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
|
+
|
46
|
+
def mark_uncollectible(params = {}, opts = {})
|
47
|
+
response, api_key = Octobat.request(:patch, mark_uncollectible_url, @api_key, params, opts)
|
48
|
+
refresh_from(response, api_key)
|
49
|
+
end
|
50
|
+
|
40
51
|
|
41
52
|
def cancel(params = {}, opts = {})
|
42
53
|
response, api_key = Octobat.request(:patch, cancel_url, @api_key, params, opts)
|
@@ -71,6 +82,14 @@ module Octobat
|
|
71
82
|
def confirm_url
|
72
83
|
url + '/confirm'
|
73
84
|
end
|
85
|
+
|
86
|
+
def mark_uncollectible_url
|
87
|
+
url + '/mark_uncollectible'
|
88
|
+
end
|
89
|
+
|
90
|
+
def set_payment_terms_url
|
91
|
+
url + '/set_payment_terms'
|
92
|
+
end
|
74
93
|
|
75
94
|
def cancel_url
|
76
95
|
url + '/cancel'
|
@@ -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
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Octobat
|
2
|
+
class Subscription < APIResource
|
3
|
+
extend Octobat::APIOperations::List
|
4
|
+
include Octobat::APIOperations::Create
|
5
|
+
|
6
|
+
def usage_items(params = {}, opts = {})
|
7
|
+
UsageItem.list(params.merge({ subscription: id }), { api_key: @api_key }.merge(opts))
|
8
|
+
end
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module Octobat
|
2
|
+
class UsageItem < APIResource
|
3
|
+
extend Octobat::APIOperations::List
|
4
|
+
include Octobat::APIOperations::Create
|
5
|
+
include Octobat::APIOperations::Delete
|
6
|
+
|
7
|
+
|
8
|
+
def url
|
9
|
+
!parent_obj.nil? ? parentize_url : super
|
10
|
+
end
|
11
|
+
|
12
|
+
|
13
|
+
def save_url
|
14
|
+
if self[:id] == nil && self.class.respond_to?(:create)
|
15
|
+
self.relative_save_url
|
16
|
+
else
|
17
|
+
url
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
def parentize_url
|
23
|
+
if parent_obj.include?(:subscription)
|
24
|
+
"#{Subscription.url}/#{CGI.escape(parent_obj[:subscription])}/usage_items/#{CGI.escape(id)}"
|
25
|
+
else
|
26
|
+
url
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
|
31
|
+
|
32
|
+
def relative_save_url
|
33
|
+
if self[:subscription]
|
34
|
+
"#{Subscription.url}/#{CGI.escape(self[:subscription])}/usage_items"
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
|
39
|
+
def self.url
|
40
|
+
if @parent_resource.include?(:subscription)
|
41
|
+
"#{Subscription.url}/#{CGI.escape(@parent_resource[:subscription])}/usage_items"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.set_parent_resource(filters)
|
46
|
+
@parent_resource = filters.select{|k, v| [:subscription].include?(k)}
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
end
|
51
|
+
end
|
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,
|
@@ -66,6 +70,8 @@ module Octobat
|
|
66
70
|
'exports_setting' => ExportsSetting,
|
67
71
|
'document' => Document,
|
68
72
|
'emails_setting' => EmailsSetting,
|
73
|
+
'subscription' => Subscription,
|
74
|
+
'usage_item' => UsageItem,
|
69
75
|
'file' => FileUpload,
|
70
76
|
'file_link' => FileLink,
|
71
77
|
'beanie.session' => Beanie::Session,
|
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.25
|
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-24 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
|
@@ -95,14 +96,19 @@ files:
|
|
95
96
|
- lib/octobat/payout.rb
|
96
97
|
- lib/octobat/product.rb
|
97
98
|
- lib/octobat/proforma_invoice.rb
|
99
|
+
- lib/octobat/purchase_item.rb
|
98
100
|
- lib/octobat/reporting/report_run.rb
|
99
101
|
- lib/octobat/reporting/report_type.rb
|
102
|
+
- lib/octobat/self_billing_invoice.rb
|
100
103
|
- lib/octobat/singleton_api_resource.rb
|
104
|
+
- lib/octobat/subscription.rb
|
105
|
+
- lib/octobat/supplier.rb
|
101
106
|
- lib/octobat/tax_evidence.rb
|
102
107
|
- lib/octobat/tax_evidence_request.rb
|
103
108
|
- lib/octobat/tax_id.rb
|
104
109
|
- lib/octobat/tax_region_setting.rb
|
105
110
|
- lib/octobat/transaction.rb
|
111
|
+
- lib/octobat/usage_item.rb
|
106
112
|
- lib/octobat/util.rb
|
107
113
|
- lib/octobat/version.rb
|
108
114
|
- octobat.gemspec
|