starkinfra 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/lib/brcodepreview/brcodepreview.rb +12 -8
  3. data/lib/cardmethod/cardmethod.rb +1 -1
  4. data/lib/creditholmes/creditholmes.rb +160 -0
  5. data/lib/creditnote/creditnote.rb +19 -18
  6. data/lib/creditnote/invoice/discount.rb +1 -1
  7. data/lib/creditnote/invoice/invoice.rb +4 -3
  8. data/lib/creditnote/log.rb +16 -17
  9. data/lib/creditpreview/creditpreview.rb +2 -8
  10. data/lib/dynamicbrcode/dynamicbrcode.rb +3 -3
  11. data/lib/event/attempt.rb +1 -1
  12. data/lib/event/event.rb +1 -1
  13. data/lib/individualdocument/individualdocument.rb +165 -0
  14. data/lib/individualdocument/log.rb +125 -0
  15. data/lib/individualidentity/individualidentity.rb +193 -0
  16. data/lib/individualidentity/log.rb +124 -0
  17. data/lib/issuingcard/issuingcard.rb +11 -12
  18. data/lib/issuingcard/log.rb +19 -19
  19. data/lib/issuingdesign/issuingdesign.rb +138 -0
  20. data/lib/issuingembossingkit/issuingembossingkit.rb +121 -0
  21. data/lib/issuingembossingrequest/issuingembossingrequest.rb +210 -0
  22. data/lib/issuingembossingrequest/log.rb +128 -0
  23. data/lib/issuingholder/issuingholder.rb +8 -7
  24. data/lib/issuingholder/log.rb +17 -17
  25. data/lib/issuinginvoice/issuinginvoice.rb +6 -5
  26. data/lib/issuinginvoice/log.rb +16 -16
  27. data/lib/issuingproduct/issuingproduct.rb +2 -2
  28. data/lib/issuingpurchase/issuingpurchase.rb +15 -11
  29. data/lib/issuingpurchase/log.rb +15 -15
  30. data/lib/issuingrestock/issuingrestock.rb +162 -0
  31. data/lib/issuingrestock/log.rb +127 -0
  32. data/lib/issuingstock/issuingstock.rb +138 -0
  33. data/lib/issuingstock/log.rb +130 -0
  34. data/lib/issuingtransaction/issuingtransaction.rb +7 -6
  35. data/lib/issuingwithdrawal/issuingwithdrawal.rb +8 -11
  36. data/lib/pixchargeback/log.rb +12 -12
  37. data/lib/pixclaim/log.rb +13 -13
  38. data/lib/pixclaim/pixclaim.rb +4 -4
  39. data/lib/pixdomain/pixdomain.rb +1 -1
  40. data/lib/pixinfraction/log.rb +18 -18
  41. data/lib/pixinfraction/pixinfraction.rb +3 -3
  42. data/lib/pixkey/log.rb +18 -18
  43. data/lib/pixkey/pixkey.rb +4 -3
  44. data/lib/pixrequest/log.rb +22 -18
  45. data/lib/pixrequest/pixrequest.rb +3 -0
  46. data/lib/pixreversal/log.rb +1 -1
  47. data/lib/pixstatement/pixstatement.rb +1 -1
  48. data/lib/starkinfra.rb +13 -0
  49. data/lib/staticbrcode/staticbrcode.rb +8 -2
  50. data/lib/utils/bacenid.rb +1 -1
  51. data/lib/utils/request.rb +1 -1
  52. data/lib/webhook/webhook.rb +9 -9
  53. metadata +15 -2
data/lib/starkinfra.rb CHANGED
@@ -11,11 +11,24 @@ require_relative('creditnote/invoice/discount')
11
11
  require_relative('creditnote/creditnote')
12
12
  require_relative('creditnote/log')
13
13
  require_relative('creditnote/transfer')
14
+ require_relative('creditholmes/creditholmes')
14
15
  require_relative('creditpreview/creditpreview')
15
16
  require_relative('creditpreview/creditnotepreview')
16
17
  require_relative('creditsigner/creditsigner')
17
18
  require_relative('dynamicbrcode/dynamicbrcode')
19
+ require_relative('individualdocument/individualdocument')
20
+ require_relative('individualdocument/log')
21
+ require_relative('individualidentity/individualidentity')
22
+ require_relative('individualidentity/log')
18
23
  require_relative('issuingbalance/issuingbalance')
24
+ require_relative('issuingdesign/issuingdesign')
25
+ require_relative('issuingembossingkit/issuingembossingkit')
26
+ require_relative('issuingembossingrequest/issuingembossingrequest')
27
+ require_relative('issuingembossingrequest/log')
28
+ require_relative('issuingstock/issuingstock')
29
+ require_relative('issuingstock/log')
30
+ require_relative('issuingrestock/issuingrestock')
31
+ require_relative('issuingrestock/log')
19
32
  require_relative('issuingcard/issuingcard')
