pedrofurtado / qrcode_pix_ruby

Ruby gem for QRCode generation of Pix (Pagamento Instantâneo Brasileiro - Banco Central do Brasil)
https://rubygems.org/gems/qrcode_pix_ruby
MIT License
43 stars 7 forks source link

Attributes on instance #7

Closed marciojg closed 3 years ago

marciojg commented 3 years ago

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.

codecov-commenter commented 3 years ago

Codecov Report

Merging #7 (4820cb9) into master (80de7c6) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            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.

pedrofurtado commented 3 years ago

@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:

pedrofurtado commented 3 years ago

@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) 😢

marciojg commented 3 years ago

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. 👍

pedrofurtado commented 3 years ago

@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 ✅