octobat 2.0.25 → 2.0.26
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -2
- data/History.txt +5 -0
- data/VERSION +1 -1
- data/lib/octobat.rb +7 -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/util.rb +3 -0
- data/lib/octobat/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 330a8b81687cd079b059ebd5b768f80152d7f93ce97f255637b8fc1bd45d681f
|
4
|
+
data.tar.gz: 3647619a56554df275ec31fc6c14aeed477b260d2bb00608ee23418cd0ac78e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96a550fd8e9c24cfe1446ebfe3ebe3ae5a87b4d1adcac7c7575e3e68b7f3cf370a705d00e8f60d835c0108c8f7b397ffdfd2c45c0608be1285a18614d893068d
|
7
|
+
data.tar.gz: 3c08c868d74a6f9bd4b1fb0314def0745d8d5510054fb2f453e86831124db8992111af23a34b5db574c79041ffbf7c3b914a18718610bbd5e85968eafc58d2d9
|
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.26)
|
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.
|
17
|
+
mime-types-data (3.2021.0225)
|
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
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.0.
|
1
|
+
2.0.26
|
data/lib/octobat.rb
CHANGED
@@ -60,7 +60,14 @@ require 'octobat/usage_item'
|
|
60
60
|
|
61
61
|
require 'octobat/file_upload'
|
62
62
|
require 'octobat/file_link'
|
63
|
+
|
63
64
|
require 'octobat/beanie/session'
|
65
|
+
|
66
|
+
require 'octobat/plaza/account'
|
67
|
+
require 'octobat/plaza/capability'
|
68
|
+
require 'octobat/plaza/country_spec'
|
69
|
+
|
70
|
+
|
64
71
|
require 'octobat/reporting/report_type'
|
65
72
|
require 'octobat/reporting/report_run'
|
66
73
|
|
@@ -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
|
data/lib/octobat/util.rb
CHANGED
@@ -75,6 +75,9 @@ module Octobat
|
|
75
75
|
'file' => FileUpload,
|
76
76
|
'file_link' => FileLink,
|
77
77
|
'beanie.session' => Beanie::Session,
|
78
|
+
'plaza.account' => Plaza::Account,
|
79
|
+
'plaza.capability' => Plaza::Capability,
|
80
|
+
'plaza.country_spec' => Plaza::CountrySpec,
|
78
81
|
'reporting.report_type' => Reporting::ReportType,
|
79
82
|
'reporting.report_run' => Reporting::ReportRun
|
80
83
|
}
|
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.26
|
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-05-31 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
|