octobat 2.0.20 → 2.0.21

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 46289335eaf2e2d1e07a0f70bd8c7bb94c9247d3e783cc5831d71986bb60bc1c
4
- data.tar.gz: f0f90eed29eefe39d4a5a8466ea96506621feb46b180b388f1840143b3f38251
3
+ metadata.gz: 39cb7d7e756a8a19162b43f02eddf46ff9ea2b0d3cf6cc7fa63c35e130393c36
4
+ data.tar.gz: a199b92d99133f31b953ff6da3793e15ae0f29c0efd870e309a27a3ebb57352a
5
5
  SHA512:
6
- metadata.gz: 9256636dcec153772c0f1c61035aa12e1f73f3a3c8f9649d2761144aa778a4b27fc99b8f9faf21ef008ba3f88bdc07da656a8edac93ddd1066bce1a049f2ec23
7
- data.tar.gz: b50267b05a5a0245bab7c3b57514bf9a5f1da4f491fed0148cf1b497f00d89b7e35f011645fad6b2ead7a6e537d417afa201de881273df0d1f4527639bb4591a
6
+ metadata.gz: '069f1946a31e8e0cc703a297bfccc4388ad8f1fd7709405f40f1e87578f76cd41f249c3611142a49ea94ff8c21673b971bcf9700dfba28815ce7a12b51727f94'
7
+ data.tar.gz: f8146563ae30ef4bd58d134ad563c3faf783fdc5c7fdf37962803100b40a2753af56825570943a53dc8d42c439d1717d897a09d2be50fead8b6567173b33c498
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- octobat (2.0.20)
4
+ octobat (2.0.21)
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.0512)
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)
@@ -1,8 +1,13 @@
1
+ === 2.0.21 2020-11-12
2
+ * 3 major enhancements:
3
+ * Add support for Supplier object
4
+ * Add support for SelfBillingInvoice object
5
+ * Add support for PurchaseItem object
6
+
1
7
  === 2.0.20 2020-10-05
2
8
  * 1 major enhancements:
3
9
  * Add support for Beanie::Session object
4
10
 
5
-
6
11
  === 2.0.19 2020-05-28
7
12
  * 2 major enhancements:
8
13
  * Add { opts } param for all nested methods, so you can include headers such as the Connected Octobat Account ID in subrequests
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.20
1
+ 2.0.21
@@ -25,11 +25,14 @@ 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'
29
30
  require 'octobat/item'
31
+ require 'octobat/purchase_item'
30
32
  require 'octobat/document'
31
33
  require 'octobat/invoice'
32
34
  require 'octobat/credit_note'
35
+ require 'octobat/self_billing_invoice'
33
36
  require 'octobat/proforma_invoice'
34
37
  require 'octobat/payment_recipient'
35
38
  require 'octobat/payment_recipient_reference'
@@ -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,8 @@
1
+ module Octobat
2
+ class Supplier < APIResource
3
+ extend Octobat::APIOperations::List
4
+ include Octobat::APIOperations::Create
5
+ include Octobat::APIOperations::Update
6
+ include Octobat::APIOperations::Delete
7
+ end
8
+ end
@@ -47,7 +47,10 @@ module Octobat
47
47
  'invoice' => Invoice,
48
48
  'credit_note' => CreditNote,
49
49
  'item' => Item,
50
+ 'purchase_item' => PurchaseItem,
50
51
  'customer' => Customer,
52
+ 'supplier' => Supplier,
53
+ 'self_billing_invoice' => SelfBillingInvoice,
51
54
  'payout' => Payout,
52
55
  'balance_transaction' => BalanceTransaction,
53
56
  'document_template' => DocumentTemplate,
@@ -1,3 +1,3 @@
1
1
  module Octobat
2
- VERSION = '2.0.20'
2
+ VERSION = '2.0.21'
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.20
4
+ version: 2.0.21
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-10-05 00:00:00.000000000 Z
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -95,9 +95,12 @@ files:
95
95
  - lib/octobat/payout.rb
96
96
  - lib/octobat/product.rb
97
97
  - lib/octobat/proforma_invoice.rb
98
+ - lib/octobat/purchase_item.rb
98
99
  - lib/octobat/reporting/report_run.rb
99
100
  - lib/octobat/reporting/report_type.rb
101
+ - lib/octobat/self_billing_invoice.rb
100
102
  - lib/octobat/singleton_api_resource.rb
103
+ - lib/octobat/supplier.rb
101
104
  - lib/octobat/tax_evidence.rb
102
105
  - lib/octobat/tax_evidence_request.rb
103
106
  - lib/octobat/tax_id.rb