octobat 2.0.19 → 2.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile.lock +8 -6
- data/History.txt +22 -1
- data/VERSION +1 -1
- data/lib/octobat.rb +5 -0
- data/lib/octobat/beanie/session.rb +13 -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/supplier.rb +8 -0
- 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: 0eeb9f15557ec712c3f01e86bf3406d4124b99bacdf5b386dec2e48f5512dba2
|
4
|
+
data.tar.gz: a6adc674b919beaf430ec9f5aeb2e6eb1b1d73a055a95d6da267b0290113eea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '096cd349be93183024bea215bf947728567212b63d715c318254e10e8aadc0d036d99c955524e869143bc5729a836d054dda803a3d172652518a52de71b7001a'
|
7
|
+
data.tar.gz: e25d72d5ccf99de21481f56ff56eec85dc286486e6bd076c1b10aa5bfba0d402889626f7ec57a895bbbb1251abbfb777e8bc3051b48de283dc45451dd6a411e2
|
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.24)
|
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,9 +1,30 @@
|
|
1
|
+
=== 2.0.24 2020-12-15
|
2
|
+
* 1 minor enhancements:
|
3
|
+
* Add support for Invoice#mark_uncollectible endpoint
|
4
|
+
|
5
|
+
=== 2.0.23 2020-12-03
|
6
|
+
* 1 minor enhancements:
|
7
|
+
* Add support for Invoice#set_payment_terms endpoint
|
8
|
+
|
9
|
+
=== 2.0.22 2020-11-23
|
10
|
+
* 1 minor enhancements:
|
11
|
+
* Add support for CustomerBalanceTransaction object
|
12
|
+
|
13
|
+
=== 2.0.21 2020-11-12
|
14
|
+
* 3 major enhancements:
|
15
|
+
* Add support for Supplier object
|
16
|
+
* Add support for SelfBillingInvoice object
|
17
|
+
* Add support for PurchaseItem object
|
18
|
+
|
19
|
+
=== 2.0.20 2020-10-05
|
20
|
+
* 1 major enhancements:
|
21
|
+
* Add support for Beanie::Session object
|
22
|
+
|
1
23
|
=== 2.0.19 2020-05-28
|
2
24
|
* 2 major enhancements:
|
3
25
|
* Add { opts } param for all nested methods, so you can include headers such as the Connected Octobat Account ID in subrequests
|
4
26
|
* Add support for CreditNote#cancel endpoint
|
5
27
|
|
6
|
-
|
7
28
|
=== 2.0.18 2020-05-25
|
8
29
|
* 3 major enhancements:
|
9
30
|
* Add support for multipart encoder (file upload)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.24
|
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/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
|
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.24
|
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-15 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
|