Class: ZohoHub::AdverseCriteria

Inherits:
BaseRecord show all
Defined in:
lib/zoho_hub/records/adverse_criteria.rb

Instance Method Summary collapse

Methods inherited from BaseRecord

all, attribute_translation, attributes, #attributes, #build_response, build_response, create, exists?, find, find_by, #get, get, #new_record?, post, #post, put, #put, request_path, #save, #to_input, where, zoho_key_translation

Constructor Details

#initialize(params) ⇒ AdverseCriteria

Returns a new instance of AdverseCriteria.



24
25
26
27
28
29
30
31
32
33
# File 'lib/zoho_hub/records/adverse_criteria.rb', line 24

def initialize(params)
  attributes.each do |attr|
    zoho_key = attr_to_zoho_key(attr)

    send("#{attr}=", params[zoho_key] || params[attr])
  end

  # Setup values as they come from the Zoho API if needed
  @account_id ||= params.dig(:Account, :id)
end

Instance Method Details

#to_paramsObject



35
36
37
38
39
40
41
# File 'lib/zoho_hub/records/adverse_criteria.rb', line 35

def to_params
  params = super

  params[:Account] = { id: @account_id } if @account_id

  params
end