Module: DlocalGo::Responses::ResponseParser::ClassMethods

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

Overview

“Define the DSL” for all the DTOs

Instance Method Summary collapse

Instance Method Details

#has_array_data_attribute(attribute) ⇒ Object



38
39
40
# File 'lib/dlocal_go/responses/response_parser.rb', line 38

def has_array_data_attribute(attribute)
  self.array_data_attribute = attribute
end

#has_association(attribute, klass) ⇒ Object



31
32
33
34
35
36
# File 'lib/dlocal_go/responses/response_parser.rb', line 31

def has_association(attribute, klass)
  self.response_associations ||= {}
  self.response_associations[attribute] = klass

  class_eval { attr_reader attribute }
end

#has_attributes(attributes) ⇒ Object

rubocop:disable Naming/PredicateName



25
26
27
28
29
# File 'lib/dlocal_go/responses/response_parser.rb', line 25

def has_attributes(attributes)
  self.response_attributes = attributes

  class_eval { attr_reader(*attributes) }
end