Closed marciojg closed 3 years ago
Merging #7 (4820cb9) into master (80de7c6) will not change coverage. The diff coverage is
100.00%
.
@@ Coverage Diff @@
## master #7 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 143 205 +62
=========================================
+ Hits 143 205 +62
Impacted Files | Coverage Δ | |
---|---|---|
spec/qrcode_pix_ruby_spec.rb | 100.00% <ø> (ø) |
|
lib/qrcode_pix_ruby.rb | 100.00% <100.00%> (ø) |
|
lib/qrcode_pix_ruby/payload.rb | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 80de7c6...4820cb9. Read the comment docs.
@marciojg Asap I will have a look 🤝 🔍
Anyway, after a fast read, I suggest that we can maintain the previous approach, but adding the possibility of this new way, so:
pix = QrcodePixRuby::Payload.new(
pix_key: 'minhachavedopix',
description: 'Pagamento do pedido 123456',
merchant_name: 'Fulano de Tal',
# and so on ...
)
Allow to redefine the value after initialized, before call methods payload
and base64
(current behavior):
pix = QrcodePixRuby::Payload.new(
pix_key: 'minhachavedopix',
description: 'Pagamento do pedido 123456',
merchant_name: 'Fulano de Tal',
# and so on ...
)
pix.pix_key = 'outrachavepix'
pix.merchant_city = 'Cidade que não coloquei antes no initializer'
With the 2 approaches together, I think we will provide the flexibility enough for devs to use in cases of applications worlwide 🤓 And we also avoid a breaking change too.
Thanks for PR, and great idea about run rubocop first (because it's faster) and specs organization! 🍻
@marciojg Do you know anybody that has integration with some financial company, that could provide us some valid URLs to test dynamic PIXs?
It will be awesome to test with some real URLs, because until this moment I've tested just with hypothetical URLs (because real links are provided just by paid services) 😢
Hi @pedrofurtado, the 2 approaches are working 💯
Look this example:
irb(main):006:0> pix = QrcodePixRuby::Payload.new(merchant_city: 'SAO PAULO')
=> #<QrcodePixRuby::Payload:0x00007f979f633c40 @pix_key=nil, @url=nil, @repeatable=nil, @currency=nil, @country_code=nil, @descript...
irb(main):007:0> pix.merchant_city
=> "SAO PAULO"
irb(main):008:0> pix.merchant_city = 'RIO DE JANEIRO'
=> "RIO DE JANEIRO"
irb(main):009:0> pix.merchant_city
=> "RIO DE JANEIRO"
irb(main):010:0> pix2 = QrcodePixRuby::Payload.new
=> #<QrcodePixRuby::Payload:0x00007f979fa76ed8 @pix_key=nil, @url=nil, @repeatable=nil, @currency=nil, @country_code=nil, @descript...
irb(main):011:0> pix2.merchant_city
=> nil
irb(main):012:0' pix2.merchant_city = 'SAO PAULO'
=> "SAO PAULO"
irb(main):013:0* pix2.merchant_city
=> "SAO PAULO"
irb(main):014:0>
Is this that you talking about? Or I am confusing the subjects? 🥴
And about dynamic PIXs. I will search here in my company and tell you. 👍
@marciojg You're right! 😄
Now I read with more focus, and the implementation already defines all attributes, and then it sets the value based on attrs that user passed as parameter in initializer. So, all attributes is set with 2 values: nil
or the value provided by dev.
All green in CI, let's merge ✅
I know that have very changes. But I promise that all is running like before :)
My ambition is provide to users with a better mode of set attributes when they using the gem.
I updated the spec file to permit more velocity on run tests and better visibility to us implementing more tests.
PS. Sorry my "uga uga" English.