Class: ZohoHub::Quote
- Inherits:
-
BaseRecord
- Object
- BaseRecord
- ZohoHub::Quote
- Defined in:
- lib/zoho_hub/records/quote.rb
Instance Method Summary collapse
-
#initialize(params) ⇒ Quote
constructor
A new instance of Quote.
- #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, where, zoho_key_translation
Constructor Details
#initialize(params) ⇒ Quote
Returns a new instance of Quote.
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/zoho_hub/records/quote.rb', line 15 def initialize(params) puts Rainbow(params).bright.red attributes.each do |attr| zoho_key = attr_to_zoho_key(attr) send("#{attr}=", params[zoho_key] || params[attr]) end @potential_id ||= params.dig(:Deal_Name, :id) @lender_organisation_id ||= params.dig(:Account_Name, :id) end |
Instance Method Details
#to_params ⇒ Object
27 28 29 30 31 32 |
# File 'lib/zoho_hub/records/quote.rb', line 27 def to_params params = super params[:Deal_Name] = { id: @potential_id } if @potential_id params[:Account_Name] = { id: @lender_organisation_id } if @lender_organisation_id end |