starkbank 2.12.0 → 2.13.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd9a69de2b18932531236001ae087424da0ee70dbe7bbcef98247700e2708802
4
- data.tar.gz: bdc7087b33f13f85f9f1cc0d5bb257f3ececfbe128efc13bdd749d90062a8c54
3
+ metadata.gz: 67f10a9398cc6eeb3b8cafe747a1fb3ce21dfab6bf316dd85cbca71394cb5443
4
+ data.tar.gz: e5f917774479128c4e1d8120d5cefeed03dbff224e70090c849bc911fd759d05
5
5
  SHA512:
6
- metadata.gz: d1efd923d66ad145799e10bdf3c8866a30c9762334cc2c017ca6252c0440200a2beca5b9458b29eedd2487edb12f99f3424fc6bcc7c958e2293dbe9e5b34bdeb
7
- data.tar.gz: e783927a5d21f7d417b90d01442143de64cef5808db8e7cebae36e15700e546897b84dc429a1e297a38eb4dcc4ab9087f839580d858ba96454fe2d61f4a7ccae
6
+ metadata.gz: 0fab179a722aeea47d6635217805b68d8fbdf6ceb58b44f1d2dcb3a4aa7c7b76e71657bcc1585ba78c36335dd6dfd52c723ffda41373c896525960d53ac0887c
7
+ data.tar.gz: 1395aca4a6a05c445b8dcc43b87d69a2e60fabd88ee76f783351325137986d845270172c02946a57af07a078ab9cdc0419995f51215f0abfc5dd6cbc3f47b09c
@@ -21,6 +21,8 @@ module StarkBank
21
21
  # ## Parameters (optional):
22
22
  # - expiration [integer, default 3600 (1 hour)]: time interval in seconds between due date and expiration date. ex 123456789
23
23
  # - tags [list of strings, default []]: list of strings for tagging, these will be passed to the respective DynamicBrcode resource when paid
24
+ # - display_description [string, default nil]: optional description to be shown in the receiver bank interface. ex: "Payment for service #1234"
25
+ # - rules [list of Rules, default nil]: list of dynamic brcode rules to be applied to this brcode. ex: [StarkBank::DynamicBrcode::Rule.new(key: "allowedTaxIds", value: ["012.345.678-90"])]
24
26
  #
25
27
  # ## Attributes (return-only):
26
28
  # - id [string]: id returned on creation, this is the BR code. ex: "00020126360014br.gov.bcb.pix0114+552840092118152040000530398654040.095802BR5915Jamie Lannister6009Sao Paulo620705038566304FC6C"
@@ -31,7 +33,7 @@ module StarkBank
31
33
  class DynamicBrcode < StarkCore::Utils::Resource
32
34
  attr_reader :amount, :expiration, :tags, :id, :uuid, :picture_url, :updated, :created
33
35
  def initialize(
34
- amount:, expiration: nil, tags: nil, id: nil, uuid: nil, picture_url: nil, updated: nil, created: nil
36
+ amount:, expiration: nil, tags: nil, id: nil, uuid: nil, picture_url: nil, display_description: nil, rules: nil, updated: nil, created: nil
35
37
  )
36
38
  super(id)
37
39
  @amount = amount
@@ -39,6 +41,8 @@ module StarkBank
39
41
  @tags = tags
40
42
  @uuid = uuid
41
43
  @picture_url = picture_url
44
+ @display_description = display_description
45
+ @rules = StarkBank::DynamicBrcode::Rule.parse_rules(rules)
42
46
  @created = StarkCore::Utils::Checks.check_datetime(created)
43
47
  @updated = StarkCore::Utils::Checks.check_datetime(updated)
44
48
  end
@@ -145,6 +149,8 @@ module StarkBank
145
149
  tags: json['tags'],
146
150
  uuid: json['uuid'],
147
151
  picture_url: json['picture_url'],
152
+ display_description: json['display_description'],
153
+ rules: json['rules'],
148
154
  created: json['created'],
149
155
  updated: json['updated']
150
156
  )
