Module: DlocalGo::Responses::ResponseParser

Included in:
Base
Defined in:
lib/dlocal_go/responses/response_parser.rb

Overview

Module that makes it easier for DTOs to define their schema

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/dlocal_go/responses/response_parser.rb', line 7

def self.included(base)
  base.class_eval { class_attribute :response_attributes, :response_associations, :array_data_attribute }

  base.extend(ClassMethods)

  base.class_eval <<-CODE, __FILE__, __LINE__ + 1
    def initialize(response, options = {})
      extract_options(options)

      assign_attributes(response)
      assign_associations(response)
    end
  CODE
end