starkinfra 0.4.0 → 0.5.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{brcodepreview/brcodepreview.rb → brcode_preview/brcode_preview.rb} +2 -5
- data/lib/{cardmethod/cardmethod.rb → card_method/card_method.rb} +2 -2
- data/lib/{creditholmes/creditholmes.rb → credit_holmes/credit_holmes.rb} +8 -11
- data/lib/{creditnote/creditnote.rb → credit_note/credit_note.rb} +11 -12
- data/lib/{creditnote → credit_note}/invoice/description.rb +3 -5
- data/lib/{creditnote → credit_note}/invoice/discount.rb +3 -4
- data/lib/{creditnote → credit_note}/invoice/invoice.rb +5 -6
- data/lib/{creditnote → credit_note}/log.rb +9 -10
- data/lib/{creditnote → credit_note}/transfer.rb +4 -5
- data/lib/{creditpreview/creditnotepreview.rb → credit_preview/credit_note_preview.rb} +2 -3
- data/lib/{creditpreview/creditpreview.rb → credit_preview/credit_preview.rb} +3 -4
- data/lib/{creditsigner/creditsigner.rb → credit_signer/credit_signer.rb} +3 -6
- data/lib/{dynamicbrcode/dynamicbrcode.rb → dynamic_brcode/dynamic_brcode.rb} +17 -19
- data/lib/error.rb +7 -40
- data/lib/event/attempt.rb +7 -8
- data/lib/event/event.rb +10 -13
- data/lib/{individualdocument/individualdocument.rb → individual_document/individual_document.rb} +7 -8
- data/lib/{individualdocument → individual_document}/log.rb +9 -10
- data/lib/{individualidentity/individualidentity.rb → individual_identity/individual_identity.rb} +7 -8
- data/lib/{individualidentity → individual_identity}/log.rb +9 -10
- data/lib/{issuingbalance/issuingbalance.rb → issuing_balance/issuing_balance.rb} +2 -3
- data/lib/{issuingcard/issuingcard.rb → issuing_card/issuing_card.rb} +9 -10
- data/lib/{issuingcard → issuing_card}/log.rb +9 -10
- data/lib/{issuingdesign/issuingdesign.rb → issuing_design/issuing_design.rb} +5 -6
- data/lib/{issuingembossingkit/issuingembossingkit.rb → issuing_embossing_kit/issuing_embossing_kit.rb} +4 -5
- data/lib/{issuingembossingrequest/issuingembossingrequest.rb → issuing_embossing_request/issuing_embossing_request.rb} +8 -9
- data/lib/{issuingembossingrequest → issuing_embossing_request}/log.rb +9 -10
- data/lib/{issuingholder/issuingholder.rb → issuing_holder/issuing_holder.rb} +9 -10
- data/lib/{issuingholder → issuing_holder}/log.rb +9 -10
- data/lib/{issuinginvoice/issuinginvoice.rb → issuing_invoice/issuing_invoice.rb} +8 -9
- data/lib/{issuinginvoice → issuing_invoice}/log.rb +9 -10
- data/lib/{issuingproduct/issuingproduct.rb → issuing_product/issuing_product.rb} +3 -4
- data/lib/{issuingpurchase/issuingpurchase.rb → issuing_purchase/issuing_purchase.rb} +32 -24
- data/lib/{issuingpurchase → issuing_purchase}/log.rb +9 -10
- data/lib/{issuingrestock/issuingrestock.rb → issuing_restock/issuing_restock.rb} +8 -9
- data/lib/{issuingrestock → issuing_restock}/log.rb +9 -10
- data/lib/{issuingrule/issuingrule.rb → issuing_rule/issuing_rule.rb} +6 -7
- data/lib/{issuingstock/issuingstock.rb → issuing_stock/issuing_stock.rb} +8 -9
- data/lib/{issuingstock → issuing_stock}/log.rb +9 -10
- data/lib/{issuingtransaction/issuingtransaction.rb → issuing_transaction/issuing_transaction.rb} +7 -8
- data/lib/{issuingwithdrawal/issuingwithdrawal.rb → issuing_withdrawal/issuing_withdrawal.rb} +8 -9
- data/lib/{merchantcategory/merchantcategory.rb → merchant_category/merchant_category.rb} +2 -2
- data/lib/{merchantcountry/merchantcountry.rb → merchant_country/merchant_country.rb} +2 -2
- data/lib/{pixbalance/pixbalance.rb → pix_balance/pix_balance.rb} +2 -3
- data/lib/{pixchargeback → pix_chargeback}/log.rb +9 -10
- data/lib/{pixchargeback/pixchargeback.rb → pix_chargeback/pix_chargeback.rb} +8 -9
- data/lib/{pixclaim → pix_claim}/log.rb +9 -10
- data/lib/{pixclaim/pixclaim.rb → pix_claim/pix_claim.rb} +8 -9
- data/lib/{pixdirector/pixdirector.rb → pix_director/pix_director.rb} +2 -2
- data/lib/{pixdomain → pix_domain}/certificate.rb +2 -2
- data/lib/{pixdomain/pixdomain.rb → pix_domain/pix_domain.rb} +3 -3
- data/lib/{pixinfraction → pix_infraction}/log.rb +9 -10
- data/lib/{pixinfraction/pixinfraction.rb → pix_infraction/pix_infraction.rb} +8 -9
- data/lib/{pixkey → pix_key}/log.rb +9 -10
- data/lib/{pixkey/pixkey.rb → pix_key/pix_key.rb} +8 -9
- data/lib/{pixrequest → pix_request}/log.rb +9 -10
- data/lib/{pixrequest/pixrequest.rb → pix_request/pix_request.rb} +9 -10
- data/lib/{pixreversal → pix_reversal}/log.rb +8 -10
- data/lib/{pixreversal/pixreversal.rb → pix_reversal/pix_reversal.rb} +9 -10
- data/lib/{pixstatement/pixstatement.rb → pix_statement/pix_statement.rb} +6 -7
- data/lib/request/request.rb +152 -0
- data/lib/starkinfra.rb +71 -63
- data/lib/{staticbrcode/staticbrcode.rb → static_brcode/static_brcode.rb} +8 -9
- data/lib/utils/parse.rb +23 -42
- data/lib/utils/rest.rb +211 -110
- data/lib/webhook/webhook.rb +2 -3
- metadata +70 -85
- data/lib/key.rb +0 -33
- data/lib/user/organization.rb +0 -54
- data/lib/user/project.rb +0 -37
- data/lib/user/user.rb +0 -20
- data/lib/utils/api.rb +0 -89
- data/lib/utils/bacenid.rb +0 -19
- data/lib/utils/cache.rb +0 -10
- data/lib/utils/case.rb +0 -21
- data/lib/utils/checks.rb +0 -100
- data/lib/utils/endtoendid.rb +0 -11
- data/lib/utils/environment.rb +0 -14
- data/lib/utils/request.rb +0 -79
- data/lib/utils/resource.rb +0 -13
- data/lib/utils/returnid.rb +0 -11
- data/lib/utils/sub_resource.rb +0 -27
- data/lib/utils/url.rb +0 -28
data/lib/starkinfra.rb
CHANGED
@@ -1,74 +1,82 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative('
|
4
|
-
require_relative('
|
5
|
-
require_relative('
|
6
|
-
require_relative('
|
7
|
-
require_relative('
|
8
|
-
require_relative('
|
9
|
-
require_relative('
|
10
|
-
require_relative('
|
11
|
-
require_relative('
|
12
|
-
require_relative('
|
13
|
-
require_relative('
|
14
|
-
require_relative('
|
15
|
-
require_relative('
|
16
|
-
require_relative('
|
17
|
-
require_relative('
|
18
|
-
require_relative('
|
19
|
-
require_relative('
|
20
|
-
require_relative('
|
21
|
-
require_relative('
|
22
|
-
require_relative('
|
23
|
-
require_relative('
|
24
|
-
require_relative('
|
25
|
-
require_relative('
|
26
|
-
require_relative('
|
27
|
-
require_relative('
|
28
|
-
require_relative('
|
29
|
-
require_relative('
|
30
|
-
require_relative('
|
31
|
-
require_relative('
|
32
|
-
require_relative('
|
33
|
-
require_relative('
|
34
|
-
require_relative('
|
35
|
-
require_relative('
|
36
|
-
require_relative('
|
37
|
-
require_relative('
|
38
|
-
require_relative('
|
39
|
-
require_relative('
|
40
|
-
require_relative('
|
41
|
-
require_relative('
|
42
|
-
require_relative('
|
43
|
-
require_relative('
|
44
|
-
require_relative('
|
45
|
-
require_relative('
|
46
|
-
require_relative('
|
47
|
-
require_relative('
|
48
|
-
require_relative('
|
49
|
-
require_relative('
|
50
|
-
require_relative('
|
51
|
-
require_relative('
|
52
|
-
require_relative('
|
53
|
-
require_relative('
|
54
|
-
require_relative('
|
55
|
-
require_relative('
|
56
|
-
require_relative('
|
57
|
-
require_relative('
|
58
|
-
require_relative('
|
59
|
-
require_relative('
|
60
|
-
require_relative('pixreversal/log')
|
61
|
-
require_relative('pixstatement/pixstatement')
|
62
|
-
require_relative('staticbrcode/staticbrcode')
|
3
|
+
require_relative('brcode_preview/brcode_preview')
|
4
|
+
require_relative('card_method/card_method')
|
5
|
+
require_relative('credit_note/invoice/invoice')
|
6
|
+
require_relative('credit_note/invoice/description')
|
7
|
+
require_relative('credit_note/invoice/discount')
|
8
|
+
require_relative('credit_note/credit_note')
|
9
|
+
require_relative('credit_note/log')
|
10
|
+
require_relative('credit_note/transfer')
|
11
|
+
require_relative('credit_holmes/credit_holmes')
|
12
|
+
require_relative('credit_preview/credit_preview')
|
13
|
+
require_relative('credit_preview/credit_note_preview')
|
14
|
+
require_relative('credit_signer/credit_signer')
|
15
|
+
require_relative('dynamic_brcode/dynamic_brcode')
|
16
|
+
require_relative('individual_document/individual_document')
|
17
|
+
require_relative('individual_document/log')
|
18
|
+
require_relative('individual_identity/individual_identity')
|
19
|
+
require_relative('individual_identity/log')
|
20
|
+
require_relative('issuing_balance/issuing_balance')
|
21
|
+
require_relative('issuing_design/issuing_design')
|
22
|
+
require_relative('issuing_embossing_kit/issuing_embossing_kit')
|
23
|
+
require_relative('issuing_embossing_request/issuing_embossing_request')
|
24
|
+
require_relative('issuing_embossing_request/log')
|
25
|
+
require_relative('issuing_stock/issuing_stock')
|
26
|
+
require_relative('issuing_stock/log')
|
27
|
+
require_relative('issuing_restock/issuing_restock')
|
28
|
+
require_relative('issuing_restock/log')
|
29
|
+
require_relative('issuing_card/issuing_card')
|
30
|
+
require_relative('issuing_card/log')
|
31
|
+
require_relative('issuing_holder/issuing_holder')
|
32
|
+
require_relative('issuing_holder/log')
|
33
|
+
require_relative('issuing_invoice/issuing_invoice')
|
34
|
+
require_relative('issuing_invoice/log')
|
35
|
+
require_relative('issuing_product/issuing_product')
|
36
|
+
require_relative('issuing_purchase/issuing_purchase')
|
37
|
+
require_relative('issuing_purchase/log')
|
38
|
+
require_relative('issuing_rule/issuing_rule')
|
39
|
+
require_relative('issuing_transaction/issuing_transaction')
|
40
|
+
require_relative('issuing_withdrawal/issuing_withdrawal')
|
41
|
+
require_relative('merchant_category/merchant_category')
|
42
|
+
require_relative('merchant_country/merchant_country')
|
43
|
+
require_relative('pix_balance/pix_balance')
|
44
|
+
require_relative('pix_chargeback/pix_chargeback')
|
45
|
+
require_relative('pix_chargeback/log')
|
46
|
+
require_relative('pix_claim/pix_claim')
|
47
|
+
require_relative('pix_claim/log')
|
48
|
+
require_relative('pix_director/pix_director')
|
49
|
+
require_relative('pix_domain/pix_domain')
|
50
|
+
require_relative('pix_infraction/pix_infraction')
|
51
|
+
require_relative('pix_infraction/log')
|
52
|
+
require_relative('pix_key/pix_key')
|
53
|
+
require_relative('pix_key/log')
|
54
|
+
require_relative('pix_request/pix_request')
|
55
|
+
require_relative('pix_request/log')
|
56
|
+
require_relative('pix_reversal/pix_reversal')
|
57
|
+
require_relative('pix_reversal/log')
|
58
|
+
require_relative('pix_statement/pix_statement')
|
59
|
+
require_relative('static_brcode/static_brcode')
|
63
60
|
require_relative('webhook/webhook')
|
64
61
|
require_relative('event/event')
|
65
62
|
require_relative('event/attempt')
|
66
|
-
require_relative('
|
67
|
-
require_relative('utils/returnid')
|
63
|
+
require_relative('request/request')
|
68
64
|
|
69
65
|
# SDK to facilitate Ruby integrations with Stark Infra
|
70
66
|
module StarkInfra
|
67
|
+
|
68
|
+
API_VERSION = 'v2'
|
69
|
+
SDK_VERSION = '0.5.2'
|
70
|
+
HOST = "infra"
|
71
|
+
public_constant :API_VERSION, :SDK_VERSION, :HOST;
|
72
|
+
|
71
73
|
@user = nil
|
72
74
|
@language = 'en-US'
|
73
|
-
|
75
|
+
@timeout = 15
|
76
|
+
class << self; attr_accessor :user, :language, :timeout; end
|
77
|
+
|
78
|
+
Project = StarkCore::Project
|
79
|
+
Organization = StarkCore::Organization
|
80
|
+
Key = StarkCore::Key
|
81
|
+
|
74
82
|
end
|
@@ -1,9 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require('starkcore')
|
3
4
|
require_relative('../utils/rest')
|
4
5
|
require_relative('../utils/parse')
|
5
|
-
require_relative('../utils/checks')
|
6
|
-
require_relative('../utils/resource')
|
7
6
|
|
8
7
|
module StarkInfra
|
9
8
|
# # StaticBrcode object
|
@@ -33,7 +32,7 @@ module StarkInfra
|
|
33
32
|
# - url [string]: url link to the BR Code image. ex: 'https://brcode-h.development.starkinfra.com/static-qrcode/97756273400d42ce9086404fe10ea0d6.png'
|
34
33
|
# - created [DateTime]: creation datetime for the StaticBrcode. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
35
34
|
# - updated [DateTime]: latest update datetime for the StaticBrcode. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
|
36
|
-
class StaticBrcode <
|
35
|
+
class StaticBrcode < StarkCore::Utils::Resource
|
37
36
|
attr_reader :name, :key_id, :city, :amount, :cashier_bank_code, :description, :reconciliation_id, :id, :tags, :uuid, :url, :created, :updated
|
38
37
|
def initialize(
|
39
38
|
name:, key_id:, city:, amount:, cashier_bank_code: nil, description: nil, reconciliation_id: nil, id: nil, tags:nil, uuid: nil, url: nil, created: nil, updated: nil
|
@@ -49,8 +48,8 @@ module StarkInfra
|
|
49
48
|
@tags = tags
|
50
49
|
@uuid = uuid
|
51
50
|
@url = url
|
52
|
-
@created =
|
53
|
-
@updated =
|
51
|
+
@created = StarkCore::Utils::Checks.check_datetime(created)
|
52
|
+
@updated = StarkCore::Utils::Checks.check_datetime(updated)
|
54
53
|
end
|
55
54
|
|
56
55
|
# # Create StaticBrcodes
|
@@ -100,8 +99,8 @@ module StarkInfra
|
|
100
99
|
# ## Return:
|
101
100
|
# - generator of StaticBrcode objects with updated attributes
|
102
101
|
def self.query(limit: nil, after: nil, before: nil, uuids: nil, tags: nil, user: nil)
|
103
|
-
after =
|
104
|
-
before =
|
102
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
103
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
105
104
|
StarkInfra::Utils::Rest.get_stream(
|
106
105
|
limit: limit,
|
107
106
|
after: after,
|
@@ -130,8 +129,8 @@ module StarkInfra
|
|
130
129
|
# - list of StaticBrcode objects with updated attributes
|
131
130
|
# - cursor to retrieve the next page of StaticBrcode objects
|
132
131
|
def self.page(cursor: nil, limit: nil, after: nil, before: nil, tags: nil, uuids: nil, user: nil)
|
133
|
-
after =
|
134
|
-
before =
|
132
|
+
after = StarkCore::Utils::Checks.check_date(after)
|
133
|
+
before = StarkCore::Utils::Checks.check_date(before)
|
135
134
|
StarkInfra::Utils::Rest.get_page(
|
136
135
|
cursor: cursor,
|
137
136
|
limit: limit,
|
data/lib/utils/parse.rb
CHANGED
@@ -1,53 +1,34 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require('json')
|
4
|
-
require('starkbank-ecdsa')
|
5
|
-
require_relative('api')
|
6
|
-
require_relative('cache')
|
7
|
-
require_relative('request')
|
8
|
-
require_relative('../error')
|
1
|
+
require('starkcore')
|
9
2
|
|
10
3
|
module StarkInfra
|
11
4
|
module Utils
|
12
5
|
module Parse
|
13
6
|
def self.parse_and_verify(content:, signature:, user: nil, resource:, key: nil)
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
7
|
+
return StarkCore::Utils::Parse.parse_and_verify(
|
8
|
+
content: content,
|
9
|
+
signature: signature,
|
10
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
11
|
+
api_version: StarkInfra::API_VERSION,
|
12
|
+
host: StarkInfra::HOST,
|
13
|
+
resource: resource,
|
14
|
+
user: user ? user : StarkInfra.user,
|
15
|
+
language: StarkInfra.language,
|
16
|
+
timeout: StarkInfra.timeout,
|
17
|
+
key: key
|
18
|
+
)
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.verify(content:, signature:, user: nil)
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
if verify_signature(content: content, signature: signature, user: user, refresh: true)
|
33
|
-
return content
|
34
|
-
end
|
35
|
-
|
36
|
-
raise(StarkInfra::Error::InvalidSignatureError, 'The provided signature and content do not match the Stark Infra public key')
|
37
|
-
end
|
38
|
-
|
39
|
-
def self.verify_signature(content:, signature:, user:, refresh: false)
|
40
|
-
public_key = StarkInfra::Utils::Cache.starkinfra_public_key
|
41
|
-
if public_key.nil? || refresh
|
42
|
-
pem = get_public_key_pem(user)
|
43
|
-
public_key = EllipticCurve::PublicKey.fromPem(pem)
|
44
|
-
StarkInfra::Utils::Cache.starkinfra_public_key = public_key
|
45
|
-
end
|
46
|
-
EllipticCurve::Ecdsa.verify(content, signature, public_key)
|
47
|
-
end
|
48
|
-
|
49
|
-
def self.get_public_key_pem(user)
|
50
|
-
StarkInfra::Utils::Request.fetch(method: 'GET', path: 'public-key', query: { limit: 1 }, user: user).json['publicKeys'][0]['content']
|
22
|
+
return StarkCore::Utils::Parse.verify(
|
23
|
+
content: content,
|
24
|
+
signature: signature,
|
25
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
26
|
+
api_version: StarkInfra::API_VERSION,
|
27
|
+
host: StarkInfra::HOST,
|
28
|
+
user: user ? user : StarkInfra.user,
|
29
|
+
language: StarkInfra.language,
|
30
|
+
timeout: StarkInfra.timeout
|
31
|
+
)
|
51
32
|
end
|
52
33
|
end
|
53
34
|
end
|
data/lib/utils/rest.rb
CHANGED
@@ -1,136 +1,237 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
require_relative('api')
|
3
|
+
require('starkcore')
|
5
4
|
|
6
5
|
module StarkInfra
|
7
6
|
module Utils
|
8
7
|
module Rest
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
8
|
+
|
9
|
+
def self.get_page(resource_name:, resource_maker:, user:, **query)
|
10
|
+
return StarkCore::Utils::Rest.get_page(
|
11
|
+
resource_name: resource_name,
|
12
|
+
resource_maker: resource_maker,
|
13
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
14
|
+
host: StarkInfra::HOST,
|
15
|
+
api_version: StarkInfra::API_VERSION,
|
16
|
+
user: user ? user : StarkInfra.user,
|
17
|
+
language: StarkInfra.language,
|
18
|
+
timeout: StarkInfra.timeout,
|
19
|
+
**query
|
20
|
+
)
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.get_stream(resource_name:, resource_maker:, user
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
entities = json[StarkInfra::Utils::API.last_name_plural(resource_name)]
|
36
|
-
|
37
|
-
entities.each do |entity|
|
38
|
-
enum << StarkInfra::Utils::API.from_api_json(resource_maker, entity)
|
39
|
-
end
|
40
|
-
|
41
|
-
unless limit.nil?
|
42
|
-
limit -= 100
|
43
|
-
query[:limit] = [limit, 100].min
|
44
|
-
end
|
45
|
-
|
46
|
-
cursor = json['cursor']
|
47
|
-
query['cursor'] = cursor
|
48
|
-
break if cursor.nil? || cursor.empty? || (!limit.nil? && limit <= 0)
|
49
|
-
end
|
50
|
-
end
|
23
|
+
def self.get_stream(resource_name:, resource_maker:, user:, **query)
|
24
|
+
return StarkCore::Utils::Rest.get_stream(
|
25
|
+
resource_name: resource_name,
|
26
|
+
resource_maker: resource_maker,
|
27
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
28
|
+
host: StarkInfra::HOST,
|
29
|
+
api_version: StarkInfra::API_VERSION,
|
30
|
+
user: user ? user : StarkInfra.user,
|
31
|
+
language: StarkInfra.language,
|
32
|
+
timeout: StarkInfra.timeout,
|
33
|
+
**query
|
34
|
+
)
|
51
35
|
end
|
52
36
|
|
53
|
-
def self.get_id(resource_name:, resource_maker:, id:,
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
37
|
+
def self.get_id(resource_name:, resource_maker:, user:, id:, **query)
|
38
|
+
return StarkCore::Utils::Rest.get_id(
|
39
|
+
resource_name: resource_name,
|
40
|
+
resource_maker: resource_maker,
|
41
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
42
|
+
host: StarkInfra::HOST,
|
43
|
+
api_version: StarkInfra::API_VERSION,
|
44
|
+
user: user ? user : StarkInfra.user,
|
45
|
+
language: StarkInfra.language,
|
46
|
+
timeout: StarkInfra.timeout,
|
47
|
+
id: id,
|
48
|
+
**query
|
49
|
+
)
|
62
50
|
end
|
63
51
|
|
64
|
-
def self.get_content(resource_name:, sub_resource_name:, id:,
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
52
|
+
def self.get_content(resource_name:, resource_maker:, user:, sub_resource_name:, id:, **query)
|
53
|
+
return StarkCore::Utils::Rest.get_content(
|
54
|
+
resource_name: resource_name,
|
55
|
+
resource_maker: resource_maker,
|
56
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
57
|
+
host: StarkInfra::HOST,
|
58
|
+
api_version: StarkInfra::API_VERSION,
|
59
|
+
user: user ? user : StarkInfra.user,
|
60
|
+
language: StarkInfra.language,
|
61
|
+
timeout: StarkInfra.timeout,
|
62
|
+
sub_resource_name: sub_resource_name,
|
63
|
+
id: id,
|
64
|
+
**query
|
65
|
+
)
|
70
66
|
end
|
71
67
|
|
72
|
-
def self.
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
68
|
+
def self.get_sub_resource(resource_name:, sub_resource_maker:, sub_resource_name:, user:, id:, **query)
|
69
|
+
return StarkCore::Utils::Rest.get_sub_resource(
|
70
|
+
resource_name: resource_name,
|
71
|
+
sub_resource_maker: sub_resource_maker,
|
72
|
+
sub_resource_name: sub_resource_name,
|
73
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
74
|
+
host: StarkInfra::HOST,
|
75
|
+
api_version: StarkInfra::API_VERSION,
|
76
|
+
user: user ? user : StarkInfra.user,
|
77
|
+
language: StarkInfra.language,
|
78
|
+
timeout: StarkInfra.timeout,
|
79
|
+
id: id,
|
80
|
+
**query
|
81
|
+
)
|
82
|
+
end
|
83
|
+
|
84
|
+
def self.get_sub_resources(resource_name:, sub_resource_maker:, sub_resource_name:, user:, id:, **query)
|
85
|
+
return StarkCore::Utils::Rest.get_sub_resource(
|
86
|
+
resource_name: resource_name,
|
87
|
+
sub_resource_maker: sub_resource_maker,
|
88
|
+
sub_resource_name: sub_resource_name,
|
89
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
90
|
+
host: StarkInfra::HOST,
|
91
|
+
api_version: StarkInfra::API_VERSION,
|
92
|
+
user: user ? user : StarkInfra.user,
|
93
|
+
language: StarkInfra.language,
|
94
|
+
timeout: StarkInfra.timeout,
|
95
|
+
id: id,
|
96
|
+
**query
|
97
|
+
)
|
91
98
|
end
|
92
99
|
|
93
|
-
def self.
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
100
|
+
def self.post(resource_name:, resource_maker:, user:, entities:, **query)
|
101
|
+
return StarkCore::Utils::Rest.post(
|
102
|
+
resource_name: resource_name,
|
103
|
+
resource_maker: resource_maker,
|
104
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
105
|
+
host: StarkInfra::HOST,
|
106
|
+
api_version: StarkInfra::API_VERSION,
|
107
|
+
user: user ? user : StarkInfra.user,
|
108
|
+
language: StarkInfra.language,
|
109
|
+
timeout: StarkInfra.timeout,
|
110
|
+
entities: entities,
|
111
|
+
**query
|
112
|
+
)
|
102
113
|
end
|
103
114
|
|
104
|
-
def self.
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
115
|
+
def self.post_single(resource_name:, resource_maker:, user:, entity:)
|
116
|
+
return StarkCore::Utils::Rest.post_single(
|
117
|
+
resource_name: resource_name,
|
118
|
+
resource_maker: resource_maker,
|
119
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
120
|
+
host: StarkInfra::HOST,
|
121
|
+
api_version: StarkInfra::API_VERSION,
|
122
|
+
user: user ? user : StarkInfra.user,
|
123
|
+
language: StarkInfra.language,
|
124
|
+
timeout: StarkInfra.timeout,
|
125
|
+
entity: entity
|
126
|
+
)
|
112
127
|
end
|
113
128
|
|
114
|
-
def self.
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
129
|
+
def self.delete_id(resource_name:, resource_maker:, user:, id:)
|
130
|
+
return StarkCore::Utils::Rest.delete_id(
|
131
|
+
resource_name: resource_name,
|
132
|
+
resource_maker: resource_maker,
|
133
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
134
|
+
host: StarkInfra::HOST,
|
135
|
+
api_version: StarkInfra::API_VERSION,
|
136
|
+
user: user ? user : StarkInfra.user,
|
137
|
+
language: StarkInfra.language,
|
138
|
+
timeout: StarkInfra.timeout,
|
139
|
+
id: id
|
140
|
+
)
|
123
141
|
end
|
124
142
|
|
125
|
-
def self.
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
143
|
+
def self.patch_id(resource_name:, resource_maker:, user:, id:, **payload)
|
144
|
+
return StarkCore::Utils::Rest.patch_id(
|
145
|
+
resource_name: resource_name,
|
146
|
+
resource_maker: resource_maker,
|
147
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
148
|
+
host: StarkInfra::HOST,
|
149
|
+
api_version: StarkInfra::API_VERSION,
|
150
|
+
user: user ? user : StarkInfra.user,
|
151
|
+
language: StarkInfra.language,
|
152
|
+
timeout: StarkInfra.timeout,
|
153
|
+
id: id,
|
154
|
+
**payload
|
155
|
+
)
|
156
|
+
end
|
157
|
+
|
158
|
+
def self.get_raw(path:, prefix: nil, raiseException: nil, user: nil, query: nil)
|
159
|
+
return StarkCore::Utils::Rest.get_raw(
|
160
|
+
host: StarkInfra::HOST,
|
161
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
162
|
+
user: user ? user : StarkInfra.user,
|
163
|
+
path: path,
|
164
|
+
api_version: StarkInfra::API_VERSION,
|
165
|
+
language: StarkInfra.language,
|
166
|
+
timeout: StarkInfra.timeout,
|
167
|
+
prefix: prefix,
|
168
|
+
raiseException: raiseException,
|
130
169
|
query: query
|
131
|
-
)
|
132
|
-
|
133
|
-
|
170
|
+
)
|
171
|
+
end
|
172
|
+
|
173
|
+
def self.post_raw(path:, payload:, query: nil, prefix: nil, raiseException: nil, user:)
|
174
|
+
|
175
|
+
return StarkCore::Utils::Rest.post_raw(
|
176
|
+
host: StarkInfra::HOST,
|
177
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
178
|
+
user: user ? user : StarkInfra.user,
|
179
|
+
path: path,
|
180
|
+
payload: payload,
|
181
|
+
api_version: StarkInfra::API_VERSION,
|
182
|
+
language: StarkInfra.language,
|
183
|
+
timeout: StarkInfra.timeout,
|
184
|
+
query: query,
|
185
|
+
prefix: prefix,
|
186
|
+
raiseException: raiseException
|
187
|
+
)
|
188
|
+
end
|
189
|
+
|
190
|
+
def self.patch_raw(path:, payload:, query: nil, prefix: nil, raiseException: nil, user: nil)
|
191
|
+
return StarkCore::Utils::Rest.patch_raw(
|
192
|
+
host: StarkInfra::HOST,
|
193
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
194
|
+
user: user ? user : StarkInfra.user,
|
195
|
+
path: path,
|
196
|
+
payload: payload,
|
197
|
+
api_version: StarkInfra::API_VERSION,
|
198
|
+
language: StarkInfra.language,
|
199
|
+
timeout: StarkInfra.timeout,
|
200
|
+
query: query,
|
201
|
+
prefix: prefix,
|
202
|
+
raiseException: raiseException
|
203
|
+
)
|
204
|
+
end
|
205
|
+
|
206
|
+
def self.put_raw(path:, payload:, query: nil, prefix: nil, raiseException: nil, user: nil)
|
207
|
+
return StarkCore::Utils::Rest.put_raw(
|
208
|
+
host: StarkInfra::HOST,
|
209
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
210
|
+
user: user ? user : StarkInfra.user,
|
211
|
+
path: path,
|
212
|
+
payload: payload,
|
213
|
+
api_version: StarkInfra::API_VERSION,
|
214
|
+
language: StarkInfra.language,
|
215
|
+
timeout: StarkInfra.timeout,
|
216
|
+
query: query,
|
217
|
+
prefix: prefix,
|
218
|
+
raiseException: raiseException
|
219
|
+
)
|
220
|
+
end
|
221
|
+
|
222
|
+
def self.delete_raw(path:, query: nil, prefix: nil, raiseException: nil, user: nil)
|
223
|
+
return StarkCore::Utils::Rest.delete_raw(
|
224
|
+
host: StarkInfra::HOST,
|
225
|
+
sdk_version: StarkInfra::SDK_VERSION,
|
226
|
+
user: user ? user : StarkInfra.user,
|
227
|
+
path: path,
|
228
|
+
api_version: StarkInfra::API_VERSION,
|
229
|
+
language: StarkInfra.language,
|
230
|
+
timeout: StarkInfra.timeout,
|
231
|
+
query: query,
|
232
|
+
prefix: prefix,
|
233
|
+
raiseException: raiseException
|
234
|
+
)
|
134
235
|
end
|
135
236
|
end
|
136
237
|
end
|
data/lib/webhook/webhook.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require('starkcore')
|
3
4
|
require_relative('../utils/rest')
|
4
|
-
require_relative('../utils/checks')
|
5
|
-
require_relative('../utils/resource')
|
6
5
|
|
7
6
|
module StarkInfra
|
8
7
|
# # Webhook object
|
@@ -16,7 +15,7 @@ module StarkInfra
|
|
16
15
|
#
|
17
16
|
# ## Attributes (return-only):
|
18
17
|
# - id [string]: unique id returned when the webhook is created. ex: '5656565656565656'
|
19
|
-
class Webhook <
|
18
|
+
class Webhook < StarkCore::Utils::Resource
|
20
19
|
attr_reader :url, :subscriptions, :id
|
21
20
|
def initialize(url:, subscriptions:, id: nil)
|
22
21
|
super(id)
|