Class: FTF::Mappings::Report
- Inherits:
-
Object
- Object
- FTF::Mappings::Report
- Defined in:
- lib/ftf/mappings/report.rb
Instance Attribute Summary collapse
-
#products ⇒ Object
readonly
Returns the value of attribute products.
Instance Method Summary collapse
- #file_type ⇒ Object
- #fiscal_id ⇒ Object
- #index ⇒ Object
-
#initialize(data) ⇒ Report
constructor
A new instance of Report.
- #parse(data) ⇒ Object
- #period ⇒ Object
- #render_footer(index) ⇒ Object
- #render_header(index) ⇒ Object
- #request_id ⇒ Object
Constructor Details
Instance Attribute Details
#products ⇒ Object (readonly)
Returns the value of attribute products.
6 7 8 |
# File 'lib/ftf/mappings/report.rb', line 6 def products @products end |
Instance Method Details
#file_type ⇒ Object
40 41 42 |
# File 'lib/ftf/mappings/report.rb', line 40 def file_type @data[:file_type] end |
#fiscal_id ⇒ Object
32 33 34 |
# File 'lib/ftf/mappings/report.rb', line 32 def fiscal_id @data[:fiscal_id] end |
#index ⇒ Object
48 49 50 51 |
# File 'lib/ftf/mappings/report.rb', line 48 def index index = @data[:index] || 1 index.to_s.rjust(3, "0") end |
#parse(data) ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ftf/mappings/report.rb', line 13 def parse(data) case data when Hash data when String JSON.parse(data, symbolize_names: true) else raise "Please provide a JSON string to parse or a symbol-keyed hash" end end |
#period ⇒ Object
36 37 38 |
# File 'lib/ftf/mappings/report.rb', line 36 def period @data[:period] end |
#render_footer(index) ⇒ Object
28 29 30 |
# File 'lib/ftf/mappings/report.rb', line 28 def (index) Records::Footer.new(index, self).render end |
#render_header(index) ⇒ Object
24 25 26 |
# File 'lib/ftf/mappings/report.rb', line 24 def render_header(index) Records::Header.new(index, self).render end |
#request_id ⇒ Object
44 45 46 |
# File 'lib/ftf/mappings/report.rb', line 44 def request_id @data[:request_id] end |