Class: ZohoHub::CreditScore

Inherits:
BaseRecord show all
Defined in:
lib/zoho_hub/records/credit_score.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) ⇒ CreditScore

Returns a new instance of CreditScore.



17
18
19
20
21
22
23
24
25
26
# File 'lib/zoho_hub/records/credit_score.rb', line 17

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_Name, :id)
end

Instance Method Details

#to_paramsObject



28
29
30
31
32
33
34
# File 'lib/zoho_hub/records/credit_score.rb', line 28

def to_params
  params = super

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

  params
end