Class: Boletoman::Builders::Formatter
- Inherits:
-
Object
- Object
- Boletoman::Builders::Formatter
- Defined in:
- lib/boletoman/builders/formatter.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
- #acceptance ⇒ Object
- #branch ⇒ Object
- #checking_account ⇒ Object
- #covenant ⇒ Object
- #due_date ⇒ Object
-
#initialize(raw) ⇒ Formatter
constructor
A new instance of Formatter.
- #instruction1 ⇒ Object
- #instruction2 ⇒ Object
- #instruction3 ⇒ Object
- #issue_date ⇒ Object
- #nosso_numero ⇒ Object
- #payer_address ⇒ Object
- #payer_document ⇒ Object
- #payer_name ⇒ Object
- #transferor_document ⇒ Object
- #transferor_name ⇒ Object
- #value ⇒ Object
- #wallet ⇒ Object
Constructor Details
#initialize(raw) ⇒ Formatter
Returns a new instance of Formatter.
8 9 10 |
# File 'lib/boletoman/builders/formatter.rb', line 8 def initialize(raw) @raw = raw end |
Instance Attribute Details
#raw ⇒ Object
Returns the value of attribute raw.
6 7 8 |
# File 'lib/boletoman/builders/formatter.rb', line 6 def raw @raw end |
Instance Method Details
#acceptance ⇒ Object
76 77 78 |
# File 'lib/boletoman/builders/formatter.rb', line 76 def acceptance raw[:boleto][:acceptance] || 'N' end |
#branch ⇒ Object
24 25 26 |
# File 'lib/boletoman/builders/formatter.rb', line 24 def branch raw[:transferor][:branch] end |
#checking_account ⇒ Object
28 29 30 |
# File 'lib/boletoman/builders/formatter.rb', line 28 def checking_account raw[:transferor][:checking_account] end |
#covenant ⇒ Object
20 21 22 |
# File 'lib/boletoman/builders/formatter.rb', line 20 def covenant raw[:transferor][:covenant] end |
#due_date ⇒ Object
56 57 58 |
# File 'lib/boletoman/builders/formatter.rb', line 56 def due_date raw[:boleto][:due_date] end |
#instruction1 ⇒ Object
60 61 62 |
# File 'lib/boletoman/builders/formatter.rb', line 60 def instruction1 raw[:boleto][:instruction1] end |
#instruction2 ⇒ Object
64 65 66 |
# File 'lib/boletoman/builders/formatter.rb', line 64 def instruction2 raw[:boleto][:instruction2] end |
#instruction3 ⇒ Object
68 69 70 |
# File 'lib/boletoman/builders/formatter.rb', line 68 def instruction3 raw[:boleto][:instruction3] end |
#issue_date ⇒ Object
36 37 38 |
# File 'lib/boletoman/builders/formatter.rb', line 36 def issue_date raw.dig(:boleto, :issue_date) || Date.today end |
#nosso_numero ⇒ Object
72 73 74 |
# File 'lib/boletoman/builders/formatter.rb', line 72 def nosso_numero raw[:boleto][:nosso_numero] end |
#payer_address ⇒ Object
48 49 50 |
# File 'lib/boletoman/builders/formatter.rb', line 48 def payer_address full_address_for(raw[:payer]) end |
#payer_document ⇒ Object
44 45 46 |
# File 'lib/boletoman/builders/formatter.rb', line 44 def payer_document raw[:payer][:document] end |
#payer_name ⇒ Object
40 41 42 |
# File 'lib/boletoman/builders/formatter.rb', line 40 def payer_name raw[:payer][:name] end |
#transferor_document ⇒ Object
16 17 18 |
# File 'lib/boletoman/builders/formatter.rb', line 16 def transferor_document raw[:transferor][:document] end |
#transferor_name ⇒ Object
12 13 14 |
# File 'lib/boletoman/builders/formatter.rb', line 12 def transferor_name raw[:transferor][:name] end |
#value ⇒ Object
52 53 54 |
# File 'lib/boletoman/builders/formatter.rb', line 52 def value format('%1.2f', raw_value) end |
#wallet ⇒ Object
32 33 34 |
# File 'lib/boletoman/builders/formatter.rb', line 32 def wallet raw[:transferor][:wallet] end |