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 +4 -4
- data/Gemfile.lock +1 -1
- data/History.txt +5 -0
- data/VERSION +1 -1
- data/lib/octobat.rb +2 -0
- data/lib/octobat/subscription.rb +13 -0
- data/lib/octobat/usage_item.rb +51 -0
- data/lib/octobat/util.rb +2 -0
- data/lib/octobat/version.rb +1 -1
- metadata +4 -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
data/History.txt
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
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'
|
@@ -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,
|
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-12-
|
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
|