Module: EPlat::Concerns::OverwriteRequestMethods

Included in:
Base
Defined in:
lib/e_plat/resource/concerns/overwrite_request_methods.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/e_plat/resource/concerns/overwrite_request_methods.rb', line 5

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#collection_path(options = {}) ⇒ Object



142
143
144
145
146
# File 'lib/e_plat/resource/concerns/overwrite_request_methods.rb', line 142

def collection_path(options = {})
  options = options.merge client.try("#{element_name}_default_request_args") || {}

  super(options)
end

#element_path(options = {}) ⇒ Object



148
149
150
151
152
# File 'lib/e_plat/resource/concerns/overwrite_request_methods.rb', line 148

def element_path(options = {})
  options = options.merge client.try("#{element_name}_default_request_args") || {}

  super(options)
end

#initialize(attributes = {}, persisted = false) ⇒ Object



131
132
133
134
135
136
137
138
139
140
# File 'lib/e_plat/resource/concerns/overwrite_request_methods.rb', line 131

def initialize(attributes = {}, persisted = false)        
  EPlat::Base::PROTECTED_ATTRIBUTES.each do |protected_attr_key|
    if attributes.key?(protected_attr_key)
      new_key_name = self.class.mapping.protected_attributes_rename_on_initialize[protected_attr_key] || "#{EPlat::PROTECTED_PREFIX}#{protected_attr_key}"
      attributes[new_key_name] = attributes.delete(protected_attr_key)
    end
  end

  super
end