Class: ZohoHub::Vendor
- Inherits:
-
BaseRecord
- Object
- BaseRecord
- ZohoHub::Vendor
- Defined in:
- lib/zoho_hub/records/vendor.rb
Constant Summary collapse
- DEFAULTS =
{ currency: 'GBP' }.freeze
Instance Method Summary collapse
-
#initialize(params) ⇒ Vendor
constructor
A new instance of Vendor.
- #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) ⇒ Vendor
Returns a new instance of Vendor.
16 17 18 19 20 21 22 23 24 |
# File 'lib/zoho_hub/records/vendor.rb', line 16 def initialize(params) attributes.each do |attr| zoho_key = attr_to_zoho_key(attr) send("#{attr}=", params[zoho_key] || params[attr] || DEFAULTS[attr]) end @owner_id ||= params.dig(:Owner, :id) end |
Instance Method Details
#to_params ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/zoho_hub/records/vendor.rb', line 26 def to_params params = super params[:Owner] = { id: @owner_id } if @owner_id params end |