20
33
  require_relative('issuingcard/log')
21
34
  require_relative('issuingholder/issuingholder')
@@ -22,7 +22,9 @@ module StarkInfra
22
22
  #
23
23
  # ## Parameters (optional):
24
24
  # - amount [integer, default nil]: positive integer that represents the amount in cents of the resulting Pix transaction. If the amount is zero, the sender can choose any amount in the moment of payment. ex: 1234 (= R$ 12.34)
25
+ # - cashier_bank_code [string, default None]: Cashier's bank code. ex: "20018183".
25
26
  # - reconciliation_id [string, default nil]: id to be used for conciliation of the resulting Pix transaction. This id must have up to 25 alphanumeric digits ex: 'ah27s53agj6493hjds6836v49'
27
+ # - description [string, default None]: optional description to override default description to be shown in the bank statement. ex: "Payment for service #1234"
26
28
  # - tags [list of strings, default nil]: list of strings for tagging. ex: ['travel', 'food']
27
29
  #
28
30
  # ## Attributes (return-only):
@@ -32,9 +34,9 @@ module StarkInfra
32
34
  # - created [DateTime]: creation datetime for the StaticBrcode. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
33
35
  # - updated [DateTime]: latest update datetime for the StaticBrcode. ex: DateTime.new(2020, 3, 10, 10, 30, 0, 0)
34
36
  class StaticBrcode < StarkInfra::Utils::Resource
35
- attr_reader :name, :key_id, :city, :amount, :reconciliation_id, :id, :tags, :uuid, :url, :created, :updated
37
+ attr_reader :name, :key_id, :city, :amount, :cashier_bank_code, :description, :reconciliation_id, :id, :tags, :uuid, :url, :created, :updated
36
38
  def initialize(
37
- name:, key_id:, city:, amount:, reconciliation_id:, id: nil, tags:nil, uuid: nil, url: nil, created: nil, updated: nil
39
+ 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
38
40
  )
39
41
  super(id)
40
42
  @name = name
@@ -42,6 +44,8 @@ module StarkInfra
42
44
  @city = city
43
45
  @amount = amount
44
46
  @reconciliation_id = reconciliation_id
47
+ @cashier_bank_code = cashier_bank_code
48
+ @description = description
45
49
  @tags = tags
46
50
  @uuid = uuid
47
51
  @url = url
@@ -151,6 +155,8 @@ module StarkInfra
151
155
  city: json['city'],
152
156
  amount: json['amount'],
153
157
  reconciliation_id: json['reconciliation_id'],
158
+ cashier_bank_code: json['cashier_bank_code'],
159
+ description: json['description'],
154
160
  tags: json['tags'],
155
161
  uuid: json['uuid'],
156
162
  url: json['url'],
data/lib/utils/bacenid.rb CHANGED
@@ -12,7 +12,7 @@ module StarkInfra
12
12
  11.times do
13
13
  random_string << random_source[rand(random_source.length)]
14
14
  end
15
- bank_code + DateTime.now.strftime('%Y%m%d%H%M') << random_string
15
+ bank_code + DateTime.now.strftime('%Y%m%d%H%M').to_s << random_string
16
16
  end
17
17
  end
18
18
  end
data/lib/utils/request.rb CHANGED
@@ -61,7 +61,7 @@ module StarkInfra
61
61
  req['Access-Time'] = access_time
62
62
  req['Access-Signature'] = signature
63
63
  req['Content-Type'] = 'application/json'
64
- req['User-Agent'] = "Ruby-#{RUBY_VERSION}-SDK-Infra-0.2.0"
64
+ req['User-Agent'] = "Ruby-#{RUBY_VERSION}-SDK-Infra-0.3.0"
65
65
  req['Accept-Language'] = language
66
66
 
67
67
  request = Net::HTTP.start(uri.hostname, use_ssl: true) { |http| http.request(req) }
@@ -5,7 +5,7 @@ require_relative('../utils/checks')
5
5
  require_relative('../utils/resource')
6
6
 
7
7
  module StarkInfra
8
- # # Webhook subscription object
8
+ # # Webhook object
9
9
  #
10
10
  # A Webhook is used to subscribe to notification events on a user-selected endpoint.
11
11
  # Currently available services for subscription are contract, credit-note, signer, issuing-card, issuing-invoice, issuing-purchase, pix-request.in, pix-request.out, pix-reversal.in, pix-reversal.out, pix-claim, pix-key, pix-chargeback, pix-infraction.
@@ -14,7 +14,7 @@ module StarkInfra
14
14
  # - url [string]: URL that will be notified when an event occurs.
15
15
  # - subscriptions [list of strings]: list of any non-empty combination of the available services. ex: ['contract', 'credit-note', 'signer', 'issuing-card', 'issuing-invoice', 'issuing-purchase', 'pix-request.in', 'pix-request.out', 'pix-reversal.in', 'pix-reversal.out', 'pix-claim', 'pix-key', 'pix-chargeback', 'pix-infraction']
