octobat 2.0.22 → 2.0.25

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: f103ca1de7b1fa391b9e7d17530d78ada6d6353bd63c5c8e7db09047ef9e3063
4
- data.tar.gz: 9aa6e8e6c71f51f678e7087f4184154c419d70399254044059d30efdceee2d8e
3
+ metadata.gz: 8c0554602d9f2b3795ebeb50fc235d1b3fdf1da9a01222153d15a3d2167a35b0
4
+ data.tar.gz: dcf455738a4a19b5ed27028854b1bc344c7ac37efe8ceb63b92239827e54bdcc
5
5
  SHA512:
6
- metadata.gz: 5eb46faf6dfcfcc621f2aa8207a42e9c214b8af361bbc657058213e447e9a4b0bab9bcc274ebb68b7a5dc29a1b478568db23eded829becdb7f01f762153b511d
7
- data.tar.gz: 3fcd9c96dfd1d01d9ba83e6cdaa166ac9604eb67d48d364b3b9c3fe379528c4f02962f531f2d58d204ce8d97973171ddd554f2b61207d86c0031e51d539aa06e
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.22)
4
+ octobat (2.0.25)
5
5
  rest-client (>= 1.4, < 4.0)
6
6
 
7
7
  GEM
data/History.txt CHANGED
@@ -1,3 +1,16 @@
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
+
1
14
  === 2.0.22 2020-11-23
2
15
  * 1 minor enhancements:
3
16
  * Add support for CustomerBalanceTransaction object
@@ -17,7 +30,6 @@
17
30
  * Add { opts } param for all nested methods, so you can include headers such as the Connected Octobat Account ID in subrequests
18
31
  * Add support for CreditNote#cancel endpoint
19
32
 
20
-
21
33
  === 2.0.18 2020-05-25
22
34
  * 3 major enhancements:
23
35
  * Add support for multipart encoder (file upload)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.22
1
+ 2.0.25
data/lib/octobat.rb CHANGED
@@ -55,6 +55,8 @@ require 'octobat/document_email_template'
55
55
  require 'octobat/exports_setting'
56
56
  require 'octobat/emails_setting'
57
57
  require 'octobat/tax_id'
58
+ require 'octobat/subscription'
59
+ require 'octobat/usage_item'
58
60
 
59
61
  require 'octobat/file_upload'
60
62
  require 'octobat/file_link'
@@ -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,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
@@ -70,6 +70,8 @@ module Octobat
70
70
  'exports_setting' => ExportsSetting,
71
71
  'document' => Document,
72
72
  'emails_setting' => EmailsSetting,
73
+ 'subscription' => Subscription,
74
+ 'usage_item' => UsageItem,
73
75
  'file' => FileUpload,
74
76
  'file_link' => FileLink,
75
77
  'beanie.session' => Beanie::Session,
@@ -1,3 +1,3 @@
1
1
  module Octobat
2
- VERSION = '2.0.22'
2
+ VERSION = '2.0.25'
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.22
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-23 00:00:00.000000000 Z
11
+ date: 2020-12-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -101,12 +101,14 @@ files:
101
101
  - lib/octobat/reporting/report_type.rb
102
102
  - lib/octobat/self_billing_invoice.rb
103
103
  - lib/octobat/singleton_api_resource.rb
104
+ - lib/octobat/subscription.rb
104
105
  - lib/octobat/supplier.rb
105
106
  - lib/octobat/tax_evidence.rb
106
107
  - lib/octobat/tax_evidence_request.rb
107
108
  - lib/octobat/tax_id.rb
108
109
  - lib/octobat/tax_region_setting.rb
109
110
  - lib/octobat/transaction.rb
111
+ - lib/octobat/usage_item.rb
110
112
  - lib/octobat/util.rb
111
113
  - lib/octobat/version.rb
112
114
  - octobat.gemspec