Sha256: 3813548e40b6b7490542bb62b1e4396589e0296561351ec389b0bf3189a54330
Contents?: true
Size: 671 Bytes
Versions: 34
Compression:
Stored size: 671 Bytes
Contents
# frozen_string_literal: true module ZohoHub class Vendor < BaseRecord attributes :id, :email, :description, :vendor_name, :website, :owner_id, :phone, :currency attributes :company_reg_no attribute_translation( id: :id ) DEFAULTS = { currency: 'GBP' }.freeze 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 def to_params params = super params[:Owner] = { id: @owner_id } if @owner_id params end end end
Version data entries
34 entries across 34 versions & 1 rubygems