Class: Dotloop::Section
- Inherits:
-
Object
- Object
- Dotloop::Section
- Defined in:
- lib/dotloop/section.rb
Constant Summary collapse
- FIXED_SECTIONS =
%i[ contract_dates contract_info financials geographic_description listing_information offer_dates property_address property referral ].freeze
Instance Attribute Summary collapse
-
#sections ⇒ Object
Returns the value of attribute sections.
Instance Method Summary collapse
-
#initialize(data) ⇒ Section
constructor
A new instance of Section.
- #parse_data(data) ⇒ Object
Constructor Details
#initialize(data) ⇒ Section
Returns a new instance of Section.
9 10 11 12 |
# File 'lib/dotloop/section.rb', line 9 def initialize(data) @sections = FIXED_SECTIONS.each_with_object({}) { |key, memo| memo[key] = {} }.merge(contacts: []) parse_data(data) end |
Instance Attribute Details
#sections ⇒ Object
Returns the value of attribute sections.
3 4 5 |
# File 'lib/dotloop/section.rb', line 3 def sections @sections end |
Instance Method Details
#parse_data(data) ⇒ Object
14 15 16 |
# File 'lib/dotloop/section.rb', line 14 def parse_data(data) fix_hash_keys(data).each { |item| build_section(item[0], item[1]) } end |