Class: Boletoman::Builders::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/boletoman/builders/formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#rawObject

Returns the value of attribute raw.



6
7
8
# File 'lib/boletoman/builders/formatter.rb', line 6

def raw
  @raw
end

Instance Method Details

#acceptanceObject



76
77
78
# File 'lib/boletoman/builders/formatter.rb', line 76

def acceptance
  raw[:boleto][:acceptance] || 'N'
end

#branchObject



24
25
26
# File 'lib/boletoman/builders/formatter.rb', line 24

def branch
  raw[:transferor][:branch]
end

#checking_accountObject



28
29
30
# File 'lib/boletoman/builders/formatter.rb', line 28

def 
  raw[:transferor][:checking_account]
end

#covenantObject



20
21
22
# File 'lib/boletoman/builders/formatter.rb', line 20

def covenant
  raw[:transferor][:covenant]
end

#due_dateObject



56
57
58
# File 'lib/boletoman/builders/formatter.rb', line 56

def due_date
  raw[:boleto][:due_date]
end

#instruction1Object



60
61
62
# File 'lib/boletoman/builders/formatter.rb', line 60

def instruction1
  raw[:boleto][:instruction1]
end

#instruction2Object



64
65
66
# File 'lib/boletoman/builders/formatter.rb', line 64

def instruction2
  raw[:boleto][:instruction2]
end

#instruction3Object



68
69
70
# File 'lib/boletoman/builders/formatter.rb', line 68

def instruction3
  raw[:boleto][:instruction3]
end

#issue_dateObject



36
37
38
# File 'lib/boletoman/builders/formatter.rb', line 36

def issue_date
  raw.dig(:boleto, :issue_date) || Date.today
end

#nosso_numeroObject



72
73
74
# File 'lib/boletoman/builders/formatter.rb', line 72

def nosso_numero
  raw[:boleto][:nosso_numero]
end

#payer_addressObject



48
49
50
# File 'lib/boletoman/builders/formatter.rb', line 48

def payer_address
  full_address_for(raw[:payer])
end

#payer_documentObject



44
45
46
# File 'lib/boletoman/builders/formatter.rb', line 44

def payer_document
  raw[:payer][:document]
end

#payer_nameObject



40
41
42
# File 'lib/boletoman/builders/formatter.rb', line 40

def payer_name
  raw[:payer][:name]
end

#transferor_documentObject



16
17
18
# File 'lib/boletoman/builders/formatter.rb', line 16

def transferor_document
  raw[:transferor][:document]
end

#transferor_nameObject



12
13
14
# File 'lib/boletoman/builders/formatter.rb', line 12

def transferor_name
  raw[:transferor][:name]
end

#valueObject



52
53
54
# File 'lib/boletoman/builders/formatter.rb', line 52

def value
  format('%1.2f', raw_value)
end

#walletObject



32
33
34
# File 'lib/boletoman/builders/formatter.rb', line 32

def wallet
  raw[:transferor][:wallet]
end