Class: ZohoHub::SMSMessage
- Inherits:
-
BaseRecord
- Object
- BaseRecord
- ZohoHub::SMSMessage
- Defined in:
- lib/zoho_hub/records/sms_message.rb
Instance Method Summary collapse
-
#initialize(params) ⇒ SMSMessage
constructor
A new instance of SMSMessage.
- #to_params ⇒ Object
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) ⇒ SMSMessage
Returns a new instance of SMSMessage.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/zoho_hub/records/sms_message.rb', line 11 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 |
Instance Method Details
#to_params ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/zoho_hub/records/sms_message.rb', line 23 def to_params params = super params[:Contact] = { id: @contact_id } if @contact_id params[:Potential] = { id: @potential_id } if @potential_id params end |