@@ -0,0 +1,46 @@
1
+ require_relative('../utils/rest')
2
+
3
+ module StarkBank
4
+ class DynamicBrcode
5
+ # # DynamicBrcode::Rule object
6
+ #
7
+ # The DynamicBrcode.Rule object modifies the behavior of DynamicBrcode objects when passed as an argument upon their creation.
8
+ #
9
+ # ## Parameters (required):
10
+ # - key [string]: Rule to be customized, describes what DynamicBrcode behavior will be altered. ex: "allowedTaxIds"
11
+ # - value [list of strings]: Value of the rule. ex: ["012.345.678-90", "45.059.493/0001-73"]
12
+ class Rule < StarkCore::Utils::SubResource
13
+ attr_reader :key, :value
14
+ def initialize(key:, value:)
15
+ @key = key
16
+ @value = value
17
+ end
18
+
19
+ def self.parse_rules(rules)
20
+ resource_maker = StarkBank::DynamicBrcode::Rule.resource[:resource_maker]
21
+ return rules if rules.nil?
22
+
23
+ parsed_rules = []
24
+ rules.each do |rule|
25
+ unless rule.is_a? Rule
26
+ rule = StarkCore::Utils::API.from_api_json(resource_maker, rule)
27
+ end
28
+ parsed_rules << rule
29
+ end
30
+ return parsed_rules
31
+ end
32
+
33
+ def self.resource
34
+ {
35
+ resource_name: 'Rule',
36
+ resource_maker: proc { |json|
37
+ Rule.new(
38
+ key: json['key'],
39
+ value: json['value']
40
+ )
41
+ }
42
+ }
43
+ end
44
+ end
45
+ end
46
+ end
data/lib/starkbank.rb CHANGED
@@ -9,6 +9,7 @@ require_relative('invoice/rule')
9
9
  require_relative('invoice/payment')
10
10
  require_relative('dict_key/dict_key')
11
11
  require_relative('dynamic_brcode/dynamic_brcode')
12
+ require_relative('dynamic_brcode/rule')
12
13
  require_relative('deposit/deposit')
13
14
  require_relative('deposit/log')
14
15
  require_relative('card_method/cardmethod')
@@ -60,7 +61,7 @@ require_relative('request/request')
60
61
  module StarkBank
61
62
 
62
63
  API_VERSION = 'v2'
63
- SDK_VERSION = '2.12.0'
64
+ SDK_VERSION = '2.13.0'
64
65
  HOST = "bank"
65
66
  public_constant :API_VERSION, :SDK_VERSION, :HOST;
66
67
 
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: starkbank
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.12.0
4
+ version: 2.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - starkbank
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-07-20 00:00:00.000000000 Z
10
+ date: 2025-03-18 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: starkcore
@@ -66,8 +65,6 @@ dependencies:
66
65
  - - "~>"
67
66
  - !ruby/object:Gem::Version
68
67
  version: '0.81'
69
- description:
70
- email:
71
68
  executables: []
72
69
  extensions: []
73
70
  extra_rdoc_files: []
@@ -101,6 +98,7 @@ files:
101
98
  - lib/deposit/log.rb
102
99
  - lib/dict_key/dict_key.rb
103
100
  - lib/dynamic_brcode/dynamic_brcode.rb
101
+ - lib/dynamic_brcode/rule.rb
104
102
  - lib/error.rb
105
103
  - lib/event/attempt.rb
106
104
  - lib/event/event.rb
@@ -135,7 +133,6 @@ homepage: https://github.com/starkbank/sdk-ruby
135
133
  licenses:
136
134
  - MIT
137
135
  metadata: {}
138
- post_install_message:
139
136
  rdoc_options: []
140
137
  require_paths:
141
138
  - lib
@@ -150,8 +147,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
150
147
  - !ruby/object:Gem::Version
151
148
  version: '0'
152
149
  requirements: []
153
- rubygems_version: 3.0.3.1
154
- signing_key:
150
+ rubygems_version: 3.6.2
155
151
  specification_version: 4
156
152
  summary: SDK to facilitate Ruby integrations with Stark Bank
157
153
  test_files: []