Sha256: 64c8fa824a6014d5842c845b14b1fec3e36598e53d2a62c82100fd1a546acbf4
Contents?: true
Size: 785 Bytes
Versions: 13
Compression:
Stored size: 785 Bytes
Contents
# frozen_string_literal: true require 'zoho_hub/records/base_record' module ZohoHub class SMSMessage < BaseRecord attributes :id, :template, :state, :text, :contact_id, :potential_id, :name, :sent_by attribute_translation id: :id 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 @contact_id ||= params.dig(:Contact, :id) @potential_id ||= params.dig(:Potential, :id) end def to_params params = super params[:Contact] = { id: @contact_id } if @contact_id params[:Potential] = { id: @potential_id } if @potential_id params end end end
Version data entries
13 entries across 13 versions & 1 rubygems