octobat 2.0.23 → 2.0.27
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/History.txt +18 -0
- data/VERSION +1 -1
- data/lib/octobat.rb +9 -0
- data/lib/octobat/invoice.rb +9 -0
- data/lib/octobat/octobat_object.rb +3 -1
- data/lib/octobat/plaza/account.rb +39 -0
- data/lib/octobat/plaza/capability.rb +56 -0
- data/lib/octobat/plaza/country_spec.rb +12 -0
- data/lib/octobat/subscription.rb +13 -0
- data/lib/octobat/usage_item.rb +51 -0
- data/lib/octobat/util.rb +6 -1
- data/lib/octobat/version.rb +1 -1
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bca99a3a300bda82d8c7a309b0f099a1ee34466dfbe7cee55e93ed345812b48
|
4
|
+
data.tar.gz: 189ae2089b0a474acdba96ecec291bac48c9bdbb8e223368241f5ff1134ee529
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a16248e1a906edeb532862a962b947da225b5d1fa0acff055c38c70a1b22d050242256fdb3cb865738b875f4986d910e961c3ab348812d7c01fb891b96041fd4
|
7
|
+
data.tar.gz: 01e16e4fc91131bb1a13395026d171f5c45cd75d1eae4e7808e55da03adbeb93a349a64e7ac9ee3f7eac84b57521477ffbdcf826c38ae1ed6803ad0937629649
|
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.27)
|
5
5
|
rest-client (>= 1.4, < 4.0)
|
6
6
|
|
7
7
|
GEM
|
@@ -10,11 +10,11 @@ GEM
|
|
10
10
|
domain_name (0.5.20190701)
|
11
11
|
unf (>= 0.0.5, < 1.0.0)
|
12
12
|
http-accept (1.7.0)
|
13
|
-
http-cookie (1.0.
|
13
|
+
http-cookie (1.0.4)
|
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.
|
17
|
+
mime-types-data (3.2021.0704)
|
18
18
|
netrc (0.11.0)
|
19
19
|
rest-client (2.1.0)
|
20
20
|
http-accept (>= 1.7.0, < 2.0)
|
data/History.txt
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
=== 2.0.27 2021-05-31
|
2
|
+
* 1 minor update:
|
3
|
+
* URI.escape is deprecated
|
4
|
+
|
5
|
+
=== 2.0.26 2021-05-31
|
6
|
+
* 2 major enhancements:
|
7
|
+
* Add support for Octobat Plaza endpoints
|
8
|
+
* Add persistence of the octobat_account header through requests
|
9
|
+
|
10
|
+
=== 2.0.25 2020-12-24
|
11
|
+
* 2 major enhancements:
|
12
|
+
* Add support for Subscription object
|
13
|
+
* Add support for UsageItem object
|
14
|
+
|
15
|
+
=== 2.0.24 2020-12-15
|
16
|
+
* 1 minor enhancements:
|
17
|
+
* Add support for Invoice#mark_uncollectible endpoint
|
18
|
+
|
1
19
|
=== 2.0.23 2020-12-03
|
2
20
|
* 1 minor enhancements:
|
3
21
|
* Add support for Invoice#set_payment_terms endpoint
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.27
|
data/lib/octobat.rb
CHANGED
@@ -55,10 +55,19 @@ 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'
|
63
|
+
|
61
64
|
require 'octobat/beanie/session'
|
65
|
+
|
66
|
+
require 'octobat/plaza/account'
|
67
|
+
require 'octobat/plaza/capability'
|
68
|
+
require 'octobat/plaza/country_spec'
|
69
|
+
|
70
|
+
|
62
71
|
require 'octobat/reporting/report_type'
|
63
72
|
require 'octobat/reporting/report_run'
|
64
73
|
|
data/lib/octobat/invoice.rb
CHANGED
@@ -43,6 +43,11 @@ module Octobat
|
|
43
43
|
refresh_from(response, api_key)
|
44
44
|
end
|
45
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
|
+
|
46
51
|
|
47
52
|
def cancel(params = {}, opts = {})
|
48
53
|
response, api_key = Octobat.request(:patch, cancel_url, @api_key, params, opts)
|
@@ -78,6 +83,10 @@ module Octobat
|
|
78
83
|
url + '/confirm'
|
79
84
|
end
|
80
85
|
|
86
|
+
def mark_uncollectible_url
|
87
|
+
url + '/mark_uncollectible'
|
88
|
+
end
|
89
|
+
|
81
90
|
def set_payment_terms_url
|
82
91
|
url + '/set_payment_terms'
|
83
92
|
end
|
@@ -24,8 +24,10 @@ module Octobat
|
|
24
24
|
@api_key = opts[:api_key]
|
25
25
|
|
26
26
|
@retrieve_options.merge!(opts.clone).delete(:api_key)
|
27
|
+
|
27
28
|
@headers['Octobat-Version'] = @retrieve_options.delete('Octobat-Version') if @retrieve_options.has_key?('Octobat-Version')
|
28
|
-
|
29
|
+
@headers[:octobat_account] = @retrieve_options.delete(:octobat_account) if @retrieve_options.has_key?(:octobat_account)
|
30
|
+
|
29
31
|
@values = {}
|
30
32
|
# This really belongs in APIResource, but not putting it there allows us
|
31
33
|
# to have a unified inspect method
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Octobat
|
2
|
+
module Plaza
|
3
|
+
class Account < Octobat::APIResource
|
4
|
+
extend Octobat::APIOperations::List
|
5
|
+
include Octobat::APIOperations::Create
|
6
|
+
include Octobat::APIOperations::Update
|
7
|
+
|
8
|
+
def self.url
|
9
|
+
'/plaza/accounts'
|
10
|
+
end
|
11
|
+
|
12
|
+
def activate(params = {}, opts = {})
|
13
|
+
response, api_key = Octobat.request(:patch, activate_url, @api_key, params, opts)
|
14
|
+
refresh_from(response, api_key)
|
15
|
+
end
|
16
|
+
|
17
|
+
def deactivate(params = {}, opts = {})
|
18
|
+
response, api_key = Octobat.request(:patch, deactivate_url, @api_key, params, opts)
|
19
|
+
refresh_from(response, api_key)
|
20
|
+
end
|
21
|
+
|
22
|
+
def list_capabilities(params = {}, opts = {})
|
23
|
+
Capability.list(params.merge({ :account => id }), {api_key: @api_key}.merge(opts))
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
private
|
28
|
+
def activate_url
|
29
|
+
url + '/activate'
|
30
|
+
end
|
31
|
+
|
32
|
+
def deactivate_url
|
33
|
+
url + '/deactivate'
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
module Octobat
|
2
|
+
module Plaza
|
3
|
+
class Capability < Octobat::APIResource
|
4
|
+
extend Octobat::APIOperations::List
|
5
|
+
|
6
|
+
def url
|
7
|
+
!parent_obj.nil? ? parentize_url : super
|
8
|
+
end
|
9
|
+
|
10
|
+
def ask(params = {}, opts = {})
|
11
|
+
response, api_key = Octobat.request(:patch, ask_url, @api_key, params, opts)
|
12
|
+
refresh_from(response, api_key)
|
13
|
+
end
|
14
|
+
|
15
|
+
def save_url
|
16
|
+
if self[:id] == nil && self.class.respond_to?(:create)
|
17
|
+
self.relative_save_url
|
18
|
+
else
|
19
|
+
url
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
def parentize_url
|
25
|
+
if parent_obj.include?(:account)
|
26
|
+
"#{Account.url}/#{CGI.escape(parent_obj[:account])}/capabilities/#{CGI.escape(id)}"
|
27
|
+
else
|
28
|
+
url
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
def relative_save_url
|
35
|
+
if self[:account]
|
36
|
+
"#{Account.url}/#{CGI.escape(self[:account])}/capabilities"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def ask_url
|
41
|
+
"#{parentize_url}/request"
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.url
|
45
|
+
if @parent_resource.include?(:account)
|
46
|
+
"#{Account.url}/#{CGI.escape(@parent_resource[:account])}/capabilities"
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def self.set_parent_resource(filters)
|
51
|
+
@parent_resource = filters.select{|k, v| [:account].include?(k)}
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -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,9 +70,14 @@ 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,
|
78
|
+
'plaza.account' => Plaza::Account,
|
79
|
+
'plaza.capability' => Plaza::Capability,
|
80
|
+
'plaza.country_spec' => Plaza::CountrySpec,
|
76
81
|
'reporting.report_type' => Reporting::ReportType,
|
77
82
|
'reporting.report_run' => Reporting::ReportRun
|
78
83
|
}
|
@@ -122,7 +127,7 @@ module Octobat
|
|
122
127
|
end
|
123
128
|
|
124
129
|
def self.url_encode(key)
|
125
|
-
URI.
|
130
|
+
URI.encode_www_form_component(key.to_s)
|
126
131
|
end
|
127
132
|
|
128
133
|
def self.flatten_params(params, parent_key=nil)
|
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.27
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gaultier Laperche
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -94,6 +94,9 @@ files:
|
|
94
94
|
- lib/octobat/payment_recipient_reference.rb
|
95
95
|
- lib/octobat/payment_source.rb
|
96
96
|
- lib/octobat/payout.rb
|
97
|
+
- lib/octobat/plaza/account.rb
|
98
|
+
- lib/octobat/plaza/capability.rb
|
99
|
+
- lib/octobat/plaza/country_spec.rb
|
97
100
|
- lib/octobat/product.rb
|
98
101
|
- lib/octobat/proforma_invoice.rb
|
99
102
|
- lib/octobat/purchase_item.rb
|
@@ -101,12 +104,14 @@ files:
|
|
101
104
|
- lib/octobat/reporting/report_type.rb
|
102
105
|
- lib/octobat/self_billing_invoice.rb
|
103
106
|
- lib/octobat/singleton_api_resource.rb
|
107
|
+
- lib/octobat/subscription.rb
|
104
108
|
- lib/octobat/supplier.rb
|
105
109
|
- lib/octobat/tax_evidence.rb
|
106
110
|
- lib/octobat/tax_evidence_request.rb
|
107
111
|
- lib/octobat/tax_id.rb
|
108
112
|
- lib/octobat/tax_region_setting.rb
|
109
113
|
- lib/octobat/transaction.rb
|
114
|
+
- lib/octobat/usage_item.rb
|
110
115
|
- lib/octobat/util.rb
|
111
116
|
- lib/octobat/version.rb
|
112
117
|
- octobat.gemspec
|