octobat 2.0.24 → 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: 0eeb9f15557ec712c3f01e86bf3406d4124b99bacdf5b386dec2e48f5512dba2
4
- data.tar.gz: a6adc674b919beaf430ec9f5aeb2e6eb1b1d73a055a95d6da267b0290113eea6
3
+ metadata.gz: 8c0554602d9f2b3795ebeb50fc235d1b3fdf1da9a01222153d15a3d2167a35b0
4
+ data.tar.gz: dcf455738a4a19b5ed27028854b1bc344c7ac37efe8ceb63b92239827e54bdcc
5
5
  SHA512:
6
- metadata.gz: '096cd349be93183024bea215bf947728567212b63d715c318254e10e8aadc0d036d99c955524e869143bc5729a836d054dda803a3d172652518a52de71b7001a'
7
- data.tar.gz: e25d72d5ccf99de21481f56ff56eec85dc286486e6bd076c1b10aa5bfba0d402889626f7ec57a895bbbb1251abbfb777e8bc3051b48de283dc45451dd6a411e2
6
+ metadata.gz: 4f760778d1fa6800a687b9eb690688f19809d8fbfaf593648a832defa02e983a0d3da1e7e64b86f6d0e24d9767446cb8cb1cd3f5027215d498a15493cd1d434e
7
+ data.tar.gz: 43e40f5f2152c0d8da4d807cf29738fa296107f4b68eace16f713d94ec79ab67992b850b88d15bcbd42cad3d1962a808044e273d248a49de277a7f66f682ed3d
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- octobat (2.0.24)
4
+ octobat (2.0.25)
5
5
  rest-client (>= 1.4, < 4.0)
6
6
 
7
7
  GEM
@@ -1,3 +1,8 @@
1
+ === 2.0.25 2020-12-24
2
+ * 2 major enhancements:
3
+ * Add support for Subscription object
4
+ * Add support for UsageItem object
5
+
1
6
  === 2.0.24 2020-12-15
2
7
  * 1 minor enhancements:
3
8
  * Add support for Invoice#mark_uncollectible endpoint
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.24
1
+ 2.0.25
@@ -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'
@@ -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
@@ -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.24'
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.24
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-12-15 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