demo/config.ru in qrcode_pix_ruby-0.5.0 vs demo/config.ru in qrcode_pix_ruby-0.5.1

- old
+ new

@@ -7,21 +7,14 @@ payload = '' data_uri = '' pix = QrcodePixRuby::Payload.new unless qrcode_data.empty? - pix.pix_key = qrcode_data['pix_key'] if !qrcode_data['pix_key'].nil? && !qrcode_data['pix_key'].empty? - pix.url = qrcode_data['url'] if !qrcode_data['url'].nil? && !qrcode_data['url'].empty? - pix.description = qrcode_data['description'] if !qrcode_data['description'].nil? && !qrcode_data['description'].empty? - pix.merchant_name = qrcode_data['merchant_name'] if !qrcode_data['merchant_name'].nil? && !qrcode_data['merchant_name'].empty? - pix.merchant_city = qrcode_data['merchant_city'] if !qrcode_data['merchant_city'].nil? && !qrcode_data['merchant_city'].empty? - pix.transaction_id = qrcode_data['transaction_id'] if !qrcode_data['transaction_id'].nil? && !qrcode_data['transaction_id'].empty? - pix.amount = qrcode_data['amount'] if !qrcode_data['amount'].nil? && !qrcode_data['amount'].empty? - pix.currency = qrcode_data['currency'] if !qrcode_data['currency'].nil? && !qrcode_data['currency'].empty? - pix.country_code = qrcode_data['country_code'] if !qrcode_data['country_code'].nil? && !qrcode_data['country_code'].empty? - pix.postal_code = qrcode_data['postal_code'] if !qrcode_data['postal_code'].nil? && !qrcode_data['postal_code'].empty? - pix.repeatable = qrcode_data['repeatable'] == 't' if !qrcode_data['repeatable'].nil? && !qrcode_data['repeatable'].empty? + qrcode_data.keys.each do |key| + v = qrcode_data[key] + pix.public_send("#{key}=", key == 'repeatable' ? v == 't' : v) unless v.empty? || v.nil? + end payload = <<-HTML <label for='payload'>Payload</label> <div class='input-group mb-3'> <input class='form-control' id='payload' value='#{pix.payload}'> @@ -59,10 +52,10 @@ <div class='row' style='padding-bottom: 50px;'> <div class='col-sm-6'> <strong>QRCode informations</strong> <br> <br> - <form action='https://qrcode-pix-ruby.herokuapp.com' method='post'> + <form action='/' method='post'> <div class='mb-3'> <div class='form-text'> For static Pix, please fill the 'Pix key' field.<br> For dynamic Pix, fill the 'URL' field.<br> Do not fill both fields.