16
16
  #
17
- # ## Attributes:
17
+ # ## Attributes (return-only):
18
18
  # - id [string]: unique id returned when the webhook is created. ex: '5656565656565656'
19
19
  class Webhook < StarkInfra::Utils::Resource
20
20
  attr_reader :url, :subscriptions, :id
@@ -24,12 +24,12 @@ module StarkInfra
24
24
  @subscriptions = subscriptions
25
25
  end
26
26
 
27
- # # Create Webhook subscription
27
+ # # Create Webhook
28
28
  #
29
- # Send a single Webhook subscription for creation in the Stark Infra API
29
+ # Send a single Webhook for creation in the Stark Infra API
30
30
  #
31
31
  # ## Parameters (required):
32
- # - webhook [Webhook object]: Webhook subscription to be created to receive Events. ex: Webhook.new()
32
+ # - webhook [Webhook object]: Webhook to be created to receive Events. ex: Webhook.new()
33
33
  #
34
34
  # ## Parameters (optional):
35
35
  # - user [Organization/Project object, default nil]: Organization or Project object. Not necessary if StarkInfra.user was set before function call
@@ -40,9 +40,9 @@ module StarkInfra
40
40
  StarkInfra::Utils::Rest.post_single(entity: webhook, user: user, **resource)
41
41
  end
42
42
 
43
- # # Retrieve a specific Webhook subscription
43
+ # # Retrieve a specific Webhook
44
44
  #
45
- # Receive a single Webhook subscription object previously created in the Stark Infra API by passing its id
45
+ # Receive a single Webhook object previously created in the Stark Infra API by passing its id
46
46
  #
47
47
  # ## Parameters (required):
48
48
  # - id [string]: object unique id. ex: '5656565656565656'
@@ -56,9 +56,9 @@ module StarkInfra
56
56
  StarkInfra::Utils::Rest.get_id(id: id, user: user, **resource)
57
57
  end
58
58
 
59
- # # Retrieve Webhook subscriptions
59
+ # # Retrieve Webhooks
60
60
  #
61
- # Receive a generator of Webhook subscription objects previously created in the Stark Infra API
61
+ # Receive a generator of Webhook objects previously created in the Stark Infra API
62
62
  #
63
63
  # ## Parameters (optional):
64
64
  # - limit [integer, default nil]: maximum number of objects to be retrieved. Unlimited if nil. ex: 35
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starkinfra
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - starkinfra
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-04 00:00:00.000000000 Z
11
+ date: 2023-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: starkbank-ecdsa
@@ -74,6 +74,7 @@ extra_rdoc_files: []
74
74
  files:
75
75
  - lib/brcodepreview/brcodepreview.rb
76
76
  - lib/cardmethod/cardmethod.rb
77
+ - lib/creditholmes/creditholmes.rb
77
78
  - lib/creditnote/creditnote.rb
78
79
  - lib/creditnote/invoice/description.rb
79
80
  - lib/creditnote/invoice/discount.rb
@@ -87,9 +88,17 @@ files:
87
88
  - lib/error.rb
88
89
  - lib/event/attempt.rb
89
90
  - lib/event/event.rb
91
+ - lib/individualdocument/individualdocument.rb
92
+ - lib/individualdocument/log.rb
93
+ - lib/individualidentity/individualidentity.rb
94
+ - lib/individualidentity/log.rb
90
95
  - lib/issuingbalance/issuingbalance.rb
91
96
  - lib/issuingcard/issuingcard.rb
92
97
  - lib/issuingcard/log.rb
98
+ - lib/issuingdesign/issuingdesign.rb
99
+ - lib/issuingembossingkit/issuingembossingkit.rb
100
+ - lib/issuingembossingrequest/issuingembossingrequest.rb
101
+ - lib/issuingembossingrequest/log.rb
93
102
  - lib/issuingholder/issuingholder.rb
94
103
  - lib/issuingholder/log.rb
95
104
  - lib/issuinginvoice/issuinginvoice.rb
@@ -97,7 +106,11 @@ files:
97
106
  - lib/issuingproduct/issuingproduct.rb
98
107
  - lib/issuingpurchase/issuingpurchase.rb
99
108
  - lib/issuingpurchase/log.rb
109
+ - lib/issuingrestock/issuingrestock.rb
110
+ - lib/issuingrestock/log.rb
100
111
  - lib/issuingrule/issuingrule.rb
112
+ - lib/issuingstock/issuingstock.rb
113
+ - lib/issuingstock/log.rb
101
114
  - lib/issuingtransaction/issuingtransaction.rb
102
115
  - lib/issuingwithdrawal/issuingwithdrawal.rb
103
116
  - lib/key.rb